Button: subtle variants (primary/secondary, left unchanged per the user's call), glass (formerly secondaryOnGlow, with its own font-normal), accent, strong (cta-strong/ink, replacing the `!` overrides on the Home hero), danger. Uses the --color-btn* tokens instead of bg-[var(--mf-btn-...)]. Radius unified to rounded-control. IconButton: adds shape (square/round), size (xs/sm/md/lg), tone (muted/subtle/plain), pressed (aria-pressed + text-accent), href/reload (links), surface (permanent background + hover to surface-hover instead of the generic `hover` alias, which matched surface-2 and gave no contrast). New PlayButton: a single place for the play/pause SVGs, strong/glass variants, as="span" for non-interactive overlays. Replaces TransportControls' main button, the MixTile overlay, and the "Top result" circle in Explore. Migrated to IconButton: close queue, "Create playlist" (Sidebar), Like (TrackInfo, with pressed), queue (PlayerExtras), back (TopBar), login (MobileHeader), and the row actions in tables (remove/add, size xs). BackLink uses size-icon-sm and drops a duplicate hover. Decision (not blocking): remove TopBar's decorative "forward" button and PlayerExtras' decorative AlignJustify icon (visually dead code). TransportControls' buttons (shuffle/prev/next/repeat) are deliberately left unmigrated: they currently have no background or hit-box of their own, and IconButton always applies a fixed-size box — migrating them would have added a visible hover pill that couldn't be verified without Docker this session. Verified with npm run check/build.
60 lines
1.4 KiB
Svelte
60 lines
1.4 KiB
Svelte
<script lang="ts">
|
|
interface Props {
|
|
playing?: boolean;
|
|
size?: 'sm' | 'md' | 'lg';
|
|
variant?: 'strong' | 'glass';
|
|
label: string;
|
|
onclick?: (event: MouseEvent) => void;
|
|
as?: 'button' | 'span';
|
|
class?: string;
|
|
}
|
|
|
|
let {
|
|
playing = false,
|
|
size = 'md',
|
|
variant = 'strong',
|
|
label,
|
|
onclick,
|
|
as = 'button',
|
|
class: klass = ''
|
|
}: Props = $props();
|
|
|
|
const SIZE: Record<'sm' | 'md' | 'lg', string> = {
|
|
sm: 'size-9.5',
|
|
md: 'size-10',
|
|
lg: 'size-11.5'
|
|
};
|
|
|
|
const VARIANT: Record<'strong' | 'glass', string> = {
|
|
strong: 'bg-cta-strong text-ink hover:brightness-95',
|
|
glass: 'border border-on-art/12 bg-ink/76 text-fg backdrop-blur'
|
|
};
|
|
|
|
const classes = $derived(
|
|
`grid shrink-0 place-items-center rounded-full transition duration-150 ${SIZE[size]} ${VARIANT[variant]} ${klass}`
|
|
);
|
|
</script>
|
|
|
|
{#snippet icon()}
|
|
{#if playing}
|
|
<svg width="15" height="15" viewBox="0 0 15 15" fill="currentColor">
|
|
<rect x="3" y="1" width="3" height="13" rx="1" />
|
|
<rect x="9" y="1" width="3" height="13" rx="1" />
|
|
</svg>
|
|
{:else}
|
|
<svg width="15" height="15" viewBox="0 0 15 15" fill="currentColor">
|
|
<path d="M3 1.5v12l10-6z" />
|
|
</svg>
|
|
{/if}
|
|
{/snippet}
|
|
|
|
{#if as === 'span'}
|
|
<span aria-hidden="true" class={classes}>
|
|
{@render icon()}
|
|
</span>
|
|
{:else}
|
|
<button type="button" {onclick} aria-label={label} class={classes}>
|
|
{@render icon()}
|
|
</button>
|
|
{/if}
|