Skip to content

Commit

Permalink
Merge pull request #72 from etchteam/feature/etch-542-better-card-docs
Browse files Browse the repository at this point in the history
docs: better card docs
  • Loading branch information
gavmck authored Aug 8, 2024
2 parents 8b8343a + 6293cb1 commit 88f7e05
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
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.`,
},
},
};

0 comments on commit 88f7e05

Please sign in to comment.