Skip to content

Commit

Permalink
feat: update Accordion styles, improve docs [MDS-717] (#2428)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkireev authored Oct 11, 2023
1 parent 76c5ac0 commit 591a925
Show file tree
Hide file tree
Showing 30 changed files with 458 additions and 286 deletions.
2 changes: 1 addition & 1 deletion docs/app/components/client/accordion/examples/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client'
'use client';

import React from 'react';
import Accordion from '@heathmont/moon-core-tw/lib/es/accordion/Accordion';
Expand Down
20 changes: 13 additions & 7 deletions docs/app/components/client/accordion/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Default } from "./examples/Default";
import { getExamples } from "@/app/utils/getExamples";
import { MDX } from "@/components/MDX";
import { Default } from './examples/Default';
import { getExamples } from '@/app/utils/getExamples';
import { MDX } from '@/components/MDX';

export default async function Home() {
const { client } = await getExamples()
const { client } = await getExamples();
return (
<div className="flex flex-col gap-4 text-moon-14">
<h1>Accordion</h1>
Expand All @@ -12,11 +12,17 @@ export default async function Home() {

<div className="space-y-2">
<h2>Default</h2>
<div className={'flex flex-wrap items-center justify-around p-4 gap-2 w-full bg-goku rounded-moon-s-sm'}>
<div
className={
'flex flex-wrap items-center justify-around p-4 gap-2 w-full bg-gohan rounded-moon-s-sm'
}
>
<Default />
</div>
<pre className="bg-goku rounded-moon-s-sm p-4">{client.accordion.examples.Default}</pre>
<pre className="bg-gohan rounded-moon-s-sm p-4">
{client.accordion.examples.Default}
</pre>
</div>
</div>
)
);
}
1 change: 1 addition & 0 deletions docs/app/components/server/accordion/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An accordion is a vertical stack of interactive headings used to toggle the display of further information; each item can be 'collapsed' with just a short label visible or 'expanded' to show the full content.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Accordion from '@heathmont/moon-base-tw/lib/accordion/Accordion';
import { ControlsChevronDownSmall } from '@heathmont/moon-icons-tw';

export const ContentOutsideSizes = () => (
<>
<Accordion size="sm">
<Accordion.Summary>
Size SM
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.ContentOutside>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.ContentOutside>
</Accordion>
<Accordion>
<Accordion.Summary>
Default size MD
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.ContentOutside>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.ContentOutside>
</Accordion>
<Accordion size="lg">
<Accordion.Summary>
Size LG
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.ContentOutside>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.ContentOutside>
</Accordion>
<Accordion size="xl">
<Accordion.Summary>
Size XL
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.ContentOutside>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.ContentOutside>
</Accordion>
</>
);
20 changes: 20 additions & 0 deletions docs/app/components/server/accordion/examples/Default.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Accordion from '@heathmont/moon-base-tw/lib/accordion/Accordion';
import { ControlsChevronDownSmall } from '@heathmont/moon-icons-tw';

export const Default = () => (
<Accordion>
<Accordion.Summary>
Default
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.Content>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
</Accordion.Content>
</Accordion>
);
20 changes: 20 additions & 0 deletions docs/app/components/server/accordion/examples/Disabled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Accordion from '@heathmont/moon-base-tw/lib/accordion/Accordion';
import { ControlsChevronDownSmall } from '@heathmont/moon-icons-tw';

export const Disabled = () => (
<Accordion disabled>
<Accordion.Summary>
Disabled
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.Content>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
</Accordion.Content>
</Accordion>
);
67 changes: 67 additions & 0 deletions docs/app/components/server/accordion/examples/Sizes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Accordion from '@heathmont/moon-base-tw/lib/accordion/Accordion';
import { ControlsChevronDownSmall } from '@heathmont/moon-icons-tw';

export const Sizes = () => (
<>
<Accordion size="sm">
<Accordion.Summary>
Size SM
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.Content>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.Content>
</Accordion>
<Accordion>
<Accordion.Summary>
Default size MD
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.Content>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.Content>
</Accordion>
<Accordion size="lg">
<Accordion.Summary>
Size LG
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.Content>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.Content>
</Accordion>
<Accordion size="xl">
<Accordion.Summary>
Size XL
<ControlsChevronDownSmall />
</Accordion.Summary>
<Accordion.Content>
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. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</Accordion.Content>
</Accordion>
</>
);
37 changes: 37 additions & 0 deletions docs/app/components/server/accordion/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ContentOutsideSizes } from '@/app/components/server/accordion/examples/ContentOutsideSizes';
import { Default } from '@/app/components/server/accordion/examples/Default';
import { Disabled } from '@/app/components/server/accordion/examples/Disabled';
import { Sizes } from '@/app/components/server/accordion/examples/Sizes';
import ExampleSection from '@/app/components/shared/ExampleSection';
import { getExamples } from '@/app/utils/getExamples';
import { MDX } from '@/components/MDX';

export default async function Home() {
const { server } = await getExamples();
return (
<div className="max-w-7xl flex flex-col gap-4 text-moon-14">
<h1 className="font-medium text-moon-32">Accordion</h1>
<MDX markdown={server.accordion.description} />
<ExampleSection
title="Default"
component={<Default />}
code={server.accordion.examples.Default}
/>
<ExampleSection
title="Disabled"
component={<Disabled />}
code={server.accordion.examples.Disabled}
/>
<ExampleSection
title="Sizes"
component={<Sizes />}
code={server.accordion.examples.Sizes}
/>
<ExampleSection
title="ContentOutsideSizes"
component={<ContentOutsideSizes />}
code={server.accordion.examples.ContentOutsideSizes}
/>
</div>
);
}
7 changes: 7 additions & 0 deletions docs/app/components/shared/CodePreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const CodePreview = ({ code }: { code: string }) => (
<pre className="theme-moon-dark bg-gohan text-bulma rounded-moon-s-sm p-4">
{code}
</pre>
);

export default CodePreview;
11 changes: 11 additions & 0 deletions docs/app/components/shared/ComponentPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const ComponentPreview = ({ component }: { component: JSX.Element }) => (
<div
className={
'flex flex-wrap items-center justify-around p-4 gap-2 w-full bg-gohan rounded-moon-s-sm'
}
>
{component}
</div>
);

export default ComponentPreview;
18 changes: 18 additions & 0 deletions docs/app/components/shared/ExampleSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import CodePreview from './CodePreview';
import ComponentPreview from './ComponentPreview';

type Props = {
title: string;
component: JSX.Element;
code: string;
};

const ExampleSection = async ({ title, component, code }: Props) => (
<div className="space-y-2">
<h2 className="text-moon-24 font-medium">{title}</h2>
<ComponentPreview component={component} />
<CodePreview code={code} />
</div>
);

export default ExampleSection;
Binary file not shown.
Binary file not shown.
69 changes: 39 additions & 30 deletions docs/app/components/types.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
export interface Examples {
"client": {
"accordion": {
"description": "string",
"examples": {
"Default": "string"
}
},
"button": {
"description": "string",
"examples": {
"Default": "string"
}
}
},
"server": {
"avatar": {
"description": "string",
"examples": {
"Active": "string",
"Default": "string"
}
},
"tag": {
"description": "string",
"examples": {
"Default": "string"
}
}
}
};
client: {
accordion: {
description: 'string';
examples: {
Default: 'string';
};
};
button: {
description: 'string';
examples: {
Default: 'string';
};
};
};
server: {
accordion: {
description: 'string';
examples: {
Default: 'string';
Disabled: 'string';
Sizes: 'string';
ContentOutsideSizes: 'string';
};
};
avatar: {
description: 'string';
examples: {
Active: 'string';
Default: 'string';
};
};
tag: {
description: 'string';
examples: {
Default: 'string';
};
};
};
}
Loading

0 comments on commit 591a925

Please sign in to comment.