Skip to content

Commit

Permalink
feat: revise close button
Browse files Browse the repository at this point in the history
  • Loading branch information
cschroeter committed Jun 29, 2023
1 parent c29520b commit 30812ee
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Revise `CloseButton` to have a more consistent look with the rest of the components.
- Added `border.active` token to help with conveying the status of a component.
- Added `underline` variant for `Link` component.

Expand Down
73 changes: 73 additions & 0 deletions src/components/close-button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { defineCssVars, defineStyle, defineStyleConfig } from '@chakra-ui/styled-system'

const vars = defineCssVars('close-button', ['bg', 'color', 'size'])

const baseStyle = defineStyle({
borderRadius: 'lg',
w: [vars.size.reference],
h: [vars.size.reference],
bg: vars.bg.reference,
color: vars.color.reference,
[vars.color.variable]: `colors.gray.600`,
_dark: {
[vars.color.variable]: `colors.gray.300`,
},
_hover: {
[vars.bg.variable]: `colors.gray.50`,
[vars.color.variable]: `colors.gray.800`,
_dark: {
[vars.bg.variable]: `colors.gray.800`,
[vars.color.variable]: `colors.white`,
},
},
_active: {
[vars.bg.variable]: `colors.gray.50`,
[vars.color.variable]: `colors.gray.900`,
_dark: {
[vars.bg.variable]: `colors.gray.800`,
[vars.color.variable]: `colors.white`,
},
},
_focusVisible: {
boxShadow: 'focus',
},
})

const sizes = {
'2xs': defineStyle({
[vars.size.variable]: 'sizes.6',
fontSize: '2xs',
}),
xs: defineStyle({
[vars.size.variable]: 'sizes.8',
fontSize: 'xs',
}),
sm: defineStyle({
[vars.size.variable]: 'sizes.9',
fontSize: 'xs',
}),
md: defineStyle({
[vars.size.variable]: 'sizes.10',
fontSize: 'sm',
}),
lg: defineStyle({
[vars.size.variable]: 'sizes.11',
fontSize: 'md',
}),
xl: defineStyle({
[vars.size.variable]: 'sizes.12',
fontSize: 'lg',
}),
'2xl': defineStyle({
[vars.size.variable]: 'sizes.15',
fontSize: 'xl',
}),
}

export default defineStyleConfig({
baseStyle,
sizes,
defaultProps: {
size: 'md',
},
})
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as Badge } from './badge'
export { default as Button } from './button'
export { default as Checkbox } from './checkbox'
export { default as CloseButton } from './close-button'
export { default as Container } from './container'
export { default as CustomSelect } from './custom-select'
export { default as Divider } from './divider'
Expand Down

1 comment on commit 30812ee

@vercel
Copy link

@vercel vercel bot commented on 30812ee Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.