chadtmiller.com/spaces-bookclub
Book club: a Svelte demo app for atproto spaces (@atproto/lex-space)
0
0
<script lang="ts">
import type { HTMLButtonAttributes } from 'svelte/elements'
import Icon, { type IconName } from './Icon.svelte'
type Props = Omit<HTMLButtonAttributes, 'class' | 'children'> & {
icon: IconName
/** Accessible name, also shown as a tooltip */
label: string
tone?: 'neutral' | 'danger'
}
let { icon, label, tone = 'neutral', type = 'button', ...rest }: Props = $props()
</script>
<button {...rest} {type} class="icon-button {tone}" aria-label={label} title={label}>
<Icon name={icon} />
</button>
<style>
.icon-button {
display: inline-grid;
place-items: center;
width: var(--control-height-sm);
height: var(--control-height-sm);
padding: 0;
border: none;
border-radius: var(--radius-sm);
background: transparent;
color: var(--color-text-subtle);
cursor: pointer;
transition:
background-color var(--duration-fast) var(--ease-out),
color var(--duration-fast) var(--ease-out);
}
.icon-button:hover {
background: var(--color-surface-sunken);
color: var(--color-text);
}
.danger:hover {
background: var(--color-danger-soft);
color: var(--color-danger);
}
</style>