Skip to content

Commit 9cf6009

Browse files
authored
show selection indicator for history events accordion (#890)
1 parent cbbbcd5 commit 9cf6009

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed

src/views/workflow-history/workflow-history-events-card/workflow-history-events-card.styles.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { type Theme } from 'baseui';
2-
import { type AccordionOverrides } from 'baseui/accordion';
1+
import { type Theme, withStyle } from 'baseui';
2+
import {
3+
type StatelessAccordion,
4+
type AccordionOverrides,
5+
} from 'baseui/accordion';
36
import { type SkeletonOverrides } from 'baseui/skeleton/types';
7+
import { StyledTableHeadCell } from 'baseui/table-semantic';
48
import { type StyleObject } from 'styletron-react';
59

610
import type {
@@ -10,7 +14,7 @@ import type {
1014

1115
import getBadgeContainerSize from '../workflow-history-event-status-badge/helpers/get-badge-container-size';
1216

13-
export const overrides = {
17+
export const overrides = (animateBorderOnEnter?: boolean) => ({
1418
circularSkeleton: {
1519
Root: {
1620
style: {
@@ -23,6 +27,17 @@ export const overrides = {
2327
style: ({ $theme }: { $theme: Theme }): StyleObject => ({
2428
...$theme.borders.border100,
2529
borderRadius: $theme.borders.radius300,
30+
animationDuration: '2s',
31+
...(animateBorderOnEnter && {
32+
animationName: {
33+
from: {
34+
boxShadow: `0px 0px 0px 2px ${$theme.colors.primary}`,
35+
},
36+
to: {
37+
boxShadow: `0px 0px 0px 0px rgba(0, 0, 0, 0)`,
38+
},
39+
},
40+
}),
2641
overflow: 'hidden',
2742
}),
2843
},
@@ -66,7 +81,7 @@ export const overrides = {
6681
}),
6782
},
6883
} satisfies AccordionOverrides,
69-
};
84+
});
7085

7186
const cssStylesObj = {
7287
eventLabel: ($theme: Theme) => ({

src/views/workflow-history/workflow-history-events-card/workflow-history-events-card.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import WorkflowHistoryEventDetails from '../workflow-history-event-details/workf
1010
import getBadgeContainerSize from '../workflow-history-event-status-badge/helpers/get-badge-container-size';
1111
import WorkflowHistoryEventStatusBadge from '../workflow-history-event-status-badge/workflow-history-event-status-badge';
1212

13-
import { cssStyles, overrides } from './workflow-history-events-card.styles';
13+
import {
14+
cssStyles,
15+
overrides as getOverrides,
16+
} from './workflow-history-events-card.styles';
1417
import { type Props } from './workflow-history-events-card.types';
1518

1619
export default function WorkflowHistoryEventsCard({
@@ -20,6 +23,7 @@ export default function WorkflowHistoryEventsCard({
2023
decodedPageUrlParams,
2124
getIsEventExpanded,
2225
onEventToggle,
26+
animateBorderOnEnter,
2327
}: Props) {
2428
const { cls, theme } = useStyletronClasses(cssStyles);
2529

@@ -29,6 +33,7 @@ export default function WorkflowHistoryEventsCard({
2933
if (getIsEventExpanded(id)) result.push(id);
3034
return result;
3135
}, [] as string[]);
36+
const overrides = getOverrides(animateBorderOnEnter);
3237

3338
return (
3439
<StatelessAccordion overrides={overrides.accordion} expanded={expanded}>

src/views/workflow-history/workflow-history-events-card/workflow-history-events-card.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export type Props = {
1515
decodedPageUrlParams: WorfklowHistoryProps['params'];
1616
getIsEventExpanded: GetIsEventExpanded;
1717
onEventToggle: ToggleIsEventExpanded;
18+
animateBorderOnEnter?: boolean;
1819
};

src/views/workflow-history/workflow-history-timeline-group/workflow-history-timeline-group.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default function WorkflowHistoryTimelineGroup({
3030
getIsEventExpanded,
3131
onEventToggle,
3232
onReset,
33+
selected,
3334
}: Props) {
3435
const { cls } = useStyletronClasses(cssStyles);
3536
const hasBadges = badges !== undefined && badges.length > 0;
@@ -88,6 +89,7 @@ export default function WorkflowHistoryTimelineGroup({
8889
decodedPageUrlParams={decodedPageUrlParams}
8990
getIsEventExpanded={getIsEventExpanded}
9091
onEventToggle={onEventToggle}
92+
animateBorderOnEnter={selected}
9193
/>
9294
</div>
9395
</div>

src/views/workflow-history/workflow-history-timeline-group/workflow-history-timeline-group.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ export type Props = Pick<
2323
getIsEventExpanded: GetIsEventExpanded;
2424
onEventToggle: ToggleIsEventExpanded;
2525
onReset?: () => void;
26+
selected?: boolean;
2627
};

src/views/workflow-history/workflow-history.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ export default function WorkflowHistory({ params }: Props) {
422422
setResetToDecisionEventId(group.resetToDecisionEventId);
423423
}
424424
}}
425+
selected={
426+
queryParams.historySelectedEventId ===
427+
group.events[0].eventId
428+
}
425429
/>
426430
)}
427431
components={{

0 commit comments

Comments
 (0)