|
8 | 8 | {#if miniWindow} |
9 | 9 | <IconButton class="material-icons" on:click={() => drawerOpen = !drawerOpen}>menu</IconButton> |
10 | 10 | {/if} |
11 | | - <Title component={A} href="/" class="mdc-theme--primary" style="{miniWindow ? 'padding-left: 0;' : ''}"> |
| 11 | + <Title component={A} href="/" on:click={() => activeSection = null} class="mdc-theme--primary" style="{miniWindow ? 'padding-left: 0;' : ''}"> |
12 | 12 | Svelte Material UI |
13 | 13 | </Title> |
14 | 14 | </Section> |
15 | 15 | <Section align="end" toolbar> |
| 16 | + {#each repos as repo} |
| 17 | + <IconButton href={repo} title={`View Component: ${repo.split('/').slice(-1)[0]}`}> |
| 18 | + <Icon> |
| 19 | + <svg style="width:24px;height:24px" viewBox="0 0 24 24"> |
| 20 | + <path fill="#000000" d="{mdiFileDocument}" /> |
| 21 | + </svg> |
| 22 | + </Icon> |
| 23 | + </IconButton> |
| 24 | + {/each} |
| 25 | + {#if activeSection} |
| 26 | + <IconButton href={`https://github.com/hperrin/svelte-material-ui/blob/master/site/src/routes${activeSection.route}.svelte`} title={`View Demo Code: ${activeSection.route.split('/').slice(-1)[0]}`}> |
| 27 | + <Icon> |
| 28 | + <svg style="width:24px;height:24px" viewBox="0 0 24 24"> |
| 29 | + <path fill="#000000" d="{mdiCodeTags}" /> |
| 30 | + </svg> |
| 31 | + </Icon> |
| 32 | + </IconButton> |
| 33 | + {/if} |
16 | 34 | <IconButton href="https://twitter.com/SciActive"> |
17 | 35 | <Icon> |
18 | 36 | <svg style="width:24px;height:24px" viewBox="0 0 24 24"> |
|
64 | 82 | <script> |
65 | 83 | import {onMount} from 'svelte'; |
66 | 84 | import {stores} from '@sapper/app'; |
67 | | - import {mdiTwitter, mdiGithubCircle} from '@mdi/js'; |
| 85 | + import {mdiFileDocument, mdiCodeTags, mdiTwitter, mdiGithubCircle} from '@mdi/js'; |
68 | 86 |
|
69 | 87 | import './_app.scss'; |
70 | 88 |
|
|
87 | 105 | { |
88 | 106 | name: 'Buttons', |
89 | 107 | route: '/demo/button', |
90 | | - indent: 0 |
| 108 | + indent: 0, |
| 109 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/button'] |
91 | 110 | }, |
92 | 111 | { |
93 | 112 | name: 'Floating Action Button', |
94 | 113 | route: '/demo/fab', |
95 | | - indent: 1 |
| 114 | + indent: 1, |
| 115 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/fab'] |
96 | 116 | }, |
97 | 117 | { |
98 | 118 | name: 'Icon Buttons', |
99 | 119 | route: '/demo/icon-button', |
100 | | - indent: 1 |
| 120 | + indent: 1, |
| 121 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/icon-button'] |
101 | 122 | }, |
102 | 123 | { |
103 | 124 | name: 'Cards', |
104 | 125 | route: '/demo/card', |
105 | | - indent: 0 |
| 126 | + indent: 0, |
| 127 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/card'] |
106 | 128 | }, |
107 | 129 | { |
108 | 130 | name: 'Chips', |
109 | 131 | route: '/demo/chips', |
110 | | - indent: 0 |
| 132 | + indent: 0, |
| 133 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/chips'] |
111 | 134 | }, |
112 | 135 | { |
113 | 136 | name: 'Data Tables', |
114 | 137 | route: '/demo/data-table', |
115 | | - indent: 0 |
| 138 | + indent: 0, |
| 139 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/data-table'] |
116 | 140 | }, |
117 | 141 | { |
118 | 142 | name: 'Dialogs', |
119 | 143 | route: '/demo/dialog', |
120 | | - indent: 0 |
| 144 | + indent: 0, |
| 145 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/dialog'] |
121 | 146 | }, |
122 | 147 | { |
123 | 148 | name: 'Drawers', |
124 | 149 | route: '/demo/drawer', |
125 | | - indent: 0 |
| 150 | + indent: 0, |
| 151 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/drawer'] |
126 | 152 | }, |
127 | 153 | { |
128 | 154 | name: 'Elevation', |
|
132 | 158 | { |
133 | 159 | name: 'Image List', |
134 | 160 | route: '/demo/image-list', |
135 | | - indent: 0 |
| 161 | + indent: 0, |
| 162 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/image-list'] |
136 | 163 | }, |
137 | 164 | { |
138 | 165 | name: 'Inputs and Controls', |
|
142 | 169 | { |
143 | 170 | name: 'Checkboxes', |
144 | 171 | route: '/demo/checkbox', |
145 | | - indent: 1 |
| 172 | + indent: 1, |
| 173 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/checkbox'] |
146 | 174 | }, |
147 | 175 | { |
148 | 176 | name: 'Floating Label', |
|
167 | 195 | { |
168 | 196 | name: 'Radio Buttons', |
169 | 197 | route: '/demo/radio', |
170 | | - indent: 1 |
| 198 | + indent: 1, |
| 199 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/radio'] |
171 | 200 | }, |
172 | 201 | { |
173 | 202 | name: 'Select Menus', |
174 | 203 | route: '/demo/select', |
175 | | - indent: 1 |
| 204 | + indent: 1, |
| 205 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/select'] |
176 | 206 | }, |
177 | 207 | { |
178 | 208 | name: 'Select Helper Text', |
|
187 | 217 | { |
188 | 218 | name: 'Sliders', |
189 | 219 | route: '/demo/slider', |
190 | | - indent: 1 |
| 220 | + indent: 1, |
| 221 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/slider'] |
191 | 222 | }, |
192 | 223 | { |
193 | 224 | name: 'Switches', |
194 | 225 | route: '/demo/switch', |
195 | | - indent: 1 |
| 226 | + indent: 1, |
| 227 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/switch'] |
196 | 228 | }, |
197 | 229 | { |
198 | 230 | name: 'Text Field', |
199 | 231 | route: '/demo/textfield', |
200 | | - indent: 1 |
| 232 | + indent: 1, |
| 233 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/textfield'] |
201 | 234 | }, |
202 | 235 | { |
203 | 236 | name: 'Text Field Character Count', |
|
217 | 250 | { |
218 | 251 | name: 'Linear Progress', |
219 | 252 | route: '/demo/linear-progress', |
220 | | - indent: 0 |
| 253 | + indent: 0, |
| 254 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/linear-progress'] |
221 | 255 | }, |
222 | 256 | { |
223 | 257 | name: 'Lists', |
224 | 258 | route: '/demo/list', |
225 | | - indent: 0 |
| 259 | + indent: 0, |
| 260 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/list'] |
226 | 261 | }, |
227 | 262 | { |
228 | 263 | name: 'Menu Surface', |
229 | 264 | route: '/demo/menu-surface', |
230 | | - indent: 0 |
| 265 | + indent: 0, |
| 266 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/menu-surface'] |
231 | 267 | }, |
232 | 268 | { |
233 | 269 | name: 'Menus', |
234 | 270 | route: '/demo/menu', |
235 | | - indent: 0 |
| 271 | + indent: 0, |
| 272 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/menu'] |
236 | 273 | }, |
237 | 274 | { |
238 | 275 | name: 'Paper', |
239 | 276 | route: '/demo/paper', |
240 | | - indent: 0 |
| 277 | + indent: 0, |
| 278 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/paper'] |
241 | 279 | }, |
242 | 280 | { |
243 | 281 | name: 'Ripples', |
244 | 282 | route: '/demo/ripple', |
245 | | - indent: 0 |
| 283 | + indent: 0, |
| 284 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/ripple'] |
246 | 285 | }, |
247 | 286 | { |
248 | 287 | name: 'Snackbars', |
249 | 288 | route: '/demo/snackbars', |
250 | | - indent: 0 |
| 289 | + indent: 0, |
| 290 | + repos: [ |
| 291 | + 'https://github.com/hperrin/svelte-material-ui/tree/master/packages/snackbar', |
| 292 | + 'https://github.com/hperrin/svelte-material-ui/tree/master/packages/snackbar/kitchen' |
| 293 | + ] |
251 | 294 | }, |
252 | 295 | { |
253 | 296 | name: 'Tabs', |
254 | 297 | route: '/demo/tabs', |
255 | | - indent: 0 |
| 298 | + indent: 0, |
| 299 | + repos: [ |
| 300 | + 'https://github.com/hperrin/svelte-material-ui/tree/master/packages/tab', |
| 301 | + 'https://github.com/hperrin/svelte-material-ui/tree/master/packages/tab-bar', |
| 302 | + 'https://github.com/hperrin/svelte-material-ui/tree/master/packages/tab-indicator', |
| 303 | + 'https://github.com/hperrin/svelte-material-ui/tree/master/packages/tab-scroller' |
| 304 | + ] |
256 | 305 | }, |
257 | 306 | { |
258 | 307 | name: 'Tab', |
|
282 | 331 | { |
283 | 332 | name: 'Top App Bar', |
284 | 333 | route: '/demo/top-app-bar', |
285 | | - indent: 0 |
| 334 | + indent: 0, |
| 335 | + repos: ['https://github.com/hperrin/svelte-material-ui/tree/master/packages/top-app-bar'] |
286 | 336 | }, |
287 | 337 | { |
288 | 338 | name: 'Typography', |
|
291 | 341 | } |
292 | 342 | ]; |
293 | 343 |
|
| 344 | + let activeSection = sections.find(section => 'route' in section && section.route === $page.path); |
| 345 | + $: repos = (activeSection && 'repos' in activeSection) ? activeSection.repos : []; |
| 346 | +
|
294 | 347 | onMount(setMiniWindow); |
295 | 348 |
|
296 | 349 | function pickSection(section) { |
|
300 | 353 | // Svelte/Sapper is not updated the components correctly, so I need this. |
301 | 354 | sections.forEach(section => section.component.$set({activated: false})); |
302 | 355 | section.component.$set({activated: true}); |
| 356 | +
|
| 357 | + activeSection = 'shortcut' in section ? sections.find(sec => sec.route === section.shortcut) : section; |
303 | 358 | } |
304 | 359 |
|
305 | 360 | function setMiniWindow() { |
|
0 commit comments