diff --git a/pkgs/webview-ui/app/src/components/button/css/index.css b/pkgs/webview-ui/app/src/components/button/css/index.css new file mode 100644 index 000000000..cff7ac8d8 --- /dev/null +++ b/pkgs/webview-ui/app/src/components/button/css/index.css @@ -0,0 +1,54 @@ +.button { + @apply inline-flex items-center flex-shrink gap-2 justify-center p-4 text-secondary-950 font-semibold; + letter-spacing: 0.0275rem; +} + +/* button sizes */ + +.button--default { + padding: theme(padding.2) theme(padding.4); + border-radius: theme(borderRadius.DEFAULT); +} + +.button--small { + padding: theme(padding[1.5]) theme(padding[3]); + border-radius: 3px; +} + +.button--dark { + @apply border border-solid border-secondary-950 bg-primary-900 text-white shadow-inner-primary; +} + +/* button light and states */ + +.button--light { + @apply border border-solid border-secondary-400 bg-secondary-100; + + box-shadow: inset 2px 2px theme(backgroundColor.white); +} + +.button--light-hover:hover { + @apply hover:bg-secondary-200; +} + +.button--light-focus:focus { + @apply focus:bg-secondary-200; + + & .button__label { + color: theme(textColor.secondary.900) !important; + } +} + +.button--light-active:active { + @apply active:bg-secondary-200 border-secondary-600 active:text-secondary-900; + + box-shadow: inset 2px 2px theme(backgroundColor.secondary.300); + + & .button__label { + color: theme(textColor.secondary.900) !important; + } +} + +.button--light-disabled:disabled { + @apply disabled:bg-secondary-50 disabled:text-secondary-200 disabled:border-secondary-700; +} diff --git a/pkgs/webview-ui/app/src/components/button/index.tsx b/pkgs/webview-ui/app/src/components/button/index.tsx index 6c0c5209d..01bde3a26 100644 --- a/pkgs/webview-ui/app/src/components/button/index.tsx +++ b/pkgs/webview-ui/app/src/components/button/index.tsx @@ -1,6 +1,8 @@ import { splitProps, type JSX } from "solid-js"; import cx from "classnames"; import { Typography } from "../Typography"; +//import './css/index.css' +import "./css/index.css"; type Variants = "dark" | "light" | "ghost"; type Size = "default" | "s"; @@ -12,47 +14,34 @@ const variantColors: ( "border border-solid", "border-secondary-950 bg-primary-900 text-white", "shadow-inner-primary", - // Hover state - // Focus state - // Active state - !disabled && "hover:border-secondary-900 hover:bg-secondary-700", - !disabled && "focus:border-secondary-900", + !disabled && "hover:border-secondary-900 hover:bg-secondary-700", // Hover state + !disabled && "focus:border-secondary-900", // Focus state !disabled && - "active:border-secondary-900 active:shadow-inner-primary-active", + "active:border-secondary-900 active:shadow-inner-primary-active", // Active state // Disabled "disabled:bg-secondary-200 disabled:text-secondary-700 disabled:border-secondary-300", ), light: cx( - "border border-solid", - "border-secondary-800 bg-secondary-100 text-secondary-800", - "shadow-inner-secondary", - // Hover state - // Focus state - // Active state - !disabled && "hover:bg-secondary-200 hover:text-secondary-900", - !disabled && "focus:bg-secondary-200 focus:text-secondary-900", - !disabled && - "active:bg-secondary-200 active:text-secondary-950 active:shadow-inner-secondary-active", - // Disabled - "disabled:bg-secondary-50 disabled:text-secondary-200 disabled:border-secondary-700", + "button--light", + + !disabled && "button--light-hover", // Hover state + !disabled && "button--light-focus", // Focus state + !disabled && "button--light-active", // Active state + + "button--light-disabled", // Disabled state ), ghost: cx( // "shadow-inner-secondary", - // Hover state - // Focus state - // Active state - !disabled && "hover:bg-secondary-200 hover:text-secondary-900", - !disabled && "focus:bg-secondary-200 focus:text-secondary-900", - !disabled && - "active:bg-secondary-200 active:text-secondary-950 active:shadow-inner-secondary-active", - // Disabled - "disabled:bg-secondary-50 disabled:text-secondary-200 disabled:border-secondary-700", + !disabled && "hover:bg-secondary-200 hover:text-secondary-900", // Hover state + !disabled && "focus:bg-secondary-200 focus:text-secondary-900", // Focus state + !disabled && "button--light-active", // Active state + "button--light-disabled", // Disabled state ), }); const sizePaddings: Record = { - default: cx("rounded-[0.1875rem] px-4 py-2"), - s: cx("rounded-sm py-[0.375rem] px-3"), + default: cx("button--default"), + s: cx("button button--small"), //cx("rounded-sm py-[0.375rem] px-3"), }; const sizeFont: Record = { @@ -81,21 +70,25 @@ export const Button = (props: ButtonProps) => { );