Skip to content

Commit

Permalink
chore: add playroom snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Jan 20, 2025
1 parent 22289cf commit 956ef68
Show file tree
Hide file tree
Showing 13 changed files with 1,393 additions and 40 deletions.
2 changes: 1 addition & 1 deletion packages/orbit-components/playroom.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
components: require.resolve("./playroomComponents.tsx"),
outputPath: "./.playroom/playroom",
frameComponent: "./playroom/FrameComponent.tsx",
snippets: "./playroom/snippets.ts",
snippets: "./playroom/snippets/index.ts",
scope: "./playroom/scope.ts",
port: 9000,
openBrowser: false,
Expand Down
39 changes: 0 additions & 39 deletions packages/orbit-components/playroom/snippets.ts

This file was deleted.

56 changes: 56 additions & 0 deletions packages/orbit-components/playroom/snippets/Accordion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const utils = `const [expandedSection, setExpandedSection] = React.useState("accordion-section-0");`;

const code = `
<>
{/* For the example to work as expected, you should also import the Accordion Utils before the return. */}
<Accordion expandedSection={expandedSection} onExpand={id => setExpandedSection(String(id))}>
<AccordionSection
id="accordion-section-0"
header={
<Stack spacing="300">
<Text type="primary">This is a header label</Text>
<Text size="small">This is a header label</Text>
</Stack>
}
>
<Text type="primary">This is a content text</Text>
</AccordionSection>
<AccordionSection
id="accordion-section-1"
header={
<Stack spacing="300">
<Text type="primary">This is a header label</Text>
<Text size="small">This is a header label</Text>
</Stack>
}
>
<Text type="primary">This is a content text</Text>
</AccordionSection>
<AccordionSection
id="accordion-section-2"
header={
<Stack spacing="300">
<Text type="primary">This is a header label</Text>
<Text size="small">This is a header label</Text>
</Stack>
}
>
<Text type="primary">This is a content text</Text>
</AccordionSection>
</Accordion>
</>
`;

export default [
{
group: "Accordion",
name: "Basic Accordion",
code,
},
{
group: "Accordion",
name: "Utils",
code: utils,
},
];
Loading

0 comments on commit 956ef68

Please sign in to comment.