style app controls

pull/1890/head
Rich Harris 7 years ago
parent ef0cf3ffef
commit ed718aaf30

@ -9,30 +9,32 @@
<script>
export let clas = '';
export let name;
let size = 20;
</script>
<!-- style="--color: {color ? color : 'currentColor'}" -->
<svg class="{'icon ' + clas}">
<svg class="{'icon ' + clas}" width={size} height={size}>
<use xlink:href='#{name}' />
</svg>
<style>
:global(.icon) {
position: relative;
width: 1.2em;
height: 1.2em;
top: -0.123em;
overflow: hidden;
vertical-align: middle;
-o-object-fit: contain;
object-fit: contain;
-webkit-transform-origin: center center;
transform-origin: center center;
.icon {
position: relative;
/* width: 1.2em;
height: 1.2em;
top: -0.123em; */
overflow: hidden;
vertical-align: middle;
-o-object-fit: contain;
object-fit: contain;
-webkit-transform-origin: center center;
transform-origin: center center;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
fill: none;
}
</style>

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 822 B

@ -40,7 +40,7 @@
</symbol>
<symbol id='download' class='icon' viewBox='0 0 24 24'>
<path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' />
<path d='M21 15V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V15' />
<polyline points='7 10 12 15 17 10' />
<line x1='12' y1='15' x2='12' y2='3' />
</symbol>
@ -62,7 +62,7 @@
</symbol>
<symbol id='log-in' class='icon' viewBox='0 0 24 24'>
<path d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4' />
<path d='M15 3H19A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H15' />
<polyline points='10 17 15 12 10 7' />
<line x1='15' y1='12' x2='3' y2='12' />
</symbol>

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

@ -1,9 +1,7 @@
<script>
import { createEventDispatcher } from 'svelte';
import { enter } from '../events.js';
export let examples;
export let name;
const dispatch = createEventDispatcher();
</script>
@ -20,11 +18,6 @@
</optgroup>
{/each}
</select>
<div class='visible'>
<span class='widther'>{name}</span>
<input bind:value={name} on:focus="{e => e.target.select()}" use:enter="{e => e.target.blur()}">
</div>
</div>
<style>

@ -6,6 +6,7 @@
import * as doNotZip from 'do-not-zip';
import downloadBlob from '../../_utils/downloadBlob.js';
import { user } from '../../../../user.js';
import { enter } from '../events.js';
const dispatch = createEventDispatcher();
@ -198,22 +199,37 @@ export default app;` });
<svelte:window on:keydown={handleKeydown} />
<div class="app-controls">
<div class="icon" style="position: relative; width: 3.2rem; margin-top:-.5rem">
<Icon name="menu" />
<div>
<div class="icon" style="position: relative; width: 3.2rem; top: -.2rem">
<Icon name="menu" />
<select
class="hidden-select"
on:change="{e => dispatch('select', { slug: e.target.value })}"
>
<option value={null} disabled>Select an example</option>
{#each examples as group}
<optgroup label={group.name}>
{#each group.examples as example}
<option value={example.slug}>{example.title}</option>
{/each}
</optgroup>
{/each}
</select>
</div>
<ExampleSelector {examples} on:select />
<input
bind:value={name}
on:focus="{e => e.target.select()}"
use:enter="{e => e.target.blur()}"
>
</div>
<ExampleSelector {examples} bind:name on:select />
<div style="flex: 1 0 auto" />
<div style="text-align: right; margin-right:.8rem">
{#if $user}
<UserMenu />
{:else}
<a class="icon" on:click={login} href="auth/login" title="Login to save">
<Icon name="log-in" />
</a>
{/if}
<div style="text-align: right; margin-right:.4rem">
<button class="icon" on:click="{() => zen_mode = !zen_mode}" title="fullscreen editor">
{#if zen_mode}
<Icon name="close" />
@ -249,6 +265,15 @@ export default app;` });
<Icon name="save" />
</a>
{/if}
{#if $user}
<UserMenu />
{:else}
<button class="icon" on:click={login}>
<Icon name="log-in" />
&nbsp;Log in to save
</button>
{/if}
</div>
</div>
@ -267,10 +292,26 @@ export default app;` });
color: white;
}
.hidden-select {
position: absolute;
width: 100%;
height: 100%;
opacity: 0.0001;
top: 0;
left: 0;
}
.icon {
padding: 0 .8rem;
opacity: .5;
display: inline-block;
padding: 0.2em;
opacity: .7;
transition: opacity .3s;
font-family: var(--font-ui);
font-size: 1.3rem;
/* width: 1.6em;
height: 1.6em; */
line-height: 1;
margin: 0 0 0 0.4em;
}
.icon:hover { opacity: 1 }
@ -278,6 +319,20 @@ export default app;` });
.icon[title^='fullscreen'] { display: none }
input {
background: transparent;
border: none;
color: currentColor;
font-family: var(--font-ui);
font-size: 1.3rem;
opacity: 0.7;
outline: none;
}
input:focus {
opacity: 1;
}
@media (min-width: 768px) {
.icon[title^='fullscreen'] { display: inline }
}

Loading…
Cancel
Save