-
-
Notifications
You must be signed in to change notification settings - Fork 280
Expand file tree
/
Copy path_Icon.svelte
More file actions
79 lines (73 loc) · 1.91 KB
/
Copy path_Icon.svelte
File metadata and controls
79 lines (73 loc) · 1.91 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<div>
<FormField>
<Checkbox bind:checked={open} />
{#snippet label()}
Open
{/snippet}
</FormField>
<FormField>
<Checkbox bind:checked={centered} />
{#snippet label()}
Centered
{/snippet}
</FormField>
<FormField>
<Checkbox bind:checked={mobileStacked} />
{#snippet label()}
Mobile Stacked
{/snippet}
</FormField>
</div>
<pre class="status">Closed Reason: {closedReason}</pre>
<div class="top-app-bar-container">
<TopAppBar variant="static">
<Row>
<Section>
<Title>Top App Bar</Title>
</Section>
</Row>
</TopAppBar>
<Banner
bind:open
{centered}
{mobileStacked}
onSMUIBannerClosed={handleBannerClosed}
>
{#snippet icon()}
<Icon class="material-icons">favorite</Icon>
{/snippet}
{#snippet label()}
<Label>This is a banner with an icon and some actions.</Label>
{/snippet}
{#snippet actions()}
<Button secondary>Secondary</Button>
<Button>Primary</Button>
{/snippet}
</Banner>
<div>
<img
alt="Page content placeholder"
src="/page-content.jpg"
style="display: block; max-width: 100%; height: auto; margin: 1em auto;"
/>
</div>
</div>
<script lang="ts">
import Banner, { Label, Icon, CloseReason } from '@smui/banner';
import Button from '@smui/button';
import TopAppBar, { Row, Section, Title } from '@smui/top-app-bar';
import Checkbox from '@smui/checkbox';
import FormField from '@smui/form-field';
let open = $state(false);
let centered = $state(false);
let mobileStacked = $state(true);
const closedReasons = {
[CloseReason.PRIMARY]: 'Primary',
[CloseReason.SECONDARY]: 'Secondary',
[CloseReason.UNSPECIFIED]: 'Unspecified',
};
let closedReason = $state('None yet.');
function handleBannerClosed(event: CustomEvent<{ reason: CloseReason }>) {
closedReason = closedReasons[event.detail.reason];
}
</script>