-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for the Gap utility class
- Loading branch information
1 parent
38cc30f
commit c69d6c7
Showing
4 changed files
with
75 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{/* @license CC0-1.0 */} | ||
|
||
import { Controls, Markdown, Meta, Primary } from "@storybook/blocks"; | ||
import * as GapStories from "./Gap.stories.tsx"; | ||
import README from "../../../../packages/css/src/components/gap/README.md?raw"; | ||
|
||
<Meta of={GapStories} /> | ||
|
||
<Markdown>{README}</Markdown> | ||
|
||
<Primary /> | ||
|
||
<Controls /> |
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,46 @@ | ||
/** | ||
* @license EUPL-1.2+ | ||
* Copyright Gemeente Amsterdam | ||
*/ | ||
|
||
import { Meta, StoryObj } from '@storybook/react' | ||
import type { HTMLAttributes } from 'react' | ||
|
||
type GapProps = { | ||
length: (typeof lengthOptions)[number] | ||
} & HTMLAttributes<HTMLElement> | ||
|
||
const lengthOptions = ['xs', 'sm', 'md', 'lg', 'xl'] as const | ||
|
||
const Gap = ({ children, length }: GapProps) => <span className={`ams-gap--${length}`}>{children}</span> | ||
|
||
const render = ({ length }: GapProps) => ( | ||
<div className={`ams-gap--${length}`}> | ||
<p className="ams-paragraph">These paragraphs are separated by a gap.</p> | ||
<p className="ams-paragraph">These paragraphs are separated by a gap.</p> | ||
<p className="ams-paragraph">These paragraphs are separated by a gap.</p> | ||
</div> | ||
) | ||
|
||
const meta = { | ||
title: 'Utilities/CSS/Gap', | ||
component: Gap, | ||
args: { | ||
length: 'xs', | ||
}, | ||
argTypes: { | ||
length: { | ||
control: 'radio', | ||
description: 'The amount of white space to add between the children.', | ||
options: ['xs', 'sm', 'md', 'lg', 'xl'], | ||
}, | ||
}, | ||
} satisfies Meta<typeof Gap> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
render, | ||
} |