Skip to content

Commit 37a7536

Browse files
committed
docs: updated Used By/Requires SassDoc to be collapsible
1 parent 0abe05e commit 37a7536

File tree

3 files changed

+44
-11
lines changed

3 files changed

+44
-11
lines changed

packages/documentation/src/components/PackageSassDoc/Parameters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Parameters: FC<ParametersProps> = ({ parameters }) => {
2626

2727
return (
2828
<TableContainer>
29-
<Table>
29+
<Table disableHover>
3030
<caption className={styles.caption}>Parameters</caption>
3131
<TableHeader>
3232
<TableRow>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@import '~@react-md/icon/dist/mixins';
2+
3+
.container {
4+
align-items: center;
5+
display: flex;
6+
}
7+
8+
// this should only happen when the previous `ReferenceLinkSection` is collapsed
9+
.container + .container {
10+
margin-top: 1rem;
11+
}
12+
13+
.chevron {
14+
@include rmd-icon-theme-update-var(rotate-from, rotate(90deg));
15+
@include rmd-icon-theme-update-var(rotate-to, rotate(270deg));
16+
}
Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,49 @@
1-
import React, { FC } from "react";
1+
import React, { ReactElement, ReactNode, useState } from "react";
2+
import { Button } from "@react-md/button";
3+
import { IconRotator } from "@react-md/icon";
4+
import { ChevronLeftSVGIcon } from "@react-md/material-icons";
5+
import { Collapse } from "@react-md/transition";
26
import { Text } from "@react-md/typography";
37

48
import { ItemReferenceLink } from "utils/sassdoc";
59

610
import ReferenceLinkList from "./ReferenceLinkList";
11+
import styles from "./ReferenceLinkSection.module.scss";
712

813
export interface ReferenceLinkSectionProps {
914
links: ItemReferenceLink[] | undefined;
15+
children: ReactNode;
1016
}
1117

12-
const ReferenceLinkSection: FC<ReferenceLinkSectionProps> = ({
18+
export default function ReferenceLinkSection({
1319
children,
1420
links,
15-
}) => {
21+
}: ReferenceLinkSectionProps): ReactElement | null {
22+
const [collapsed, setCollapsed] = useState(true);
1623
if (!links || !links.length) {
1724
return null;
1825
}
1926

2027
return (
2128
<>
22-
<Text type="headline-6" margin="top">
29+
<Text type="headline-6" margin="top" className={styles.container}>
2330
{children}
31+
<Button
32+
aria-label="Expand"
33+
aria-pressed={!collapsed}
34+
onClick={() => setCollapsed((p) => !p)}
35+
buttonType="icon"
36+
>
37+
<IconRotator rotated={!collapsed}>
38+
<ChevronLeftSVGIcon className={styles.chevron} />
39+
</IconRotator>
40+
</Button>
2441
</Text>
25-
<ul>
26-
<ReferenceLinkList links={links} />
27-
</ul>
42+
<Collapse collapsed={collapsed}>
43+
<ul>
44+
<ReferenceLinkList links={links} />
45+
</ul>
46+
</Collapse>
2847
</>
2948
);
30-
};
31-
32-
export default ReferenceLinkSection;
49+
}

0 commit comments

Comments
 (0)