Skip to content

Commit 00cc94f

Browse files
committed
fix: Props should allow ReactNode in certain cases
In order to better provide translatable labels. In other cases, string | ReactNode was simplified to ReactNode because that type already includes string.
1 parent 6a3058b commit 00cc94f

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

packages/modal/components/DialogModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface DialogModalProps extends ModalBaseProps {
1818
/** Whether we automatically add padding to the body of the modal. */
1919
isContentFlush?: boolean;
2020
/** The text displayed in the header of the modal. */
21-
title: string;
21+
title: React.ReactNode;
2222
}
2323

2424
class DialogModal extends React.PureComponent<DialogModalProps, {}> {

packages/modal/components/DialogModalWithFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface DialogModalWithFooterProps extends DialogModalProps {
88
/** The primary button */
99
ctaButton: React.ReactElement<ButtonProps>;
1010
/** The text for the button that secondary button, which closes the modal */
11-
closeText: string;
11+
closeText: React.ReactNode;
1212
}
1313

1414
class DialogModalWithFooter extends React.PureComponent<

packages/modal/components/FullscreenModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ interface FullscreenModalProps extends ModalBaseProps {
1212
/** The primary button */
1313
ctaButton?: React.ReactElement<ButtonProps>;
1414
/** The text for the button that secondary button, which closes the modal */
15-
closeText: string;
15+
closeText: React.ReactNode;
1616
/** The title that appears in the header */
17-
title: string;
17+
title: React.ReactNode;
1818
/** The subtitle that appears in the header */
19-
subtitle?: string;
19+
subtitle?: React.ReactNode;
2020
/** Whether we automatically add padding to the body of the modal. */
2121
isContentFlush?: boolean;
2222
/** Custom header content component. ⚠️Use rarely and with caution⚠️ */

packages/modal/components/ModalBase.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export enum ModalSizes {
2424
}
2525

2626
export interface ModalBaseProps {
27-
children?: React.ReactNode | string;
27+
children?: React.ReactNode;
2828
/** Controls whether the modal animates in and out. ⚠️Do not use this directly⚠️ */
2929
isAnimated?: boolean;
3030
/** Whether the modal is open */

packages/table/components/Column.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ColumnProps {
1010
/**
1111
* header is providing the contents for the header cell for the column.
1212
*/
13-
header: string | React.ReactNode;
13+
header: React.ReactNode;
1414
/**
1515
* cellRenderer is the function which is creating the cell contents for this column.
1616
*/

packages/table/components/SortableHeaderCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type SortDirection = "ASC" | "DESC" | null;
99
interface Props {
1010
sortHandler: () => void;
1111
sortDirection: SortDirection;
12-
columnContent: string | React.ReactNode;
12+
columnContent: React.ReactNode;
1313
textAlign?: TextAlign;
1414
}
1515
interface State {

packages/textInput/components/TextInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ export interface TextInputProps extends React.HTMLProps<HTMLInputElement> {
4545
/**
4646
* Sets the contents of the input label. This can be a `string` or any `ReactNode`.
4747
*/
48-
inputLabel: string | React.ReactNode;
48+
inputLabel: React.ReactNode;
4949
/**
5050
* Defaults to `true`, but can be set to `false` to visibly hide the `TextInput`'s label. The `inputLabel` should still be set even when hidden for accessibility support.
5151
*/
5252
showInputLabel: boolean;
5353
/**
5454
* hintContent is text or a ReactNode that is displayed directly under the input with additional information about the expected input.
5555
*/
56-
hintContent?: string | React.ReactNode;
56+
hintContent?: React.ReactNode;
5757
/**
5858
* Sets the contents for validation errors. This will be displayed below the input element. Errors are only visible when the `TextInput` appearance is also set to `TextInputAppearance.Error`.
5959
*/
60-
errors?: string[];
60+
errors?: React.ReactNode[];
6161
}
6262

6363
export class TextInput<

0 commit comments

Comments
 (0)