Skip to content

Commit e09e669

Browse files
committed
change stages to toggledetails
1 parent 89a28f8 commit e09e669

File tree

1 file changed

+55
-39
lines changed

1 file changed

+55
-39
lines changed

src/components/HelpTraySectionStages.tsx

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { Badge } from "@instructure/ui-badge";
22
import { Flex } from "@instructure/ui-flex";
33
import { Heading } from "@instructure/ui-heading";
44
import { Link } from "@instructure/ui-link";
5-
import { List } from "@instructure/ui-list";
65
import { Popover } from "@instructure/ui-popover";
76
import { Text } from "@instructure/ui-text";
8-
import { ToggleGroup } from "@instructure/ui-toggle-details";
7+
import { ToggleDetails, ToggleGroup } from "@instructure/ui-toggle-details";
98
import { View } from "@instructure/ui-view";
109
import type { FC } from "react";
1110
import Stages, { type Stage } from "../assets/Stages";
@@ -17,52 +16,69 @@ const HelpTraySectionStages: FC = () => {
1716
</Heading>
1817
);
1918

19+
const toggleSubHeader = (stage: Stage) => (
20+
<>
21+
<Badge
22+
margin="0 x-small xxx-small 0"
23+
standalone
24+
themeOverride={{ colorPrimary: stage.color }}
25+
type="notification"
26+
/>
27+
<Text as="dfn" size="small">
28+
{stage.name}
29+
</Text>
30+
</>
31+
);
32+
33+
const renderStageDescription = (stage: Stage) => (
34+
<View as="div" padding="0">
35+
<Popover
36+
placement="top end"
37+
renderTrigger={
38+
<Link aria-describedby={stage.name} as="abbr">
39+
{stage.abbreviation}
40+
</Link>
41+
}
42+
shouldAlignArrow
43+
shouldRenderOffscreen
44+
shouldReturnFocus={false}
45+
withArrow
46+
>
47+
<View padding="x-small">
48+
<Text id={stage.name} size="small">
49+
{stage.name}
50+
</Text>
51+
</View>
52+
</Popover>{" "}
53+
<Text size="small">{stage.description}</Text>
54+
</View>
55+
);
56+
2057
return (
2158
<Flex.Item>
2259
<ToggleGroup
60+
border={false}
2361
defaultExpanded={true}
2462
size="small"
2563
summary={toggleHeader}
2664
toggleLabel="Product development definitions"
2765
>
28-
<View as="div" padding="0 small">
29-
<List delimiter="solid" isUnstyled margin="0" size="small">
30-
{Stages.map((stage: Stage) => (
31-
<List.Item key={stage.name} padding="small 0">
32-
<Badge
33-
margin="0 x-small xxx-small 0"
34-
standalone
35-
themeOverride={{ colorPrimary: stage.color }}
36-
type="notification"
37-
/>
38-
<Text as="dfn" size="small">
39-
{stage.name}:
40-
</Text>{" "}
41-
(
42-
<Popover
43-
placement="top end"
44-
renderTrigger={
45-
<Link aria-describedby={stage.name} as="abbr">
46-
{stage.abbreviation}
47-
</Link>
48-
}
49-
shouldAlignArrow
50-
shouldRenderOffscreen
51-
shouldReturnFocus={false}
52-
withArrow
53-
>
54-
<View padding="x-small">
55-
<Text id={stage.name} size="small">
56-
{stage.name}
57-
</Text>
58-
</View>
59-
</Popover>
60-
) {stage.description}
61-
</List.Item>
62-
))}
63-
</List>
66+
<View as="div" padding="small 0">
67+
{Stages.map((stage: Stage) => (
68+
<View as="div" key={stage.name} padding="0 0 small">
69+
<ToggleDetails
70+
fluidWidth
71+
key={stage.name}
72+
size="medium"
73+
summary={toggleSubHeader(stage)}
74+
variant="filled"
75+
>
76+
{renderStageDescription(stage)}
77+
</ToggleDetails>
78+
</View>
79+
))}
6480
</View>
65-
</ToggleGroup>{" "}
81+
</ToggleGroup>
6682
</Flex.Item>
6783
);
6884
};

0 commit comments

Comments
 (0)