Tansy UI: a themeable React component kit
Tansy UI is a React component kit by OpenKhalix, named after the tansy
flower ("golden buttons"). It has two surfaces:
- A landing page built entirely from the kit's own components, with
five featured parts, a palette-switching playground form, and links
into Storybook
- A Storybook workshop with Tansy branding, a Welcome page, palette
toolbar and accessibility checks
Includes 15 components with colocated tokens and stories, seven brand
palettes, a palette-aware logo, a Docker/nginx image, a scripted
cPanel deploy, and a generator that keeps the landing page catalogue
in sync with Storybook.
This commit is contained in:
commit
9d406d6d2a
81 files changed
+14240
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Switch style tokens.
|
||||
*
|
||||
* Kept in a separate module from the component so the file only exports
|
||||
* components — mixing the two breaks Vite's fast refresh.
|
||||
*/
|
||||
|
||||
export type SwitchSize = 'sm' | 'md' | 'lg'
|
||||
export type SwitchColor = 'blue' | 'red' | 'green' | 'yellow' | 'teal' | 'indigo' | 'purple' | 'pink'
|
||||
|
||||
export type SwitchSizeData = {
|
||||
/** Track pill. */
|
||||
toggle: string
|
||||
/** Knob, including its resting offset from the track edge. */
|
||||
dot: string
|
||||
/** Travel distance of the knob when checked. */
|
||||
translate: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Every knob sits on a fixed 0.25rem inset from the track edge, so it can never
|
||||
* render outside the pill. Travel = trackWidth - knobWidth - (2 * inset).
|
||||
*/
|
||||
export const SWITCH_SIZES: Record<SwitchSize, SwitchSizeData> = {
|
||||
sm: { toggle: 'w-10 h-6 shrink-0', dot: 'w-4 h-4 left-1', translate: 'translate-x-4' },
|
||||
md: { toggle: 'w-12 h-7 shrink-0', dot: 'w-5 h-5 left-1', translate: 'translate-x-5' },
|
||||
lg: { toggle: 'w-[3.75rem] h-8 shrink-0', dot: 'w-6 h-6 left-1', translate: 'translate-x-7' },
|
||||
}
|
||||
|
||||
export const SWITCH_COLORS: Record<SwitchColor, string> = {
|
||||
blue: 'bg-primary-500',
|
||||
red: 'bg-red-500',
|
||||
green: 'bg-green-500',
|
||||
yellow: 'bg-yellow-500',
|
||||
teal: 'bg-teal-500',
|
||||
indigo: 'bg-indigo-500',
|
||||
purple: 'bg-purple-500',
|
||||
pink: 'bg-pink-500',
|
||||
}
|
||||
Reference in new issue
Block a user