Skip to content

Commit

Permalink
feat(ui): create Keyboard component
Browse files Browse the repository at this point in the history
A component that renders a styled list of keybord shortcuts
  • Loading branch information
mateusfg7 committed May 25, 2023
1 parent 543babb commit 6a60d52
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/Keyboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { DetailedHTMLProps, HTMLAttributes } from 'react'

interface Props
extends DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> {
keys: string[]
}

export const Keyboard = ({ keys, className, ...rest }: Props) => (
<kbd
className={`flex gap-2 rounded-lg border border-neutral-200 bg-neutral-100 p-1 text-neutral-500 dark:border-neutral-700 dark:bg-neutral-900 ${className}`}
{...rest}
>
{keys.map(key => (
<span key={key}>{key}</span>
))}
</kbd>
)

0 comments on commit 6a60d52

Please sign in to comment.