feat: uniformize components sizes (#68)

This commit is contained in:
Benjamin Canac
2024-04-16 12:26:29 +02:00
committed by GitHub
parent 78e45600de
commit f302a15972
96 changed files with 1854 additions and 1720 deletions

View File

@@ -1,23 +1,19 @@
import { describe, it, expect } from 'vitest'
import Button, { type ButtonProps } from '../../src/runtime/components/Button.vue'
import ComponentRender from '../component-render'
import theme from '#build/ui/button'
describe('Button', () => {
const sizes = Object.keys(theme.variants.size) as any
const colors = Object.keys(theme.variants.color) as any
const variants = Object.keys(theme.variants.variant) as any
it.each([
// Props
['with label', { props: { label: 'Button' } }],
['with class', { props: { class: 'rounded-full font-bold' } }],
['with size 2xs', { props: { label: 'Button', size: '2xs' as const } }],
['with size xs', { props: { label: 'Button', size: 'xs' as const } }],
['with size sm', { props: { label: 'Button', size: 'sm' as const } }],
['with size md', { props: { label: 'Button', size: 'md' as const } }],
['with size lg', { props: { label: 'Button', size: 'lg' as const } }],
['with size xl', { props: { label: 'Button', size: 'xl' as const } }],
['with color', { props: { label: 'Button', color: 'red' as const } }],
['with variant outline', { props: { label: 'Button', variant: 'outline' as const } }],
['with variant soft', { props: { label: 'Button', variant: 'soft' as const } }],
['with variant subtle', { props: { label: 'Button', variant: 'subtle' as const } }],
['with variant ghost', { props: { label: 'Button', variant: 'ghost' as const } }],
['with variant link', { props: { label: 'Button', variant: 'link' as const } }],
...sizes.map((size: string) => [`with size ${size}`, { props: { label: 'Button', size } }]),
...colors.map((color: string) => [`with color ${color}`, { props: { label: 'Button', color } }]),
...variants.map((variant: string) => [`with variant ${variant}`, { props: { label: 'Button', variant } }]),
['with icon', { props: { icon: 'i-heroicons-rocket-launch' } }],
['with leading and icon', { props: { leading: true, icon: 'i-heroicons-arrow-left' } }],
['with leadingIcon', { props: { leadingIcon: 'i-heroicons-arrow-left' } }],
@@ -29,6 +25,9 @@ describe('Button', () => {
['with block', { props: { label: 'Button', block: true } }],
['with square', { props: { label: 'Button', square: true } }],
['with truncate', { props: { label: 'Button', truncate: true } }],
['with class', { props: { class: 'rounded-full font-bold' } }],
['with ui', { props: { ui: { label: 'font-bold' } } }],
// Slots
['with default slot', { slots: { default: () => 'Default slot' } }],
['with leading slot', { slots: { leading: () => 'Leading slot' } }],
['with trailing slot', { slots: { trailing: () => 'Trailing slot' } }]