A new Style card in Site design (a `style` global) chooses the heading and body fonts from 15 bundled ones, corners (sharp/soft/round), text size, shadow strength and page width, with a live sample. The choices become --site-* CSS variables that the @theme radius, shadow, container and font tokens scale, so blocks keep using rounded-xl, shadow-sm, max-w-6xl and follow the setting. Buttons and chips use rounded-button; the defaults are the site's current look. Fonts are @fontsource-variable packages (replacing the static DM Sans and Playfair ones): still served by the site, and a browser downloads only the fonts a page uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
33 lines
974 B
Svelte
33 lines
974 B
Svelte
<script lang="ts">
|
|
let { data } = $props<{ data: Record<string, any> }>();
|
|
|
|
const alignmentClasses: Record<string, string> = {
|
|
left: 'justify-start',
|
|
center: 'justify-center',
|
|
right: 'justify-end'
|
|
};
|
|
|
|
// Whole class names, not `btn-${variant}`: Tailwind only generates classes
|
|
// it finds written out, so a built-up name rendered as a plain grey button.
|
|
const variantClasses: Record<string, string> = {
|
|
primary: 'btn-primary',
|
|
secondary: 'btn-secondary'
|
|
};
|
|
|
|
const sizeClasses: Record<string, string> = {
|
|
xs: 'btn-xs',
|
|
sm: 'btn-sm',
|
|
md: '',
|
|
lg: 'btn-lg'
|
|
};
|
|
</script>
|
|
|
|
<div class="flex {alignmentClasses[data.alignment] || 'justify-center'}">
|
|
<a
|
|
href={data.href || '#'}
|
|
class="btn rounded-button {variantClasses[data.variant] || 'btn-primary'} {sizeClasses[data.size] || ''}"
|
|
style={data.color ? `background-color: ${data.color}; border-color: ${data.color};` : ''}
|
|
>
|
|
{data.label || 'Button'}
|
|
</a>
|
|
</div>
|