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,42 @@
|
||||
import { forwardRef, type HTMLAttributes } from 'react'
|
||||
import { cn } from '@/lib/cn'
|
||||
import { SPINNER_SIZES, SPINNER_VARIANTS, type SpinnerSize, type SpinnerVariant } from './spinner.tokens'
|
||||
|
||||
/**
|
||||
* Loading spinner.
|
||||
*
|
||||
* Ported from the original `Spinner` component.
|
||||
* The colour token is a palette-driven `primary-500`, so it re-themes with the
|
||||
* Storybook palette switcher.
|
||||
*/
|
||||
|
||||
export type SpinnerProps = HTMLAttributes<HTMLDivElement> & {
|
||||
size?: SpinnerSize
|
||||
variant?: SpinnerVariant
|
||||
/** Accessible label announced while loading. */
|
||||
label?: string
|
||||
}
|
||||
|
||||
export const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(function Spinner(
|
||||
{ size = 'md', variant = 'primary', label = 'Loading', className, ...props },
|
||||
ref,
|
||||
) {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
role="status"
|
||||
aria-label={label}
|
||||
className={cn(
|
||||
'inline-block rounded-full animate-spin',
|
||||
SPINNER_SIZES[size] ?? SPINNER_SIZES.md,
|
||||
SPINNER_VARIANTS[variant] ?? SPINNER_VARIANTS.primary,
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<span className="sr-only">{label}...</span>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
export default Spinner
|
||||
Reference in new issue
Block a user