-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DS implementation - Table of Contents #13156
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8c4d770
initial toc for desktop migration
pettinarip 64a8fe1
fix spacing
pettinarip 0139c84
cleanup
pettinarip ca83f2b
tweak styles from parent wrapper component
pettinarip 62970bf
remove test for active hash
pettinarip 231cf72
refactor style props
pettinarip de77206
Merge branch 'dev' into ds-toc
pettinarip 6429030
Merge branch 'dev' into ds-toc
pettinarip 0ddd3b8
use literal inset-inline-start css prop since insetInlineStart style …
pettinarip 00e8d75
Merge branch 'dev' into ds-toc
wackerow 528acdf
fix: text color
wackerow eb54287
Merge branch 'dev' into ds-toc
wackerow 8030741
chore: rm slug from ToC props in story
wackerow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/components/TableOfContents/TableOfContents.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import * as React from "react" | ||
import { Stack } from "@chakra-ui/react" | ||
import { Meta, StoryObj } from "@storybook/react" | ||
|
||
import { ToCItem, TocNodeType } from "@/lib/types" | ||
|
||
import TableOfContents from "./" | ||
|
||
const tocItems: ToCItem[] = [ | ||
{ | ||
title: "The early Web", | ||
url: "#early-internet", | ||
items: [ | ||
{ title: "Web 1.0: Read-Only (1990-2004)", url: "#web1" }, | ||
{ title: "Web 2.0: Read-Write (2004-now)", url: "#web2" }, | ||
], | ||
}, | ||
{ | ||
title: "Web 3.0: Read-Write-Own", | ||
url: "#web3", | ||
items: [ | ||
{ | ||
title: "What is Web3?", | ||
url: "#what-is-web3", | ||
items: [{ title: "Core ideas of Web3", url: "#core-ideas" }], | ||
}, | ||
{ | ||
title: "Why is Web3 important?", | ||
url: "#why-is-web3-important", | ||
items: [ | ||
{ title: "Ownership", url: "#ownership" }, | ||
{ | ||
title: "Censorship resistance", | ||
url: "#censorship-resistance", | ||
}, | ||
{ | ||
title: "Decentralized autonomous organizations (DAOs)", | ||
url: "#daos", | ||
}, | ||
], | ||
}, | ||
{ title: "Identity", url: "#identity" }, | ||
{ | ||
title: "Native payments", | ||
url: "#native-payments", | ||
items: [ | ||
{ title: "Cryptocurrency", url: "#cryptocurrency" }, | ||
{ title: "Micropayments", url: "#micropayments" }, | ||
{ title: "Tokenization", url: "#tokenization" }, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
title: "Web3 limitations", | ||
url: "#web3-limitations", | ||
items: [ | ||
{ title: "Accessibility", url: "#accessibility" }, | ||
{ title: "User experience", url: "#user-experience" }, | ||
{ title: "Education", url: "#education" }, | ||
{ | ||
title: "Centralized infrastructure", | ||
url: "#centralized-infrastructure", | ||
}, | ||
], | ||
}, | ||
{ | ||
title: "A decentralized future", | ||
url: "#decentralized-future", | ||
}, | ||
{ title: "How can I get involved", url: "#get-involved" }, | ||
{ title: "Further reading", url: "#further-reading" }, | ||
] | ||
|
||
const meta = { | ||
title: "Molecules / Navigation / TableOfContents", | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<Stack minH="100vh" position="relative"> | ||
<Story /> | ||
</Stack> | ||
), | ||
], | ||
} satisfies Meta<typeof TableOfContents> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
render: () => <TableOfContents slug="#web3" items={tocItems} maxDepth={2} />, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @pettinarip Getting an error here...
slug
is not a prop onTableOfContents
, do we need this here?