2024-05-09 17:18:51 +08:00
|
|
|
import { memo } from 'react'
|
|
|
|
import { getKeyboardKeyNameBySystem } from './utils'
|
2024-07-09 15:05:40 +08:00
|
|
|
import cn from '@/utils/classnames'
|
2024-05-09 17:18:51 +08:00
|
|
|
|
|
|
|
type ShortcutsNameProps = {
|
|
|
|
keys: string[]
|
|
|
|
className?: string
|
|
|
|
}
|
|
|
|
const ShortcutsName = ({
|
|
|
|
keys,
|
|
|
|
className,
|
|
|
|
}: ShortcutsNameProps) => {
|
|
|
|
return (
|
|
|
|
<div className={cn(
|
|
|
|
'flex items-center gap-0.5 h-4 text-xs text-gray-400',
|
|
|
|
className,
|
|
|
|
)}>
|
|
|
|
{
|
|
|
|
keys.map(key => (
|
|
|
|
<div
|
|
|
|
key={key}
|
|
|
|
className='capitalize'
|
|
|
|
>
|
|
|
|
{getKeyboardKeyNameBySystem(key)}
|
|
|
|
</div>
|
|
|
|
))
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(ShortcutsName)
|