|
1 | 1 | <script>
|
2 | 2 | import { createEventDispatcher } from 'svelte';
|
3 |
| - import refresh from '$lib/icons/refresh.svg'; |
4 |
| - import terminal from '$lib/icons/terminal.svg'; |
5 | 3 |
|
6 | 4 | /** @type {string} */
|
7 | 5 | export let path;
|
8 | 6 |
|
9 | 7 | /** @type {boolean} */
|
10 | 8 | export let loading;
|
11 | 9 |
|
| 10 | + /** @type {string | null} */ |
| 11 | + export let href; |
| 12 | +
|
12 | 13 | const dispatch = createEventDispatcher();
|
13 | 14 | </script>
|
14 | 15 |
|
15 |
| -<div class="chrome"> |
16 |
| - <button disabled={loading} on:click={() => dispatch('refresh')} aria-label="reload"> |
17 |
| - <img src={refresh} alt="Reload icon" /> |
18 |
| - </button> |
| 16 | +<div class="chrome" class:loading> |
| 17 | + <button disabled={loading} class="reload icon" on:click={() => dispatch('refresh')} aria-label="reload" /> |
19 | 18 |
|
20 | 19 | <input
|
21 | 20 | disabled={loading}
|
|
26 | 25 | }}
|
27 | 26 | />
|
28 | 27 |
|
| 28 | + <a {href} class="new-tab icon" target="_blank" aria-label="open in new tab" tabindex="0" /> |
| 29 | + |
29 | 30 | <button
|
30 | 31 | disabled={loading}
|
| 32 | + class="terminal icon" |
31 | 33 | on:click={() => dispatch('toggle_terminal')}
|
32 | 34 | aria-label="toggle terminal"
|
33 |
| - > |
34 |
| - <img src={terminal} alt="Terminal icon" /> |
35 |
| - </button> |
| 35 | + /> |
36 | 36 | </div>
|
37 | 37 |
|
38 | 38 | <style>
|
|
43 | 43 | border-top: 1px solid var(--sk-back-4);
|
44 | 44 | }
|
45 | 45 |
|
46 |
| - .chrome button { |
47 |
| - padding: 0.8rem; |
48 |
| - box-sizing: border-box; |
49 |
| - background: var(--sk-back-4); |
| 46 | + button { |
50 | 47 | user-select: none;
|
51 | 48 | }
|
52 | 49 |
|
53 |
| - .chrome button img { |
54 |
| - width: 2rem; |
55 |
| - height: 2rem; |
56 |
| - transition: 0.2s ease-out; |
57 |
| - transform: none; |
58 |
| - } |
59 |
| -
|
60 |
| - .chrome button[aria-label='reload']:active img { |
61 |
| - transform: rotate(-360deg); |
62 |
| - transition: none; |
63 |
| - } |
64 |
| -
|
65 |
| - .chrome input { |
| 50 | + input { |
66 | 51 | flex: 1;
|
67 | 52 | padding: 0.5rem 1rem 0.4rem 1rem;
|
68 | 53 | background-color: var(--sk-back-3);
|
|
71 | 56 | font-size: 1.6rem;
|
72 | 57 | }
|
73 | 58 |
|
74 |
| - .chrome button, |
75 |
| - .chrome input { |
76 |
| - border: 2px solid transparent; |
77 |
| - } |
78 |
| -
|
79 |
| - .chrome button:focus-visible, |
80 |
| - .chrome input:focus-visible { |
| 59 | + a:focus-visible, |
| 60 | + button:focus-visible, |
| 61 | + input:focus-visible { |
81 | 62 | outline: none;
|
82 | 63 | border: 2px solid var(--sk-theme-3);
|
83 | 64 | }
|
| 65 | +
|
| 66 | + .icon, .icon::after { |
| 67 | + position: relative; |
| 68 | + height: 100%; |
| 69 | + aspect-ratio: 1; |
| 70 | + background: var(--sk-back-4) no-repeat 50% 50%; |
| 71 | + background-size: 2rem; |
| 72 | + } |
| 73 | +
|
| 74 | + .loading a { |
| 75 | + opacity: 0.5; |
| 76 | + } |
| 77 | +
|
| 78 | + .new-tab { |
| 79 | + background-image: url($lib/icons/external.svg); |
| 80 | + } |
| 81 | +
|
| 82 | + .terminal { |
| 83 | + background-image: url($lib/icons/terminal.svg); |
| 84 | + } |
| 85 | +
|
| 86 | + .reload::after { |
| 87 | + content: ''; |
| 88 | + position: absolute; |
| 89 | + left: 0; |
| 90 | + top: 0; |
| 91 | + background-image: url($lib/icons/refresh.svg); |
| 92 | + transition: 0.2s ease-out; |
| 93 | + } |
| 94 | +
|
| 95 | + .reload:active::after { |
| 96 | + transform: rotate(-360deg); |
| 97 | + transition: none; |
| 98 | + } |
84 | 99 | </style>
|
0 commit comments