|
53 | 53 | } |
54 | 54 | </script> |
55 | 55 |
|
56 | | -{#snippet buttons()} |
57 | | - <span id="control-buttons"> |
58 | | - {#if loggedIn} |
59 | | - {#if editable} |
60 | | - <!-- Use the one button so that animations persist between states --> |
61 | | - <Button |
62 | | - onclick={editButtonClick} |
63 | | - mode={editing ? 'confirm' : 'default'} |
64 | | - > |
65 | | - {editing ? 'Finish editing' : 'Edit'} |
66 | | - </Button> |
67 | | - {/if} |
68 | | - <Button onclick={() => goto('/admin')}>Admin</Button> |
69 | | - <Button onclick={logOut}>Log out</Button> |
70 | | - {:else if loggedIn !== undefined} |
71 | | - <!-- Only include a login button if logging in is enabled --> |
72 | | - <Button onclick={gotoLogin}>Log in</Button> |
| 56 | +<span id="control-buttons"> |
| 57 | + {#if loggedIn} |
| 58 | + {#if editable} |
| 59 | + <!-- Use the one button so that animations persist between states --> |
| 60 | + <Button onclick={editButtonClick} mode={editing ? 'confirm' : 'default'}> |
| 61 | + {editing ? 'Finish editing' : 'Edit'} |
| 62 | + </Button> |
73 | 63 | {/if} |
74 | | - <!-- About button navigates to about page --> |
75 | | - <Button onclick={() => goto('/about')}>About</Button> |
76 | | - <!-- In dev mode, add a quick shortcut to delete everything --> |
77 | | - {#if dev} |
| 64 | + <Button onclick={() => goto('/admin')}>Admin</Button> |
| 65 | + <Button onclick={logOut}>Log out</Button> |
| 66 | + {:else if loggedIn !== undefined} |
| 67 | + <!-- Only include a login button if logging in is enabled --> |
| 68 | + <Button onclick={gotoLogin}>Log in</Button> |
| 69 | + {/if} |
| 70 | + <!-- About button navigates to about page --> |
| 71 | + <Button onclick={() => goto('/about')}>About</Button> |
| 72 | + <!-- In dev mode, add a quick shortcut to delete everything --> |
| 73 | + {#if dev} |
| 74 | + <div class="sep"> |
78 | 75 | <Separator /> |
79 | | - <Button onclick={clear} mode="warning">Clear data</Button> |
80 | | - {/if} |
81 | | - </span> |
82 | | -{/snippet} |
83 | | - |
84 | | -{@render buttons()} |
| 76 | + </div> |
| 77 | + <Button onclick={clear} mode="warning">Clear data</Button> |
| 78 | + {/if} |
| 79 | +</span> |
85 | 80 |
|
86 | | -<!-- TODO: Make control buttons responsive, so they change to a curtain menu on mobile devices --> |
| 81 | +<!-- TODO: Make control buttons change to a curtain menu on mobile devices --> |
87 | 82 |
|
88 | 83 | <style> |
89 | 84 | #control-buttons { |
|
94 | 89 | grid-area: control-buttons; |
95 | 90 | margin-right: 20px; |
96 | 91 | } |
| 92 | +
|
| 93 | + /* When screen is narrow, make buttons vertical and hide the separator */ |
| 94 | + @media (width < 50rem) { |
| 95 | + #control-buttons { |
| 96 | + flex-direction: column; |
| 97 | + } |
| 98 | +
|
| 99 | + .sep { |
| 100 | + display: none; |
| 101 | + } |
| 102 | + } |
97 | 103 | </style> |
0 commit comments