chore: format codebase and move SectionAccordion to entities/Section
This commit is contained in:
+21
-21
@@ -1,40 +1,40 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { cn } from './cn'
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { cn } from './cn';
|
||||
|
||||
describe('cn', () => {
|
||||
describe('basic merging', () => {
|
||||
it('returns single class unchanged', () => {
|
||||
expect(cn('foo')).toBe('foo')
|
||||
})
|
||||
expect(cn('foo')).toBe('foo');
|
||||
});
|
||||
|
||||
it('joins multiple classes', () => {
|
||||
expect(cn('foo', 'bar')).toBe('foo bar')
|
||||
})
|
||||
})
|
||||
expect(cn('foo', 'bar')).toBe('foo bar');
|
||||
});
|
||||
});
|
||||
|
||||
describe('conditional classes', () => {
|
||||
it('includes truthy conditional', () => {
|
||||
expect(cn('foo', true && 'bar')).toBe('foo bar')
|
||||
})
|
||||
expect(cn('foo', true && 'bar')).toBe('foo bar');
|
||||
});
|
||||
|
||||
it('excludes falsy conditional', () => {
|
||||
expect(cn('foo', false && 'bar')).toBe('foo')
|
||||
})
|
||||
})
|
||||
expect(cn('foo', false && 'bar')).toBe('foo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('object syntax', () => {
|
||||
it('includes classes with truthy object values', () => {
|
||||
expect(cn({ foo: true, bar: false })).toBe('foo')
|
||||
})
|
||||
})
|
||||
expect(cn({ foo: true, bar: false })).toBe('foo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('tailwind conflict resolution', () => {
|
||||
it('last padding wins', () => {
|
||||
expect(cn('px-2', 'px-4')).toBe('px-4')
|
||||
})
|
||||
expect(cn('px-2', 'px-4')).toBe('px-4');
|
||||
});
|
||||
|
||||
it('last text color wins', () => {
|
||||
expect(cn('text-red-500', 'text-blue-500')).toBe('text-blue-500')
|
||||
})
|
||||
})
|
||||
})
|
||||
expect(cn('text-red-500', 'text-blue-500')).toBe('text-blue-500');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { clsx, type ClassValue } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
/**
|
||||
* Merges Tailwind classes, resolving conflicts in favor of the last value.
|
||||
*/
|
||||
export function cn(...inputs: ClassValue[]): string {
|
||||
return twMerge(clsx(inputs))
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Fraunces, Public_Sans } from 'next/font/google'
|
||||
import { Fraunces, Public_Sans } from 'next/font/google';
|
||||
|
||||
/**
|
||||
* Heading font — variable axes for brutalist variation settings
|
||||
@@ -7,7 +7,7 @@ export const fraunces = Fraunces({
|
||||
subsets: ['latin'],
|
||||
variable: '--font-fraunces',
|
||||
axes: ['opsz', 'SOFT', 'WONK'],
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
* Body font
|
||||
@@ -15,4 +15,4 @@ export const fraunces = Fraunces({
|
||||
export const publicSans = Public_Sans({
|
||||
subsets: ['latin'],
|
||||
variable: '--font-public-sans',
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { cn } from './cn'
|
||||
export type { ClassValue } from 'clsx'
|
||||
export * from './fonts'
|
||||
export { cn } from './cn';
|
||||
export type { ClassValue } from 'clsx';
|
||||
export * from './fonts';
|
||||
|
||||
Reference in New Issue
Block a user