feat(Label): add font prop to purge custom classes
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
import { cn } from '$shared/shadcn/utils/shadcn-utils';
|
import { cn } from '$shared/shadcn/utils/shadcn-utils';
|
||||||
import type { Snippet } from 'svelte';
|
import type { Snippet } from 'svelte';
|
||||||
import {
|
import {
|
||||||
|
type LabelFont,
|
||||||
type LabelSize,
|
type LabelSize,
|
||||||
type LabelVariant,
|
type LabelVariant,
|
||||||
labelSizeConfig,
|
labelSizeConfig,
|
||||||
@@ -28,6 +29,11 @@ interface Props {
|
|||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
uppercase?: boolean;
|
uppercase?: boolean;
|
||||||
|
/**
|
||||||
|
* Font family
|
||||||
|
* @default 'mono'
|
||||||
|
*/
|
||||||
|
font?: LabelFont;
|
||||||
/**
|
/**
|
||||||
* Bold text
|
* Bold text
|
||||||
* @default false
|
* @default false
|
||||||
@@ -55,6 +61,7 @@ interface Props {
|
|||||||
let {
|
let {
|
||||||
variant = 'default',
|
variant = 'default',
|
||||||
size = 'sm',
|
size = 'sm',
|
||||||
|
font = 'mono',
|
||||||
uppercase = true,
|
uppercase = true,
|
||||||
bold = false,
|
bold = false,
|
||||||
icon,
|
icon,
|
||||||
@@ -68,6 +75,7 @@ let {
|
|||||||
class={cn(
|
class={cn(
|
||||||
'font-mono tracking-widest leading-none',
|
'font-mono tracking-widest leading-none',
|
||||||
'inline-flex items-center gap-1.5',
|
'inline-flex items-center gap-1.5',
|
||||||
|
font === 'primary' && 'font-primary tracking-tight',
|
||||||
labelSizeConfig[size],
|
labelSizeConfig[size],
|
||||||
labelVariantConfig[variant],
|
labelVariantConfig[variant],
|
||||||
uppercase && 'uppercase',
|
uppercase && 'uppercase',
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
* Import from here in each component to keep maps DRY.
|
* Import from here in each component to keep maps DRY.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export type LabelFont = 'mono' | 'primary';
|
||||||
|
|
||||||
export type LabelVariant =
|
export type LabelVariant =
|
||||||
| 'default'
|
| 'default'
|
||||||
| 'accent'
|
| 'accent'
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ $effect(() => {
|
|||||||
<div class="flex-1 min-h-0 h-full">
|
<div class="flex-1 min-h-0 h-full">
|
||||||
<div class="py-2 relative flex flex-col min-h-0 h-full">
|
<div class="py-2 relative flex flex-col min-h-0 h-full">
|
||||||
<div class="py-2 mx-6 sticky border-b border-subtle">
|
<div class="py-2 mx-6 sticky border-b border-subtle">
|
||||||
<Label class="font-primary text-neutral-400" bold variant="default" size="sm" uppercase>
|
<Label font="primary" variant="muted" bold size="sm" uppercase>
|
||||||
Typeface Selection
|
Typeface Selection
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user