-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docs): dx improvement in accordion (#3856)
* refactor: improve dx for writing a docs component (#2544) * refactor: improve dx for write a docs component Signed-off-by: Innei <[email protected]> * refactor(docs): switch to contentlayer2 * chore(docs): rename to avoid conflict * refactor(docs): switch to next-contentlayer2 * refactor(docs): revise docs lib * chore(deps): bump docs related dependencies * fix(use-aria-multiselect): type issue due to ts version bump --------- Signed-off-by: Innei <[email protected]> Co-authored-by: WK Wong <[email protected]> * refactor(docs): accordion codes * feat(docs): declare module `*.jsx?raw` * feat(docs): include `**/*.jsx` * fix(docs): incorrect content * chore(docs): add new lines * refactor(docs): lint --------- Signed-off-by: Innei <[email protected]> Co-authored-by: Innei <[email protected]>
- Loading branch information
Showing
53 changed files
with
2,390 additions
and
1,868 deletions.
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
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
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
20 changes: 20 additions & 0 deletions
20
apps/docs/content/components/accordion/bordered-variant.raw.jsx
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,20 @@ | ||
import {Accordion, AccordionItem} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
const defaultContent = | ||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; | ||
|
||
return ( | ||
<Accordion variant="bordered"> | ||
<AccordionItem key="1" aria-label="Accordion 1" title="Accordion 1"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="2" aria-label="Accordion 2" title="Accordion 2"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="3" aria-label="Accordion 3" title="Accordion 3"> | ||
{defaultContent} | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {Accordion, AccordionItem} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
const defaultContent = | ||
"Lorem Innei ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; | ||
|
||
return ( | ||
<Accordion isCompact> | ||
<AccordionItem key="1" aria-label="Accordion 1" title="Accordion 1"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="2" aria-label="Accordion 2" title="Accordion 2"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="3" aria-label="Accordion 3" title="Accordion 3"> | ||
{defaultContent} | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react"; | ||
import {Accordion, AccordionItem} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
const [selectedKeys, setSelectedKeys] = React.useState(new Set(["1"])); | ||
const defaultContent = | ||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; | ||
|
||
return ( | ||
<Accordion selectedKeys={selectedKeys} onSelectionChange={setSelectedKeys}> | ||
<AccordionItem key="1" aria-label="Accordion 1" title="Accordion 1"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="2" aria-label="Accordion 2" title="Accordion 2"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="3" aria-label="Accordion 3" title="Accordion 3"> | ||
{defaultContent} | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
} |
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,24 @@ | ||
import type {Selection} from "@nextui-org/react"; | ||
|
||
import React from "react"; | ||
import {Accordion, AccordionItem} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
const [selectedKeys, setSelectedKeys] = React.useState<Selection>(new Set(["1"])); | ||
const defaultContent = | ||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; | ||
|
||
return ( | ||
<Accordion selectedKeys={selectedKeys} onSelectionChange={setSelectedKeys}> | ||
<AccordionItem key="1" aria-label="Accordion 1" title="Accordion 1"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="2" aria-label="Accordion 2" title="Accordion 2"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="3" aria-label="Accordion 3" title="Accordion 3"> | ||
{defaultContent} | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
} |
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
59 changes: 59 additions & 0 deletions
59
apps/docs/content/components/accordion/custom-motion.raw.jsx
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,59 @@ | ||
import {Accordion, AccordionItem} from "@nextui-org/react"; | ||
|
||
export default function App() { | ||
const defaultContent = | ||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; | ||
|
||
return ( | ||
<Accordion | ||
motionProps={{ | ||
variants: { | ||
enter: { | ||
y: 0, | ||
opacity: 1, | ||
height: "auto", | ||
overflowY: "unset", | ||
transition: { | ||
height: { | ||
type: "spring", | ||
stiffness: 500, | ||
damping: 30, | ||
duration: 1, | ||
}, | ||
opacity: { | ||
easings: "ease", | ||
duration: 1, | ||
}, | ||
}, | ||
}, | ||
exit: { | ||
y: -10, | ||
opacity: 0, | ||
height: 0, | ||
overflowY: "hidden", | ||
transition: { | ||
height: { | ||
easings: "ease", | ||
duration: 0.25, | ||
}, | ||
opacity: { | ||
easings: "ease", | ||
duration: 0.3, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}} | ||
> | ||
<AccordionItem key="1" aria-label="Accordion 1" title="Accordion 1"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="2" aria-label="Accordion 2" title="Accordion 2"> | ||
{defaultContent} | ||
</AccordionItem> | ||
<AccordionItem key="3" aria-label="Accordion 3" title="Accordion 3"> | ||
{defaultContent} | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
} |
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.