Skip to content

Commit

Permalink
docs: better card docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl-J-M committed Jul 10, 2024
1 parent e21927a commit 6852fc5
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
70 changes: 70 additions & 0 deletions components/canvas/Card/About.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Meta, Title, Primary, Controls, Stories } from '@storybook/blocks';
import * as CardStories from './Card.stories';


<Meta of={CardStories}/>


## Quickstart guide

The Card component is a simple wrapper, with a single slot for presenting content.

```html
<diamond-card>
<slot>
</diamond-card>
```

## Interactive

The interactive `diamond-card` is a regular `diamond-card` element with a wrapper as shown in the examples below. Interactive cards are keyboard focusable, and have an associated action when triggered.

We have two types of interactive card, either wrap the `diamond-card` element with an `a` or an `button` tag.

### Anchor
<a href="https://etch.co" rel="noopener noreferrer" target="_blank">
<diamond-card border>
<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-card>
</a>

```html
<a href="https://etch.co" rel="noopener noreferrer" target="_blank">
<diamond-card border>
<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-card>
</a>
```

### Button

<button type="button">
<diamond-card border>
<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-card>
</button>

```html
<button type="button">
<diamond-card border>
<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-card>
</button>
```

4 changes: 4 additions & 0 deletions components/canvas/Card/Card.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { html } from 'lit';
import '../../composition/Grid/Grid';
import '../../composition/Grid/GridItem';
import './Card';
import Guide from './About.mdx';

export default {
component: 'diamond-card',
Expand All @@ -30,6 +31,9 @@ export default {
'none',
],
},
docs: {
page: Guide,
},
},
};

Expand Down

0 comments on commit 6852fc5

Please sign in to comment.