Skip to content
Merged
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
12 changes: 12 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ declare module '@primer/components' {
export const UnderlineNav: React.FunctionComponent<UnderlineNavProps>

export const theme: Object

export interface DialogProps extends CommonProps {
title: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title can also be a React Node, but making it string | React.ReactNode causes an error since that's not compatible with the CommonProps title attribute.

To solve this I would need to change quite a bit the type definitions of CommonProps, BaseProps and probably the props of most of the components, let me know if it's worth it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxstbr do you know why title needs to be in CommonProps? https://github.com/primer/components/blob/master/index.d.ts#L9

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Back from vacation now—probably because a tags can have a string title I would assume? That is copied from the rebass types if I remember correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emplums I guess then that this PR should be fine to merge, and as a follow-up we can do the refactor of Props to support the title of a Dialog to be a React Node.

isOpen: boolean
onDismiss: () => unknown
}

export const Dialog: React.FunctionComponent<DialogProps>
}

declare module '@primer/components/src/Box' {
Expand Down Expand Up @@ -419,3 +427,7 @@ declare module '@primer/components/src/theme' {
import {theme} from '@primer/components'
export default theme
}
declare module '@primer/components/src/Dialog' {
import {Dialog} from '@primer/components'
export default Dialog
}