Skip to content
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

docs: better card docs #72

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .storybook/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.docblock-argstable-body label {
min-height: auto;
}

docs-placeholder {
border: dotted 1px var(--diamond-theme-border-color-hover);
border-radius: var(--diamond-radius-sm);
display: block;
padding: var(--diamond-spacing-lg);
text-align: center;
}
56 changes: 51 additions & 5 deletions components/canvas/Card/Card.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ export const Card: StoryObj = {
padding="${padding}"
class="diamond-theme-${theme}"
>
<h3>Card title</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</p>
<docs-placeholder>
<h2>Placeholder content</h2>
<p>
The slot can contain anything, the card component acts as a simple
wrapper with optional props for styling the card itself.
</p>
</docs-placeholder>
</diamond-card>
`,
};
Expand Down Expand Up @@ -89,3 +91,47 @@ export const Interactive: StoryObj = {
</diamond-grid>
`,
};

Interactive.parameters = {
docs: {
description: {
story: `The card can be made interactive by wrapping the card in an anchor or button element.
`,
},
},
};

export const ImageCard: StoryObj = {
render: () => html`
<diamond-wrap size="sm">
<diamond-card border radius shadow class="diamond-theme-light">
<diamond-img block responsive>
<img
src="https://placehold.co/400x300"
alt="Placeholder"
width="400"
height="300"
class="diamond-spacing-bottom-md"
/>
</diamond-img>
<h3>Card title</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>

<diamond-button variant="primary" size="sm" width="full-width">
<button type="button">Button</button>
</diamond-button>
</diamond-card>
</diamond-wrap>
`,
};

ImageCard.parameters = {
docs: {
description: {
story: `As a flexible canvas element, the card can be used for any number of layouts. For example, a simple image card.`,
},
},
};