Skip to content

Commit

Permalink
Create Button outline variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Youakeem committed Sep 18, 2024
1 parent 6e1db0e commit 7e73fb8
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
13 changes: 8 additions & 5 deletions apps/store/src/components/DetailsList/DetailsList.css.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { style } from '@vanilla-extract/css'
import { tokens, xStack } from 'ui'
import { tokens, xStack, yStack } from 'ui'

export const detailsListRoot = style({
listStyle: 'none',
color: tokens.colors.textTranslucentSecondary,
})
export const detailsListRoot = style([
yStack({ gap: 'xxs' }),
{
listStyle: 'none',
color: tokens.colors.textTranslucentSecondary,
},
])

export const detailsListItem = style([
xStack({ justifyContent: 'space-between' }),
Expand Down
13 changes: 10 additions & 3 deletions apps/store/src/components/DetailsList/DetailsList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx'
import { type ComponentProps } from 'react'
import { type FontSizeProps, sprinkles } from 'ui'
import { type FontSizeProps, type Sprinkles, yStack } from 'ui'
import {
detailsListItem,
detailsListLabel,
Expand All @@ -10,10 +10,17 @@ import {

type RootProps = ComponentProps<'ul'> & {
size?: FontSizeProps
gap?: Sprinkles['gap']
}
const DetailsListRoot = ({ size = 'xs', className, children, ...props }: RootProps) => {
const DetailsListRoot = ({
size = 'xs',
gap = 'xxs',
className,
children,
...props
}: RootProps) => {
return (
<ul className={clsx(detailsListRoot, sprinkles({ fontSize: size }), className)} {...props}>
<ul className={clsx(detailsListRoot, yStack({ gap, fontSize: size }), className)} {...props}>
{children}
</ul>
)
Expand Down
18 changes: 18 additions & 0 deletions packages/ui/src/components/Button/Button.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ export const buttonVariant = styleVariants({
},
},
},

outline: {
backgroundColor: 'transparent',
color: tokens.colors.textPrimary,
border: '1px solid',
borderColor: tokens.colors.borderPrimary,

':active': {
backgroundColor: tokens.colors.buttonGhostHover,
},

selectors: {
'&:disabled:not([data-loading])': {
color: tokens.colors.buttonDisabledText,
backgroundColor: 'transparent',
},
},
},
})

const HEIGHT = {
Expand Down
9 changes: 9 additions & 0 deletions packages/ui/src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const Template: StoryFn<Controls> = (props: Controls) => {
<div>
<Button {...props} variant="ghost" />
</div>
<div>
<Button {...props} variant="outline" />
</div>
</div>

<div className={yStack({ gap: 'md' })}>
Expand All @@ -50,6 +53,9 @@ const Template: StoryFn<Controls> = (props: Controls) => {
<div>
<Button {...props} variant="ghost" disabled />
</div>
<div>
<Button {...props} variant="outline" disabled />
</div>
</div>

<div className={yStack({ gap: 'md' })}>
Expand All @@ -68,6 +74,9 @@ const Template: StoryFn<Controls> = (props: Controls) => {
<div>
<Button {...props} variant="ghost" loading />
</div>
<div>
<Button {...props} variant="outline" loading />
</div>
</div>
</div>
)
Expand Down
9 changes: 8 additions & 1 deletion packages/ui/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ import { getButtonSizeStyles } from './Button.helpers'
import { DotPulse } from './DotPulse'

type BaseProps = {
variant?: 'primary' | 'primary-alt' | 'secondary' | 'secondary-alt' | 'ghost' | 'ghost-alt'
variant?:
| 'primary'
| 'primary-alt'
| 'secondary'
| 'secondary-alt'
| 'ghost'
| 'ghost-alt'
| 'outline'
size?: ButtonSize
fullWidth?: boolean
hiddenText?: ReactNode
Expand Down

0 comments on commit 7e73fb8

Please sign in to comment.