mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-15 21:23:59 +00:00
8362ac0e24
caption, th scope, <kbd> for keys, no Tab stops on rows
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
import { css } from '@/styled-system/css'
|
|
import { text } from '@/primitives/Text'
|
|
import { ShortcutDescriptor } from '../catalog'
|
|
import { ShortcutBadge } from './ShortcutBadge'
|
|
import { useShortcutFormatting } from '../hooks/useShortcutFormatting'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
type ShortcutRowProps = {
|
|
descriptor: ShortcutDescriptor
|
|
}
|
|
|
|
const shortcutCellStyle = css({
|
|
textAlign: 'right',
|
|
})
|
|
|
|
export const ShortcutRow: React.FC<ShortcutRowProps> = ({ descriptor }) => {
|
|
const { t } = useTranslation('rooms', { keyPrefix: 'shortcutsPanel' })
|
|
const { formatVisual, formatForSR } = useShortcutFormatting()
|
|
|
|
const visualShortcut = formatVisual(
|
|
descriptor.shortcut,
|
|
descriptor.code,
|
|
descriptor.kind
|
|
)
|
|
const srShortcut = formatForSR(
|
|
descriptor.shortcut,
|
|
descriptor.code,
|
|
descriptor.kind
|
|
)
|
|
|
|
return (
|
|
<tr>
|
|
<th scope="row" className={text({ variant: 'body' })}>
|
|
{t(`actions.${descriptor.id}`)}
|
|
</th>
|
|
<td className={shortcutCellStyle}>
|
|
<ShortcutBadge visualLabel={visualShortcut} srLabel={srShortcut} />
|
|
</td>
|
|
</tr>
|
|
)
|
|
}
|