1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-12 10:16:16 +01:00
Pinafore-Web-Client-Frontend/routes/_components/IconButton.html
2018-03-14 18:52:33 -07:00

79 lines
1.7 KiB
HTML

{{#if delegateKey}}
<button type="button"
aria-label="{{label}}"
aria-pressed="{{pressable ? !!pressed : ''}}"
class="{{computedClass}}"
:disabled
delegate-key="{{delegateKey}}" >
<svg>
<use xlink:href="{{href}}" />
</svg>
</button>
{{else}}
<button type="button"
aria-label="{{label}}"
aria-pressed="{{pressable ? !!pressed : ''}}"
class="{{computedClass}}"
:disabled
on:click >
<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);
}
button.icon-button.not-pressable:active svg {
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);
}
</style>
<script>
import { classname } from '../_utils/classname'
export default {
computed: {
computedClass: (pressable, pressed, big, className) => {
return classname(
'icon-button',
!pressable && 'not-pressable',
pressed && 'pressed',
big && 'big-icon',
className
)
}
}
}
</script>