forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonView.svelte
More file actions
35 lines (29 loc) · 733 Bytes
/
ButtonView.svelte
File metadata and controls
35 lines (29 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script>
/**
* @component Button View
* @wrapper
*/
import Button from '../../components/Button.svelte';
/**
* Rounds the button
*/
export let rounded = false;
/**
* Displays the count
*/
export let count = 0;
/**
* Button text
* @slot
*/
export let text = 'You clicked';
function handleClick(event) {
count += 1;
}
</script>
<h1>Button view</h1>
<Button {rounded} on:click={handleClick}>{text}: {count}</Button>
<p>A little text to show this is a view.</p>
<p>If we need to test components in a Svelte environment, for instance to test slot behaviour,</p>
<p>then wrapping the component up in a view</p>
<p>made just for the story is the simplest way to achieve this.</p>