Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export const AudioPermissionDialog: FC = () => {
<Dialog.Content>
Your browser has not allowed audio playback. For the editor to work correctly, please allow audio
</Dialog.Content>
<Dialog.Action key="allow" onClick={confirmAudio}>
Allow audio
</Dialog.Action>
<Dialog.Action onClick={confirmAudio}>Allow audio</Dialog.Action>
</Dialog.Root>
)
}
4 changes: 2 additions & 2 deletions packages/ui-kit/src/components/dialog/dialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export default {
<Dialog.Title>{title}</Dialog.Title>
<Dialog.Description>{description}</Dialog.Description>
<Dialog.Content>Content</Dialog.Content>
<Dialog.Action key="confirm" close onClick={onConfirm}>
<Dialog.Action close onClick={onConfirm}>
Confirm
</Dialog.Action>
<Dialog.Action key="cancel" variant="secondary" close>
<Dialog.Action variant="secondary" close>
Cancel
</Dialog.Action>
</Dialog.Root>
Expand Down
9 changes: 4 additions & 5 deletions packages/ui-kit/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as RadixDialog from '@radix-ui/react-dialog'
import type { Overlay } from '@repo/common/typing'
import type { FC, Key, ReactNode } from 'react'
import type { FC, ReactNode } from 'react'
import { Button } from '#components/button'
import { Heading } from '#components/heading'
import { XIcon } from '#icons'
Expand All @@ -27,7 +27,6 @@ export type ContentProps = { children: ReactNode }
export type ActionProps = Overlay<
Pick<Button.RootProps, 'variant' | 'onClick'>,
{
key: Key
children: string | string[]
close?: boolean
}
Expand All @@ -50,15 +49,15 @@ export const Root: FC<RootProps> = props => {
actions: Action,
})

const actionButtons = actions.map(({ key, children, props: { close, ...buttonProps } }) => {
const actionButtons = actions.map(({ key, children, props: { close, ...buttonProps } }, index) => {
const button = (
<Button.Root variant="primary" {...buttonProps} key={key}>
<Button.Root variant="primary" {...buttonProps} key={key ?? index}>
<Button.Text>{children as string}</Button.Text>
</Button.Root>
)

return close ? (
<RadixDialog.Close key={key} asChild>
<RadixDialog.Close key={key ?? index} asChild>
{button}
</RadixDialog.Close>
) : (
Expand Down