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:
authored and GitHub committed 2021-07-13 17:00:11 +03:00
1 parent ebb54facf9
commit ca1ad425ab
36 files changed
+143 -115

No files matched your search

@@ -23,11 +23,9 @@
.CRDDetails {
.conditions {
.Badge {
@include crd-condition-bgc;
}
@include crd-condition-bgc;
}
.Table {
margin-left: -$margin * 2;
margin-right: -$margin * 2;
@@ -41,21 +39,8 @@
flex: 0.5;
}
.description {
flex: 1.5;
.Badge {
background: transparent;
}
}
.json-path {
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 { observer } from "mobx-react";
import type { CustomResourceDefinition } from "../../api/endpoints/crd.api";
import { cssNames } from "../../utils";
import { AceEditor } from "../ace-editor";
import { Badge } from "../badge";
import { DrawerItem, DrawerTitle } from "../drawer";
@@ -86,7 +85,8 @@ export class CRDDetails extends React.Component<Props> {
<Badge
key={type}
label={type}
className={cssNames({ disabled: status === "False" }, type)}
disabled={status === "False"}
className={type}
tooltip={(
<>
<p>{message}</p>
@@ -21,13 +21,9 @@
.CrdResourceDetails {
.status {
.value {
.Badge {
&.ready {
color: white;
background-color: $colorOk;
}
}
.ready {
color: white;
background-color: $colorOk;
}
}
}
@@ -90,7 +90,8 @@ export class CrdResourceDetails extends React.Component<Props> {
.map(({ kind, message, status }, index) => (
<Badge
key={kind + index} label={kind}
className={cssNames({ disabled: status === "False" }, kind.toLowerCase())}
disabled={status === "False"}
className={kind.toLowerCase()}
tooltip={message}
/>
));
@@ -30,7 +30,7 @@ $crd-condition-colors: (
@mixin crd-condition-bgc {
@each $status, $color in $crd-condition-colors {
&.#{$status} {
.#{$status} {
background: $color;
color: white;
}