Skip to content

Commit d48624b

Browse files
committed
Make bars clickable
1 parent 4d509f9 commit d48624b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

site/src/components/GanttChart/Bar.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ export const Bar = forwardRef<HTMLDivElement, BarProps>(
2828
css={[styles.root, { transform: `translateX(${x}px)` }]}
2929
{...htmlProps}
3030
>
31-
<div css={[styles.bar, colorStyles[color], { width }]}>{children}</div>
31+
<button
32+
type="button"
33+
css={[styles.bar, colorStyles[color], { width }]}
34+
disabled={htmlProps.disabled}
35+
aria-labelledby={htmlProps["aria-labelledby"]}
36+
>
37+
{children}
38+
</button>
3239
{afterLabel}
3340
</div>
3441
);
@@ -47,6 +54,18 @@ const styles = {
4754
border: "1px solid transparent",
4855
borderRadius: 8,
4956
height: 32,
57+
display: "flex",
58+
padding: 0,
59+
60+
"&:not(:disabled)": {
61+
cursor: "pointer",
62+
63+
"&:focus, &:hover, &:active": {
64+
outline: "none",
65+
background: "#082F49",
66+
borderColor: "#38BDF8",
67+
},
68+
},
5069
},
5170
} satisfies Record<string, Interpolation<Theme>>;
5271

site/src/modules/workspaces/WorkspaceTimingChart/WorkspaceTimingChart.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const WorkspaceTimingChart: FC<WorkspaceTimingChartProps> = ({
102102
}
103103
aria-labelledby={`${s.name}-label`}
104104
ref={applyBarHeightToLabel}
105+
disabled={timings.length <= 1}
105106
>
106107
{timings.length > 1 && (
107108
<TimingBlocks

0 commit comments

Comments
 (0)