feat(design): add Modernist UI primitives (Button, Tag, StatusTag, Field, Card, table styles)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import type { InputHTMLAttributes, ReactNode, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react'
|
||||
import { cx } from './cx'
|
||||
|
||||
export const INPUT_CLASS =
|
||||
'w-full min-h-9 px-2.5 py-1.5 text-sm text-ink caret-accent bg-surface border border-divider ' +
|
||||
'hover:border-ink/45 focus-visible:border-accent focus-visible:outline-offset-0 ' +
|
||||
'disabled:opacity-45 disabled:cursor-not-allowed'
|
||||
|
||||
export function Field({ label, htmlFor, children }: { label: string; htmlFor: string; children: ReactNode }) {
|
||||
return (
|
||||
<div>
|
||||
<label htmlFor={htmlFor} className="block text-xs mb-[5px] text-ink/70">
|
||||
{label}
|
||||
</label>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function Input({ className, ...rest }: InputHTMLAttributes<HTMLInputElement>) {
|
||||
return <input className={cx(INPUT_CLASS, className)} {...rest} />
|
||||
}
|
||||
|
||||
export function Textarea({ className, ...rest }: TextareaHTMLAttributes<HTMLTextAreaElement>) {
|
||||
return <textarea className={cx(INPUT_CLASS, 'min-h-[90px] resize-y', className)} {...rest} />
|
||||
}
|
||||
|
||||
export function Select({ className, ...rest }: SelectHTMLAttributes<HTMLSelectElement>) {
|
||||
return <select className={cx(INPUT_CLASS, className)} {...rest} />
|
||||
}
|
||||
Reference in New Issue
Block a user