Skip to content

Commit

Permalink
feat(Indicator): allow use prop card to show as card indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
ecarreras committed Feb 13, 2025
1 parent 59df2fa commit 2377876
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/widgets/custom/Indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const GraphIndicatorInput = (props: IndicatorInputProps) => {
action={treeShortcut}
openAction={openShortcut as any}
tooltip={description}
card={ooui.card}
>
{loading && <CenteredSpinner />}
{!loading && (
Expand Down
26 changes: 22 additions & 4 deletions src/widgets/views/Graph/GraphCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ const { useToken } = theme;
const { Text } = Typography;

export const GraphCard = (props: GraphCardProps) => {
const { title, children, action, openAction, parms, tooltip } = props;
const {
title,
children,
action,
openAction,
parms,
tooltip,
card = false,
} = props;
const { token } = useToken();

const hasDragAndDrop = Object.keys(parms).length > 0;
Expand All @@ -28,8 +36,8 @@ export const GraphCard = (props: GraphCardProps) => {
<Row
align="middle"
style={{
borderBottom: "1px solid #ddd",
backgroundColor: token.colorPrimaryBg,
borderBottom: card ? "none" : "1px solid #ddd",
backgroundColor: card ? token.colorBgBase : token.colorPrimaryBg,
}}
wrap={false}
>
Expand All @@ -51,7 +59,17 @@ export const GraphCard = (props: GraphCardProps) => {
<Text ellipsis={true}>{title}</Text>
</>
) : (
<Text ellipsis={true}>{title}</Text>
<Text
ellipsis={true}
style={{
color: card
? token.colorTextDescription
: token.colorTextHeading,
fontWeight: card ? "normal" : "bold",
}}
>
{title}
</Text>
)}
</Col>
{action && (
Expand Down
1 change: 1 addition & 0 deletions src/widgets/views/Graph/GraphCard.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export type GraphCardProps = {
action?: ShortcutApi;
openAction?: (shortcutApi?: ShortcutApi) => void;
tooltip?: string;
card?: boolean;
};

0 comments on commit 2377876

Please sign in to comment.