Skip to content

Commit

Permalink
pkg/ui: Don't force tracez tags to uppercase.
Browse files Browse the repository at this point in the history
Also, deprecate uses of db-console/.../Badge in favor of the identical version
in cluster-ui.

Release note: None
  • Loading branch information
benbardin committed Jul 11, 2022
1 parent 672f201 commit e145082
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 161 deletions.
5 changes: 4 additions & 1 deletion pkg/ui/workspaces/cluster-ui/src/badge/badge.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
display: flex;
flex-direction: row;
border-radius: 3px;
text-transform: uppercase;
width: max-content;
padding: $spacing-xx-small $spacing-x-small;
cursor: default;
}

.badge--uppercase {
text-transform: uppercase;
}

.badge--size-small,
.badge--size-large,
.badge--size-medium {
Expand Down
9 changes: 7 additions & 2 deletions pkg/ui/workspaces/cluster-ui/src/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ export interface BadgeProps {
status?: BadgeStatus;
icon?: React.ReactNode;
iconPosition?: "left" | "right";
allowLowerCase?: boolean;
}

const cx = classNames.bind(styles);

export function Badge(props: BadgeProps) {
const { size, status, icon, iconPosition, text } = props;
const classes = cx("badge", `badge--size-${size}`, `badge--status-${status}`);
const { size, status, icon, iconPosition, text, allowLowerCase } = props;
const styles = ["badge", `badge--size-${size}`, `badge--status-${status}`];
if (!allowLowerCase) {
styles.push("badge--uppercase");
}
const classes = cx(...styles);
const iconClasses = cx(
"badge__icon",
`badge__icon--position-${iconPosition || "left"}`,
Expand Down

This file was deleted.

This file was deleted.

46 changes: 0 additions & 46 deletions pkg/ui/workspaces/db-console/src/components/badge/badge.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions pkg/ui/workspaces/db-console/src/components/badge/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion pkg/ui/workspaces/db-console/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

export * from "./badge";
export * from "./button";
export * from "./icon";
export * from "./inlineAlert/inlineAlert";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import {
PageHeader,
Text,
TextTypes,
Badge,
} from "src/components";
import { Badge } from "@cockroachlabs/cluster-ui";

import "./layout.styl";
import "./layoutPanel.styl";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import { AdminUIState } from "src/redux/state";
import { refreshNodes, refreshLiveness } from "src/redux/apiReducers";
import { LocalSetting } from "src/redux/localsettings";
import { INodeStatus, MetricConstants } from "src/util/proto";
import { Text, TextTypes, Tooltip, Badge, BadgeProps } from "src/components";
import { Text, TextTypes, Tooltip } from "src/components";
import {
Badge,
BadgeProps,
ColumnsConfig,
Table,
SortSetting,
Expand Down
1 change: 1 addition & 0 deletions pkg/ui/workspaces/db-console/src/views/tracez/tracez.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const TagBadge = ({
size="small"
status={badgeStatus}
icon={icon}
allowLowerCase={true}
/>
</Button>
);
Expand Down

0 comments on commit e145082

Please sign in to comment.