From df5e852352b4e85146818047c4bc87038e5daf3c Mon Sep 17 00:00:00 2001 From: Aleksandar Toplek Date: Tue, 3 Dec 2024 12:48:22 +0100 Subject: [PATCH] feat(ui-primitives): Adjusted button styles --- .../stories/Primitives/Button.stories.tsx | 75 +++++++++++++++++-- web/packages/ui-primitives/package.json | 2 +- .../ui-primitives/src/Button/Button.tsx | 8 +- 3 files changed, 74 insertions(+), 11 deletions(-) diff --git a/web/apps/ui-docs/stories/Primitives/Button.stories.tsx b/web/apps/ui-docs/stories/Primitives/Button.stories.tsx index 1eb09c5d02..3f95ad100d 100644 --- a/web/apps/ui-docs/stories/Primitives/Button.stories.tsx +++ b/web/apps/ui-docs/stories/Primitives/Button.stories.tsx @@ -11,14 +11,63 @@ export const Default: Story = { } }; -export const VariantPlain: Story = { +export const Plain: Story = { args: { variant: 'plain', ...Default.args } }; -export const VariantSoftOnBackground: Story = { +export const PlainOnBackground: Story = { + args: { + variant: 'plain', + ...Default.args + }, + decorators: [ + (Story) => ( +
+ +
+ ) + ] +}; + +export const PlainOnCard: Story = { + args: { + variant: 'plain', + ...Default.args + }, + decorators: [ + (Story) => ( + + + + ) + ] +}; + +export const PlainOnMuted: Story = { + args: { + variant: 'plain', + ...Default.args + }, + decorators: [ + (Story) => ( +
+ +
+ ) + ] +}; + +export const Soft: Story = { + args: { + variant: 'soft', + ...Default.args + } +}; + +export const SoftOnBackground: Story = { args: { variant: 'soft', ...Default.args @@ -32,7 +81,7 @@ export const VariantSoftOnBackground: Story = { ] }; -export const VariantSoftOnCard: Story = { +export const SoftOnCard: Story = { args: { variant: 'soft', ...Default.args @@ -46,21 +95,35 @@ export const VariantSoftOnCard: Story = { ] }; -export const VariantSolid: Story = { +export const SoftOnMuted: Story = { + args: { + variant: 'soft', + ...Default.args + }, + decorators: [ + (Story) => ( +
+ +
+ ) + ] +}; + +export const Solid: Story = { args: { variant: 'solid', ...Default.args } }; -export const VariantOulined: Story = { +export const Oulined: Story = { args: { variant: 'outlined', ...Default.args } }; -export const VariantLink: Story = { +export const Link: Story = { args: { variant: 'link', ...Default.args diff --git a/web/packages/ui-primitives/package.json b/web/packages/ui-primitives/package.json index 8ec61045a2..c35b2d9659 100644 --- a/web/packages/ui-primitives/package.json +++ b/web/packages/ui-primitives/package.json @@ -1,6 +1,6 @@ { "name": "@signalco/ui-primitives", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "type": "module", "sideEffects": false, diff --git a/web/packages/ui-primitives/src/Button/Button.tsx b/web/packages/ui-primitives/src/Button/Button.tsx index fa9a211750..a457bfeb45 100644 --- a/web/packages/ui-primitives/src/Button/Button.tsx +++ b/web/packages/ui-primitives/src/Button/Button.tsx @@ -49,10 +49,10 @@ const Button = forwardRef(({ ref={ref as any} className={cx( 'select-none inline-flex gap-1 items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background cursor-default', - (!variant || variant === 'soft') && 'bg-primary/15 text-secondary-foreground hover:bg-primary/25', - variant === 'outlined' && 'border border-input hover:bg-accent hover:text-accent-foreground', - variant === 'plain' && 'hover:bg-accent hover:text-accent-foreground', - variant === 'solid' && 'bg-primary text-primary-foreground hover:bg-primary/70', + (!variant || variant === 'soft') && 'bg-primary/15 text-primary hover:bg-primary/25 active:bg-primary/35', + variant === 'outlined' && 'border border-accent-foreground hover:bg-accent hover:text-accent-foreground active:bg-primary/10', + variant === 'plain' && 'hover:bg-primary/10 hover:text-accent-foreground active:bg-primary/20', + variant === 'solid' && 'bg-primary text-primary-foreground hover:bg-primary/70 active:bg-primary/80', (!size || size === 'md') && 'h-10 py-2 px-4', size === 'xs' && 'h-7 px-2 gap-0.5', size === 'sm' && 'h-9 px-3 gap-1',