Skip to content

Commit

Permalink
drawer wip
Browse files Browse the repository at this point in the history
```js
// Note: I do not want to have to build an entire drawer component
// just to show the playground on documentation pages. For now,
// it is much easier to just place the playground at the bottom of
// the documentation page. I will revisit this later when I have
// more time to work on it.
```
  • Loading branch information
EthanThatOneKid committed Mar 24, 2024
1 parent 3ed5cd0 commit b81905a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export interface DocProps {
export default function Doc(props: DocProps) {
return (
// TODO: Add sidenav for the documentation page.
<div
className="markdown-body"
dangerouslySetInnerHTML={{ __html: props.html }}
>
</div>
<>
<div
className="markdown-body"
dangerouslySetInnerHTML={{ __html: props.html }}
>
</div>
</>
);
}
26 changes: 26 additions & 0 deletions components/drawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { JSX } from "preact/jsx-runtime";

export interface DrawerProps {
summary: string;
children: JSX.Element[];
}

// Reference:
// https://web.dev/articles/codelab-building-a-sidenav-component

// Note: I do not want to have to build an entire drawer component
// just to show the playground on documentation pages. For now,
// it is much easier to just place the playground at the bottom of
// the documentation page. I will revisit this later when I have
// more time to work on it. TODO: Remove this comment when done.

export default function Drawer(props: DrawerProps) {
return (
<details>
<summary>
<h2>{props.summary}</h2>
</summary>
{props.children}
</details>
);
}

0 comments on commit b81905a

Please sign in to comment.