|
1 | 1 | <svelte:window on:resize={setMiniWindow} />
|
2 | 2 |
|
3 | 3 | <svelte:head>
|
4 |
| - {#if lightTheme === true} |
| 4 | + <!-- SMUI Styles --> |
| 5 | + <link rel="stylesheet" href="{assets}/smui.css" /> |
| 6 | + |
| 7 | + <!-- Site Styles --> |
| 8 | + <link rel="stylesheet" href="{assets}/site.css" /> |
| 9 | + |
| 10 | + {#if fixationTheme} |
5 | 11 | <!-- SMUI Styles -->
|
6 |
| - <link rel="stylesheet" href="{assets}/smui.css" /> |
| 12 | + <link rel="stylesheet" href="{assets}/smui-fixation.css" /> |
7 | 13 |
|
8 | 14 | <!-- Site Styles -->
|
9 |
| - <link rel="stylesheet" href="{assets}/site.css" /> |
| 15 | + <link rel="stylesheet" href="{assets}/site-fixation.css" /> |
| 16 | + |
| 17 | + {#if lightTheme === false} |
| 18 | + <!-- SMUI Styles --> |
| 19 | + <link rel="stylesheet" href="{assets}/smui-fixation.css" /> |
| 20 | + <link |
| 21 | + rel="stylesheet" |
| 22 | + href="{assets}/smui-fixation-dark.css" |
| 23 | + media="screen" |
| 24 | + /> |
| 25 | + <!-- Site Styles --> |
| 26 | + <link rel="stylesheet" href="{assets}/site-fixation.css" /> |
| 27 | + <link |
| 28 | + rel="stylesheet" |
| 29 | + href="{assets}/site-fixation-dark.css" |
| 30 | + media="screen" |
| 31 | + /> |
| 32 | + {:else if lightTheme !== true} |
| 33 | + <!-- SMUI Styles --> |
| 34 | + <link |
| 35 | + rel="stylesheet" |
| 36 | + href="{assets}/smui-fixation-dark.css" |
| 37 | + media="screen and (prefers-color-scheme: dark)" |
| 38 | + /> |
| 39 | + |
| 40 | + <!-- Site Styles --> |
| 41 | + <link |
| 42 | + rel="stylesheet" |
| 43 | + href="{assets}/site-fixation-dark.css" |
| 44 | + media="screen and (prefers-color-scheme: dark)" |
| 45 | + /> |
| 46 | + {/if} |
10 | 47 | {:else if lightTheme === false}
|
11 | 48 | <!-- SMUI Styles -->
|
12 |
| - <link rel="stylesheet" href="{assets}/smui.css" /> |
13 | 49 | <link rel="stylesheet" href="{assets}/smui-dark.css" media="screen" />
|
14 | 50 |
|
15 | 51 | <!-- Site Styles -->
|
16 |
| - <link rel="stylesheet" href="{assets}/site.css" /> |
17 | 52 | <link rel="stylesheet" href="{assets}/site-dark.css" media="screen" />
|
18 |
| - {:else} |
| 53 | + {:else if lightTheme !== true} |
19 | 54 | <!-- SMUI Styles -->
|
20 |
| - <link |
21 |
| - rel="stylesheet" |
22 |
| - href="{assets}/smui.css" |
23 |
| - media="(prefers-color-scheme: light)" |
24 |
| - /> |
25 | 55 | <link
|
26 | 56 | rel="stylesheet"
|
27 | 57 | href="{assets}/smui-dark.css"
|
28 | 58 | media="screen and (prefers-color-scheme: dark)"
|
29 | 59 | />
|
30 | 60 |
|
31 | 61 | <!-- Site Styles -->
|
32 |
| - <link |
33 |
| - rel="stylesheet" |
34 |
| - href="{assets}/site.css" |
35 |
| - media="(prefers-color-scheme: light)" |
36 |
| - /> |
37 | 62 | <link
|
38 | 63 | rel="stylesheet"
|
39 | 64 | href="{assets}/site-dark.css"
|
|
66 | 91 | tag="a"
|
67 | 92 | href="/"
|
68 | 93 | on:click={() => (activeSection = undefined)}
|
69 |
| - class="mdc-theme--primary" |
| 94 | + class="mdc-theme--on-surface" |
70 | 95 | style={miniWindow ? 'padding-left: 0;' : ''}
|
71 | 96 | >
|
72 | 97 | {miniWindow ? 'SMUI' : 'Svelte Material UI'}
|
73 | 98 | </Title>
|
74 | 99 | </Section>
|
75 | 100 | <Section align="end" toolbar style="color: var(--mdc-on-surface, #000);">
|
76 |
| - {#if activeSection} |
77 |
| - {#each activeSection.repos || [] as repo} |
78 |
| - <Wrapper> |
79 |
| - <IconButton href={repo} target="_blank"> |
80 |
| - <Icon component={Svg} viewBox="0 0 24 24"> |
81 |
| - <path fill="currentColor" d={mdiFileDocument} /> |
82 |
| - </Icon> |
83 |
| - </IconButton> |
84 |
| - <Tooltip>View Docs: {repo.split('/').slice(-1)[0]}</Tooltip> |
85 |
| - </Wrapper> |
86 |
| - {/each} |
87 |
| - {/if} |
| 101 | + {#each (activeSection && activeSection.repos) || [] as repo} |
| 102 | + <Wrapper> |
| 103 | + <IconButton href={repo} target="_blank"> |
| 104 | + <Icon component={Svg} viewBox="0 0 24 24"> |
| 105 | + <path fill="currentColor" d={mdiFileDocument} /> |
| 106 | + </Icon> |
| 107 | + </IconButton> |
| 108 | + <Tooltip>View Docs: {repo.split('/').slice(-1)[0]}</Tooltip> |
| 109 | + </Wrapper> |
| 110 | + {:else} |
| 111 | + <Wrapper> |
| 112 | + <IconButton href="https://github.com/hperrin/svelte-material-ui"> |
| 113 | + <Icon component={Svg} viewBox="0 0 24 24"> |
| 114 | + <path fill="currentColor" d={siGithub.path} /> |
| 115 | + </Icon> |
| 116 | + </IconButton> |
| 117 | + <Tooltip>SMUI on GitHub</Tooltip> |
| 118 | + </Wrapper> |
| 119 | + {/each} |
88 | 120 | <Wrapper>
|
89 | 121 | <IconButton href="https://discord.gg/aFzmkrmg9P">
|
90 | 122 | <Icon component={Svg} viewBox="0 0 24 24">
|
|
102 | 134 | <Tooltip>Hunter Perrin (SMUI Author) on Mastodon</Tooltip>
|
103 | 135 | </Wrapper>
|
104 | 136 | <Wrapper>
|
105 |
| - <IconButton href="https://github.com/hperrin/svelte-material-ui"> |
| 137 | + <IconButton |
| 138 | + toggle |
| 139 | + pressed={fixationTheme} |
| 140 | + on:SMUIIconButtonToggle:change={() => |
| 141 | + (fixationTheme = !fixationTheme)} |
| 142 | + > |
| 143 | + <Icon component={Svg} viewBox="0 0 24 24" on> |
| 144 | + <path fill="currentColor" d={siSvelte.path} /> |
| 145 | + </Icon> |
106 | 146 | <Icon component={Svg} viewBox="0 0 24 24">
|
107 |
| - <path fill="currentColor" d={siGithub.path} /> |
| 147 | + <path fill="currentColor" d={mdiFormatPaint} /> |
108 | 148 | </Icon>
|
109 | 149 | </IconButton>
|
110 |
| - <Tooltip>SMUI on GitHub</Tooltip> |
| 150 | + <Tooltip |
| 151 | + >{fixationTheme |
| 152 | + ? 'Go back to the Svelte theme' |
| 153 | + : 'Check out a custom theme'}</Tooltip |
| 154 | + > |
111 | 155 | </Wrapper>
|
112 | 156 | <Wrapper>
|
113 | 157 | <IconButton
|
|
177 | 221 |
|
178 | 222 | <script lang="ts">
|
179 | 223 | import { onDestroy, onMount } from 'svelte';
|
180 |
| - import { mdiFileDocument, mdiWeatherSunny, mdiWeatherNight } from '@mdi/js'; |
181 |
| - import { siDiscord, siMastodon, siGithub } from 'simple-icons'; |
| 224 | + import { |
| 225 | + mdiFileDocument, |
| 226 | + mdiFormatPaint, |
| 227 | + mdiWeatherSunny, |
| 228 | + mdiWeatherNight, |
| 229 | + } from '@mdi/js'; |
| 230 | + import { siDiscord, siMastodon, siGithub, siSvelte } from 'simple-icons'; |
182 | 231 | import TinyGesture from 'tinygesture';
|
183 | 232 | import { assets } from '$app/paths';
|
184 | 233 | import { page } from '$app/stores';
|
|
200 | 249 | let mainContentGesture: TinyGesture;
|
201 | 250 |
|
202 | 251 | let lightTheme: boolean;
|
| 252 | + let fixationTheme = false; |
203 | 253 |
|
204 | 254 | type DemoSection = {
|
205 | 255 | component?: InstanceType<typeof Item>;
|
|
0 commit comments