mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Badge: option to show short/full versions of contents (#1397)
* add button to expand and view whole badge contents Signed-off-by: Sebastian Malton <sebastian@malton.name> * revert font changes due to update elsewhere already existing Signed-off-by: Sebastian Malton <sebastian@malton.name> * make expanding icon smaller and not focusable Signed-off-by: Sebastian Malton <sebastian@malton.name> * extended badge content by click, selecting text from label doesn't trigger auto-closing Signed-off-by: Roman <ixrock@gmail.com> * fix: hover only intercative badges (with extra content) Signed-off-by: Roman <ixrock@gmail.com> * added common document/selectionchange watcher Signed-off-by: Roman <ixrock@gmail.com> * lint fixes Signed-off-by: Roman <ixrock@gmail.com> * Convert Badge to CSS Modules Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Align Badge styles across components Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Cleaning up Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Not closing badge if user started to select text Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> Co-authored-by: Sebastian Malton <sebastian@malton.name> Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
ebb54facf9
commit
ca1ad425ab
@ -27,13 +27,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
.Badge {
|
@include release-status-bgs;
|
||||||
@include release-status-bgs;
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart {
|
.chart {
|
||||||
|
|||||||
@ -272,7 +272,7 @@ export class ReleaseDetails extends Component<Props> {
|
|||||||
<DrawerItem name="Status" className="status" labelsOnly>
|
<DrawerItem name="Status" className="status" labelsOnly>
|
||||||
<Badge
|
<Badge
|
||||||
label={release.getStatus()}
|
label={release.getStatus()}
|
||||||
className={cssNames("status", kebabCase(release.getStatus()))}
|
className={kebabCase(release.getStatus())}
|
||||||
/>
|
/>
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
{this.renderValues()}
|
{this.renderValues()}
|
||||||
|
|||||||
@ -88,6 +88,7 @@ export class CatalogEntityItem<T extends CatalogEntity> implements ItemObject {
|
|||||||
onClick?.(event);
|
onClick?.(event);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}}
|
}}
|
||||||
|
expandable={false}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
@import "autoscaler.mixins";
|
@import "autoscaler.mixins";
|
||||||
|
|
||||||
.HpaDetails {
|
.HpaDetails {
|
||||||
.Badge {
|
.status {
|
||||||
@include hpa-status-bgc;
|
@include hpa-status-bgc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ export class HpaDetails extends React.Component<Props> {
|
|||||||
{hpa.getReplicas()}
|
{hpa.getReplicas()}
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
|
|
||||||
<DrawerItem name="Status" labelsOnly>
|
<DrawerItem name="Status" className="status" labelsOnly>
|
||||||
{hpa.getConditions().map(({ type, tooltip, isReady }) => {
|
{hpa.getConditions().map(({ type, tooltip, isReady }) => {
|
||||||
if (!isReady) return null;
|
if (!isReady) return null;
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,7 @@
|
|||||||
&.status {
|
&.status {
|
||||||
flex: 1.5;
|
flex: 1.5;
|
||||||
@include table-cell-labels-offsets;
|
@include table-cell-labels-offsets;
|
||||||
|
@include hpa-status-bgc;
|
||||||
.Badge {
|
|
||||||
@include hpa-status-bgc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.age {
|
&.age {
|
||||||
|
|||||||
@ -104,6 +104,7 @@ export class HorizontalPodAutoscalers extends React.Component<Props> {
|
|||||||
label={type}
|
label={type}
|
||||||
tooltip={tooltip}
|
tooltip={tooltip}
|
||||||
className={cssNames(type.toLowerCase())}
|
className={cssNames(type.toLowerCase())}
|
||||||
|
expandable={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
@ -79,7 +79,7 @@ export class Secrets extends React.Component<Props> {
|
|||||||
secret.getName(),
|
secret.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={secret} />,
|
<KubeObjectStatusIcon key="icon" object={secret} />,
|
||||||
secret.getNs(),
|
secret.getNs(),
|
||||||
secret.getLabels().map(label => <Badge key={label} label={label}/>),
|
secret.getLabels().map(label => <Badge key={label} label={label} expandable={false}/>),
|
||||||
secret.getKeys().join(", "),
|
secret.getKeys().join(", "),
|
||||||
secret.type,
|
secret.type,
|
||||||
secret.getAge(),
|
secret.getAge(),
|
||||||
|
|||||||
@ -23,11 +23,9 @@
|
|||||||
|
|
||||||
.CRDDetails {
|
.CRDDetails {
|
||||||
.conditions {
|
.conditions {
|
||||||
.Badge {
|
@include crd-condition-bgc;
|
||||||
@include crd-condition-bgc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Table {
|
.Table {
|
||||||
margin-left: -$margin * 2;
|
margin-left: -$margin * 2;
|
||||||
margin-right: -$margin * 2;
|
margin-right: -$margin * 2;
|
||||||
@ -41,21 +39,8 @@
|
|||||||
flex: 0.5;
|
flex: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
|
||||||
flex: 1.5;
|
|
||||||
|
|
||||||
.Badge {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.json-path {
|
.json-path {
|
||||||
flex: 3;
|
flex: 3;
|
||||||
|
|
||||||
.Badge {
|
|
||||||
white-space: pre-line;
|
|
||||||
text-overflow: initial;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import React from "react";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import type { CustomResourceDefinition } from "../../api/endpoints/crd.api";
|
import type { CustomResourceDefinition } from "../../api/endpoints/crd.api";
|
||||||
import { cssNames } from "../../utils";
|
|
||||||
import { AceEditor } from "../ace-editor";
|
import { AceEditor } from "../ace-editor";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||||
@ -86,7 +85,8 @@ export class CRDDetails extends React.Component<Props> {
|
|||||||
<Badge
|
<Badge
|
||||||
key={type}
|
key={type}
|
||||||
label={type}
|
label={type}
|
||||||
className={cssNames({ disabled: status === "False" }, type)}
|
disabled={status === "False"}
|
||||||
|
className={type}
|
||||||
tooltip={(
|
tooltip={(
|
||||||
<>
|
<>
|
||||||
<p>{message}</p>
|
<p>{message}</p>
|
||||||
|
|||||||
@ -21,13 +21,9 @@
|
|||||||
|
|
||||||
.CrdResourceDetails {
|
.CrdResourceDetails {
|
||||||
.status {
|
.status {
|
||||||
.value {
|
.ready {
|
||||||
.Badge {
|
color: white;
|
||||||
&.ready {
|
background-color: $colorOk;
|
||||||
color: white;
|
|
||||||
background-color: $colorOk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +90,8 @@ export class CrdResourceDetails extends React.Component<Props> {
|
|||||||
.map(({ kind, message, status }, index) => (
|
.map(({ kind, message, status }, index) => (
|
||||||
<Badge
|
<Badge
|
||||||
key={kind + index} label={kind}
|
key={kind + index} label={kind}
|
||||||
className={cssNames({ disabled: status === "False" }, kind.toLowerCase())}
|
disabled={status === "False"}
|
||||||
|
className={kind.toLowerCase()}
|
||||||
tooltip={message}
|
tooltip={message}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|||||||
@ -30,7 +30,7 @@ $crd-condition-colors: (
|
|||||||
|
|
||||||
@mixin crd-condition-bgc {
|
@mixin crd-condition-bgc {
|
||||||
@each $status, $color in $crd-condition-colors {
|
@each $status, $color in $crd-condition-colors {
|
||||||
&.#{$status} {
|
.#{$status} {
|
||||||
background: $color;
|
background: $color;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,6 @@
|
|||||||
--status-default-bg: #{$colorError};
|
--status-default-bg: #{$colorError};
|
||||||
|
|
||||||
.conditions {
|
.conditions {
|
||||||
.Badge {
|
@include node-status-bgs;
|
||||||
cursor: default;
|
|
||||||
@include node-status-bgs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ $node-status-color-list: (
|
|||||||
|
|
||||||
@mixin node-status-bgs {
|
@mixin node-status-bgs {
|
||||||
@each $status, $color in $node-status-color-list {
|
@each $status, $color in $node-status-color-list {
|
||||||
&.#{$status} {
|
.#{$status} {
|
||||||
background: $color;
|
background: $color;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,8 +33,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.conditions {
|
.conditions {
|
||||||
.Badge {
|
@include job-condition-bgs;
|
||||||
@include job-condition-bgs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,21 +21,19 @@
|
|||||||
|
|
||||||
.DeploymentDetails {
|
.DeploymentDetails {
|
||||||
.conditions {
|
.conditions {
|
||||||
.Badge {
|
.available {
|
||||||
&.available {
|
color: white;
|
||||||
color: white;
|
background-color: $deployment-available;
|
||||||
background-color: $deployment-available;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
&.progressing {
|
.progressing {
|
||||||
color: white;
|
color: white;
|
||||||
background-color: $deployment-progressing;
|
background-color: $deployment-progressing;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.replica-failure {
|
.replica-failure {
|
||||||
color: white;
|
color: white;
|
||||||
background-color: $deployment-replicafailure;
|
background-color: $deployment-replicafailure;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,6 @@ import { disposeOnUnmount, observer } from "mobx-react";
|
|||||||
import { DrawerItem } from "../drawer";
|
import { DrawerItem } from "../drawer";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import type { Deployment } from "../../api/endpoints";
|
import type { Deployment } from "../../api/endpoints";
|
||||||
import { cssNames } from "../../utils";
|
|
||||||
import { PodDetailsTolerations } from "../+workloads-pods/pod-details-tolerations";
|
import { PodDetailsTolerations } from "../+workloads-pods/pod-details-tolerations";
|
||||||
import { PodDetailsAffinities } from "../+workloads-pods/pod-details-affinities";
|
import { PodDetailsAffinities } from "../+workloads-pods/pod-details-affinities";
|
||||||
import { podsStore } from "../+workloads-pods/pods.store";
|
import { podsStore } from "../+workloads-pods/pods.store";
|
||||||
@ -118,7 +117,8 @@ export class DeploymentDetails extends React.Component<Props> {
|
|||||||
<Badge
|
<Badge
|
||||||
key={type}
|
key={type}
|
||||||
label={type}
|
label={type}
|
||||||
className={cssNames({ disabled: status === "False" }, kebabCase(type))}
|
disabled={status === "False"}
|
||||||
|
className={kebabCase(type)}
|
||||||
tooltip={(
|
tooltip={(
|
||||||
<>
|
<>
|
||||||
<p>{message}</p>
|
<p>{message}</p>
|
||||||
|
|||||||
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
.JobDetails {
|
.JobDetails {
|
||||||
.conditions {
|
.conditions {
|
||||||
.Badge {
|
@include job-condition-bgs;
|
||||||
@include job-condition-bgs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,8 +58,4 @@
|
|||||||
|
|
||||||
@include pod-status-colors;
|
@include pod-status-colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Badge {
|
|
||||||
white-space: normal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ export class PodDetails extends React.Component<Props> {
|
|||||||
<Badge
|
<Badge
|
||||||
key={type}
|
key={type}
|
||||||
label={type}
|
label={type}
|
||||||
className={cssNames({ disabled: status === "False" })}
|
disabled={status === "False"}
|
||||||
tooltip={`Last transition time: ${lastTransitionTime}`}
|
tooltip={`Last transition time: ${lastTransitionTime}`}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -127,7 +127,7 @@ export class Pods extends React.Component<Props> {
|
|||||||
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(pod: Pod) => [
|
renderTableContents={(pod: Pod) => [
|
||||||
<Badge flat key="name" label={pod.getName()} tooltip={pod.getName()} />,
|
<Badge flat key="name" label={pod.getName()} tooltip={pod.getName()} expandable={false} />,
|
||||||
<KubeObjectStatusIcon key="icon" object={pod} />,
|
<KubeObjectStatusIcon key="icon" object={pod} />,
|
||||||
pod.getNs(),
|
pod.getNs(),
|
||||||
this.renderContainersStatus(pod),
|
this.renderContainersStatus(pod),
|
||||||
@ -145,7 +145,7 @@ export class Pods extends React.Component<Props> {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
pod.getNodeName() ?
|
pod.getNodeName() ?
|
||||||
<Badge flat key="node" className="node" tooltip={pod.getNodeName()}>
|
<Badge flat key="node" className="node" tooltip={pod.getNodeName()} expandable={false}>
|
||||||
<Link to={getDetailsUrl(nodesApi.getUrl({ name: pod.getNodeName() }))} onClick={stopPropagation}>
|
<Link to={getDetailsUrl(nodesApi.getUrl({ name: pod.getNodeName() }))} onClick={stopPropagation}>
|
||||||
{pod.getNodeName()}
|
{pod.getNodeName()}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@ -98,7 +98,7 @@ $cronjob-condition-color-list: (
|
|||||||
|
|
||||||
@mixin job-condition-bgs {
|
@mixin job-condition-bgs {
|
||||||
@each $condition, $color in $job-condition-color-list {
|
@each $condition, $color in $job-condition-color-list {
|
||||||
&.#{$condition} {
|
.#{$condition} {
|
||||||
color: white;
|
color: white;
|
||||||
background: $color;
|
background: $color;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,25 +19,41 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.Badge {
|
.badge {
|
||||||
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
white-space: nowrap;
|
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge + .badge {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge.interactive:hover {
|
||||||
|
background-color: var(--mainBackground);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge:not(.isExpanded) {
|
||||||
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
&:not(.flat) {
|
|
||||||
background: $colorVague;
|
.badge:not(.flat) {
|
||||||
color: $textColorSecondary;
|
background: var(--colorVague);
|
||||||
border-radius: $radius;
|
border-radius: 3px;
|
||||||
padding: .2em .4em;
|
padding: .2em .4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.small {
|
.small {
|
||||||
font-size: $font-size-small;
|
font-size: var(--font-size-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.clickable {
|
.clickable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
@ -19,29 +19,84 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "./badge.scss";
|
import styles from "./badge.module.css";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { computed, makeObservable, observable } from "mobx";
|
||||||
|
import { observer } from "mobx-react";
|
||||||
import { cssNames } from "../../utils/cssNames";
|
import { cssNames } from "../../utils/cssNames";
|
||||||
import { TooltipDecoratorProps, withTooltip } from "../tooltip";
|
import { TooltipDecoratorProps, withTooltip } from "../tooltip";
|
||||||
|
import { boundMethod } from "../../utils";
|
||||||
|
|
||||||
export interface BadgeProps extends React.HTMLAttributes<any>, TooltipDecoratorProps {
|
export interface BadgeProps extends React.HTMLAttributes<any>, TooltipDecoratorProps {
|
||||||
small?: boolean;
|
small?: boolean;
|
||||||
flat?: boolean;
|
flat?: boolean;
|
||||||
label?: React.ReactNode;
|
label?: React.ReactNode;
|
||||||
|
expandable?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Common handler for all Badge instances
|
||||||
|
document.addEventListener("selectionchange", () => {
|
||||||
|
Badge.badgeMeta.hasTextSelected ||= window.getSelection().toString().trim().length > 0;
|
||||||
|
});
|
||||||
|
|
||||||
@withTooltip
|
@withTooltip
|
||||||
|
@observer
|
||||||
export class Badge extends React.Component<BadgeProps> {
|
export class Badge extends React.Component<BadgeProps> {
|
||||||
render() {
|
static defaultProps: Partial<BadgeProps> = {
|
||||||
const { className, label, small, flat, children, ...elemProps } = this.props;
|
expandable: true
|
||||||
const clickable = Boolean(this.props.onClick);
|
};
|
||||||
|
|
||||||
return <>
|
static badgeMeta = observable({
|
||||||
<span className={cssNames("Badge", { small, flat, clickable }, className)} {...elemProps}>
|
hasTextSelected: false
|
||||||
|
});
|
||||||
|
|
||||||
|
@observable.ref elem: HTMLElement;
|
||||||
|
@observable isExpanded = false;
|
||||||
|
|
||||||
|
constructor(props: BadgeProps) {
|
||||||
|
super(props);
|
||||||
|
makeObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get isExpandable() {
|
||||||
|
if (!this.props.expandable) return false;
|
||||||
|
|
||||||
|
return this.elem?.clientWidth < this.elem?.scrollWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@boundMethod
|
||||||
|
onMouseUp() {
|
||||||
|
if (!this.isExpandable || Badge.badgeMeta.hasTextSelected) {
|
||||||
|
Badge.badgeMeta.hasTextSelected = false;
|
||||||
|
} else {
|
||||||
|
this.isExpanded = !this.isExpanded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@boundMethod
|
||||||
|
bindRef(elem: HTMLElement) {
|
||||||
|
this.elem = elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { className, label, disabled, small, children, flat, expandable, ...elemProps } = this.props;
|
||||||
|
const clickable = Boolean(this.props.onClick) || this.isExpandable;
|
||||||
|
const classNames = cssNames(styles.badge, className, {
|
||||||
|
[styles.small]: small,
|
||||||
|
[styles.flat]: flat,
|
||||||
|
[styles.clickable]: clickable,
|
||||||
|
[styles.interactive]: this.isExpandable,
|
||||||
|
[styles.isExpanded]: this.isExpanded,
|
||||||
|
[styles.disabled]: disabled
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div {...elemProps} className={classNames} onMouseUp={this.onMouseUp} ref={this.bindRef}>
|
||||||
{label}
|
{label}
|
||||||
{children}
|
{children}
|
||||||
</span>
|
</div>
|
||||||
</>;
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.legend {
|
.legend {
|
||||||
.Badge {
|
.LegendBadge {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
transition: background-color 250ms;
|
transition: background-color 250ms;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
|
|||||||
@ -169,7 +169,7 @@ export class Chart extends React.Component<ChartProps> {
|
|||||||
const labelElem = (title: string, color: string, tooltip?: string) => (
|
const labelElem = (title: string, color: string, tooltip?: string) => (
|
||||||
<Badge
|
<Badge
|
||||||
key={title}
|
key={title}
|
||||||
className="flex gaps align-center"
|
className="LegendBadge flex gaps align-center"
|
||||||
label={(
|
label={(
|
||||||
<div>
|
<div>
|
||||||
<StatusBrick style={{ backgroundColor: color }}/>
|
<StatusBrick style={{ backgroundColor: color }}/>
|
||||||
@ -177,6 +177,7 @@ export class Chart extends React.Component<ChartProps> {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
tooltip={tooltip}
|
tooltip={tooltip}
|
||||||
|
expandable={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
&.Badge:hover {
|
&.LegendBadge:hover {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,13 +69,14 @@ export class ShowMetricsSetting extends React.Component<Props> {
|
|||||||
const tooltipId = `${name}`;
|
const tooltipId = `${name}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge key={name} flat>
|
<Badge key={name} flat expandable={false}>
|
||||||
<span id={tooltipId}>{name}</span>
|
<span id={tooltipId}>{name}</span>
|
||||||
<Icon
|
<Icon
|
||||||
smallest
|
smallest
|
||||||
material="clear"
|
material="clear"
|
||||||
onClick={() => this.removeMetric(name)}
|
onClick={() => this.removeMetric(name)}
|
||||||
tooltip="Remove"
|
tooltip="Remove"
|
||||||
|
className="mx-3"
|
||||||
/>
|
/>
|
||||||
</Badge>
|
</Badge>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -30,10 +30,6 @@
|
|||||||
margin-right: var(--padding);
|
margin-right: var(--padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
.Badge {
|
|
||||||
background-color: var(--dockBadgeBackground);
|
|
||||||
}
|
|
||||||
|
|
||||||
> .controls {
|
> .controls {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex: 1 1;
|
flex: 1 1;
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Badge {
|
> div {
|
||||||
float: left;
|
float: left;
|
||||||
margin: $spacing;
|
margin: $spacing;
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
top: -20px;
|
top: -20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Badge {
|
.SelectorIndex {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: var(--secondaryBackground);
|
background: var(--secondaryBackground);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@ -49,6 +49,7 @@ export function HotbarSelector({ hotbar }: Props) {
|
|||||||
preferredPositions: [TooltipPosition.TOP, TooltipPosition.TOP_LEFT],
|
preferredPositions: [TooltipPosition.TOP, TooltipPosition.TOP_LEFT],
|
||||||
children: hotbar.name
|
children: hotbar.name
|
||||||
}}
|
}}
|
||||||
|
className="SelectorIndex"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Icon material="play_arrow" className="next box" onClick={() => store.switchToNext()} />
|
<Icon material="play_arrow" className="next box" onClick={() => store.switchToNext()} />
|
||||||
|
|||||||
@ -153,4 +153,4 @@
|
|||||||
@extend .active;
|
@extend .active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ export class PageFiltersList extends React.Component<Props> {
|
|||||||
<Badge
|
<Badge
|
||||||
key={`${type}-${value}`}
|
key={`${type}-${value}`}
|
||||||
title={type}
|
title={type}
|
||||||
className={cssNames("flex gaps filter align-center", type)}
|
className={cssNames("Badge flex gaps filter align-center", type)}
|
||||||
label={(
|
label={(
|
||||||
<>
|
<>
|
||||||
<FilterIcon type={type}/>
|
<FilterIcon type={type}/>
|
||||||
|
|||||||
@ -49,8 +49,4 @@
|
|||||||
@mixin table-cell-labels-offsets {
|
@mixin table-cell-labels-offsets {
|
||||||
padding-top: $padding / 2;
|
padding-top: $padding / 2;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
|
|
||||||
.Badge + .Badge {
|
|
||||||
margin-left: $padding / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user