Skip to content

Commit

Permalink
feat: Add the Kdb element
Browse files Browse the repository at this point in the history
  • Loading branch information
gorzelinski committed Oct 14, 2024
1 parent 4ce2afe commit 7a3d895
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions design-system/elements/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export {
} from './icon'
export { InputWrapper, Input } from './input'
export { Em } from './italic'
export { Kbd } from './kbd'
export { Label } from './label'
export { Ul, Ol, Li } from './list'
export { Nav, navigation } from './navigation'
Expand Down
1 change: 1 addition & 0 deletions design-system/elements/kbd/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Kbd } from './kbd'
33 changes: 33 additions & 0 deletions design-system/elements/kbd/kbd.styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { cva } from '@/styled-system/css'
import { sharedTransitionProperties } from '../../utils'

export const kbd = cva({
base: {
display: 'inline-block',
minWidth: '2em',
paddingY: '2xs',
paddingX: 'calc(1em / 2)',
borderRadius: 'xs',
border: 'gray.subtle',
color: 'gray.400',
backgroundColor: 'gray.800',
boxShadow: 'neumorphism.closer',
fontFamily: 'heading',
fontWeight: 'bold',
fontSize: {
base: '4xs',
md: '3xs',
lg: '2xs',
'2xl': 'xs'
},
lineHeight: {
base: '4xs',
md: '3xs',
lg: '2xs',
'2xl': 'xs'
},
textAlign: 'center',
transitionProperty: 'border-color, background-color, box-shadow, color',
...sharedTransitionProperties
}
})
4 changes: 4 additions & 0 deletions design-system/elements/kbd/kbd.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { styled } from '@/styled-system/jsx'
import { kbd } from './kbd.styles'

export const Kbd = styled('kbd', kbd)
1 change: 1 addition & 0 deletions design-system/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export {
Input,
InputWrapper,
Instagram,
Kbd,
Label,
Li,
Link,
Expand Down
4 changes: 3 additions & 1 deletion mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
Hr,
Image,
InlineCode,
Kbd,
Li,
LinkOrA,
Ol,
Expand Down Expand Up @@ -146,7 +147,8 @@ const customComponents: MDXComponents = {
<Callout {...props} css={verticalRhythm.marginBottom.m}>
{children}
</Callout>
)
),
Kbd: ({ children }) => <Kbd>{children}</Kbd>
}

export function getMDXComponents(page: Pages, slug: string): MDXComponents {
Expand Down

0 comments on commit 7a3d895

Please sign in to comment.