Skip to content

Commit

Permalink
Fix deprecated types: React.ReactText
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed May 9, 2024
1 parent 4a54a28 commit 171512b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/tools-panel/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Default: StoryFn< typeof ToolsPanel > = ( {
const [ height, setHeight ] = useState< string | undefined >();
const [ minHeight, setMinHeight ] = useState< string | undefined >();
const [ width, setWidth ] = useState< string | undefined >();
const [ scale, setScale ] = useState< React.ReactText | undefined >();
const [ scale, setScale ] = useState< number | string | undefined >();

const resetAll: typeof resetAllProp = ( filters ) => {
setHeight( undefined );
Expand Down Expand Up @@ -402,7 +402,7 @@ export const WithConditionalDefaultControl: StoryFn< typeof ToolsPanel > = ( {
} ) => {
const [ attributes, setAttributes ] = useState< {
height?: string;
scale?: React.ReactText;
scale?: number | string;
} >( {} );
const { height, scale } = attributes;

Expand Down Expand Up @@ -498,7 +498,7 @@ export const WithConditionallyRenderedControl: StoryFn<
> = ( { resetAll: resetAllProp, panelId, ...props } ) => {
const [ attributes, setAttributes ] = useState< {
height?: string;
scale?: React.ReactText;
scale?: number | string;
} >( {} );
const { height, scale } = attributes;

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/utils/font-size.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import type { CSSProperties, ReactText } from 'react';
import type { CSSProperties } from 'react';

/**
* Internal dependencies
Expand Down Expand Up @@ -61,7 +61,7 @@ export function getFontSize(
return `calc(${ ratio } * ${ CONFIG.fontSize })`;
}

export function getHeadingFontSize( size: ReactText = 3 ): string {
export function getHeadingFontSize( size: number | string = 3 ): string {
if ( ! HEADING_FONT_SIZES.includes( size as HeadingSize ) ) {
return getFontSize( size );
}
Expand Down

0 comments on commit 171512b

Please sign in to comment.