2018-02-28 07:18:07 +00:00
|
|
|
{{#if delegateKey}}
|
2018-01-28 20:51:48 +00:00
|
|
|
<button type="button"
|
|
|
|
aria-label="{{label}}"
|
2018-02-28 07:18:07 +00:00
|
|
|
aria-pressed="{{pressable ? !!pressed : ''}}"
|
2018-02-24 22:49:28 +00:00
|
|
|
class="{{computedClass}}"
|
2018-02-28 07:18:07 +00:00
|
|
|
:disabled
|
|
|
|
delegate-key="{{delegateKey}}" >
|
2018-01-28 20:51:48 +00:00
|
|
|
<svg>
|
|
|
|
<use xlink:href="{{href}}" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
{{else}}
|
|
|
|
<button type="button"
|
|
|
|
aria-label="{{label}}"
|
2018-02-28 07:18:07 +00:00
|
|
|
aria-pressed="{{pressable ? !!pressed : ''}}"
|
2018-02-24 22:49:28 +00:00
|
|
|
class="{{computedClass}}"
|
2018-02-28 07:18:07 +00:00
|
|
|
:disabled
|
|
|
|
on:click >
|
2018-01-28 20:51:48 +00:00
|
|
|
<svg>
|
|
|
|
<use xlink:href="{{href}}" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
{{/if}}
|
|
|
|
<style>
|
|
|
|
button.icon-button {
|
|
|
|
padding: 6px 10px;
|
|
|
|
background: none;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
button.icon-button svg {
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
fill: var(--action-button-fill-color);
|
|
|
|
}
|
|
|
|
|
|
|
|
button.icon-button.big-icon svg {
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
button.icon-button:hover svg {
|
|
|
|
fill: var(--action-button-fill-color-hover);
|
|
|
|
}
|
|
|
|
|
2018-02-24 22:49:28 +00:00
|
|
|
button.icon-button.not-pressable:active svg {
|
2018-01-28 20:51:48 +00:00
|
|
|
fill: var(--action-button-fill-color-active);
|
|
|
|
}
|
|
|
|
|
|
|
|
button.icon-button.pressed svg {
|
|
|
|
fill: var(--action-button-fill-color-pressed)
|
|
|
|
}
|
|
|
|
|
|
|
|
button.icon-button.pressed:hover svg {
|
|
|
|
fill: var(--action-button-fill-color-pressed-hover);
|
|
|
|
}
|
|
|
|
|
|
|
|
button.icon-button.pressed:active svg {
|
|
|
|
fill: var(--action-button-fill-color-pressed-active);
|
|
|
|
}
|
2018-02-24 22:49:28 +00:00
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import identity from 'lodash/identity'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
computedClass: (pressable, pressed, big) => {
|
|
|
|
return [
|
|
|
|
'icon-button',
|
|
|
|
!pressable && 'not-pressable',
|
|
|
|
pressed && 'pressed',
|
|
|
|
big && 'big-icon',
|
|
|
|
].filter(identity).join(' ')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|