forked from KatChaotic/sveltedoc-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathButton.svelte
46 lines (40 loc) · 1.04 KB
/
Button.svelte
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
36
37
38
39
40
41
42
43
44
45
46
<script>
/**
* The simple component button.
*
* @component Button
* @example
* <Button text="Click there!" on:click={() => ...} />
*/
/**
* The text content of the button.
* @type {string}
*/
export let text = '';
/**
* The style type of the button.
* @type {'default'|'primary'|'danger'|'success'}
*/
export let type = 'default';
/**
* The size of the button.
* @type {'small'|'normal'|'big'}
*/
export let size = 'normal';
/**
* Additional options for the button.
* @type {{ rtl: boolean, lang: string }}
*/
export let options = { rtl: false, lang: 'en-us' };
/**
* Computes the answer to your question.
* @param {string} [question=Why?] a question about life, the universe, everything
* @returns {number} the answer to all your questions
*/
export function computeAnswer(question) {
return question.indexOf('?') >= 0 ? 42 : 23;
};
</script>
<button type="button" on:click>
{text}
</button>