From f111a5aa30a14041a78e0dfb0406d8c3460ed809 Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Thu, 4 Aug 2022 00:23:57 +0900 Subject: [PATCH 01/20] rename to ts --- packages/components/src/card/card-body/{index.js => index.ts} | 0 packages/components/src/card/card-divider/{index.js => index.ts} | 0 packages/components/src/card/card-footer/{index.js => index.ts} | 0 packages/components/src/card/card-header/{index.js => index.ts} | 0 packages/components/src/card/card-media/{index.js => index.ts} | 0 packages/components/src/card/card/{index.js => index.ts} | 0 packages/components/src/card/{context.js => context.ts} | 0 packages/components/src/card/{index.js => index.ts} | 0 packages/components/src/card/{styles.js => styles.ts} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename packages/components/src/card/card-body/{index.js => index.ts} (100%) rename packages/components/src/card/card-divider/{index.js => index.ts} (100%) rename packages/components/src/card/card-footer/{index.js => index.ts} (100%) rename packages/components/src/card/card-header/{index.js => index.ts} (100%) rename packages/components/src/card/card-media/{index.js => index.ts} (100%) rename packages/components/src/card/card/{index.js => index.ts} (100%) rename packages/components/src/card/{context.js => context.ts} (100%) rename packages/components/src/card/{index.js => index.ts} (100%) rename packages/components/src/card/{styles.js => styles.ts} (100%) diff --git a/packages/components/src/card/card-body/index.js b/packages/components/src/card/card-body/index.ts similarity index 100% rename from packages/components/src/card/card-body/index.js rename to packages/components/src/card/card-body/index.ts diff --git a/packages/components/src/card/card-divider/index.js b/packages/components/src/card/card-divider/index.ts similarity index 100% rename from packages/components/src/card/card-divider/index.js rename to packages/components/src/card/card-divider/index.ts diff --git a/packages/components/src/card/card-footer/index.js b/packages/components/src/card/card-footer/index.ts similarity index 100% rename from packages/components/src/card/card-footer/index.js rename to packages/components/src/card/card-footer/index.ts diff --git a/packages/components/src/card/card-header/index.js b/packages/components/src/card/card-header/index.ts similarity index 100% rename from packages/components/src/card/card-header/index.js rename to packages/components/src/card/card-header/index.ts diff --git a/packages/components/src/card/card-media/index.js b/packages/components/src/card/card-media/index.ts similarity index 100% rename from packages/components/src/card/card-media/index.js rename to packages/components/src/card/card-media/index.ts diff --git a/packages/components/src/card/card/index.js b/packages/components/src/card/card/index.ts similarity index 100% rename from packages/components/src/card/card/index.js rename to packages/components/src/card/card/index.ts diff --git a/packages/components/src/card/context.js b/packages/components/src/card/context.ts similarity index 100% rename from packages/components/src/card/context.js rename to packages/components/src/card/context.ts diff --git a/packages/components/src/card/index.js b/packages/components/src/card/index.ts similarity index 100% rename from packages/components/src/card/index.js rename to packages/components/src/card/index.ts diff --git a/packages/components/src/card/styles.js b/packages/components/src/card/styles.ts similarity index 100% rename from packages/components/src/card/styles.js rename to packages/components/src/card/styles.ts From 3aafbbd97c04a2b70d5008592f7466659770299c Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Thu, 4 Aug 2022 01:28:00 +0900 Subject: [PATCH 02/20] Replace component with tsx. --- .../card-body/{component.js => component.tsx} | 21 ++++++++++------ .../{component.js => component.tsx} | 22 ++++++++++------- .../{component.js => component.tsx} | 21 ++++++++++------ .../{component.js => component.tsx} | 18 +++++++++----- .../{component.js => component.tsx} | 20 ++++++++++------ .../card/card/{component.js => component.tsx} | 24 ++++++++++++------- 6 files changed, 83 insertions(+), 43 deletions(-) rename packages/components/src/card/card-body/{component.js => component.tsx} (62%) rename packages/components/src/card/card-divider/{component.js => component.tsx} (56%) rename packages/components/src/card/card-footer/{component.js => component.tsx} (54%) rename packages/components/src/card/card-header/{component.js => component.tsx} (54%) rename packages/components/src/card/card-media/{component.js => component.tsx} (58%) rename packages/components/src/card/card/{component.js => component.tsx} (83%) diff --git a/packages/components/src/card/card-body/component.js b/packages/components/src/card/card-body/component.tsx similarity index 62% rename from packages/components/src/card/card-body/component.js rename to packages/components/src/card/card-body/component.tsx index 028974cbd1e882..ebf3c237617bdd 100644 --- a/packages/components/src/card/card-body/component.js +++ b/packages/components/src/card/card-body/component.tsx @@ -1,16 +1,21 @@ +/** + * External dependencies + */ +import type { ForwardedRef } from 'react'; + /** * Internal dependencies */ -import { contextConnect } from '../../ui/context'; +import { contextConnect, WordPressComponentProps } from '../../ui/context'; import { Scrollable } from '../../scrollable'; import { View } from '../../view'; import { useCardBody } from './hook'; +import type { BodyProps } from '../types'; -/** - * @param {import('../../ui/context').WordPressComponentProps} props - * @param {import('react').ForwardedRef} forwardedRef - */ -function CardBody( props, forwardedRef ) { +function CardBody( + props: WordPressComponentProps< BodyProps, 'div' >, + forwardedRef: ForwardedRef< HTMLDivElement > +) { const { isScrollable, ...otherProps } = useCardBody( props ); if ( isScrollable ) { @@ -35,6 +40,8 @@ function CardBody( props, forwardedRef ) { * * ``` */ -const ConnectedCardBody = contextConnect( CardBody, 'CardBody' ); +const ConnectedCardBody = contextConnect< + WordPressComponentProps< BodyProps, 'div' > +>( CardBody, 'CardBody' ); export default ConnectedCardBody; diff --git a/packages/components/src/card/card-divider/component.js b/packages/components/src/card/card-divider/component.tsx similarity index 56% rename from packages/components/src/card/card-divider/component.js rename to packages/components/src/card/card-divider/component.tsx index 9696b98673db74..4a15b62b2f7188 100644 --- a/packages/components/src/card/card-divider/component.js +++ b/packages/components/src/card/card-divider/component.tsx @@ -1,15 +1,19 @@ /** - * Internal dependencies + * External dependencies */ -import { contextConnect } from '../../ui/context'; -import { Divider } from '../../divider'; -import { useCardDivider } from './hook'; +import type { ForwardedRef } from 'react'; /** - * @param {import('../../ui/context').WordPressComponentProps} props - * @param {import('react').ForwardedRef} forwardedRef + * Internal dependencies */ -function CardDivider( props, forwardedRef ) { +import { contextConnect, WordPressComponentProps } from '../../ui/context'; +import { Divider, DividerProps } from '../../divider'; +import { useCardDivider } from './hook'; + +function CardDivider( + props: WordPressComponentProps< DividerProps, 'hr', false >, + forwardedRef: ForwardedRef< HTMLHRElement > +) { const dividerProps = useCardDivider( props ); return ; @@ -30,6 +34,8 @@ function CardDivider( props, forwardedRef ) { * * ``` */ -const ConnectedCardDivider = contextConnect( CardDivider, 'CardDivider' ); +const ConnectedCardDivider = contextConnect< + WordPressComponentProps< DividerProps, 'hr', false > +>( CardDivider, 'CardDivider' ); export default ConnectedCardDivider; diff --git a/packages/components/src/card/card-footer/component.js b/packages/components/src/card/card-footer/component.tsx similarity index 54% rename from packages/components/src/card/card-footer/component.js rename to packages/components/src/card/card-footer/component.tsx index 130d9141e409e6..f2d93f604bd24f 100644 --- a/packages/components/src/card/card-footer/component.js +++ b/packages/components/src/card/card-footer/component.tsx @@ -1,15 +1,20 @@ +/** + * External dependencies + */ +import type { ForwardedRef } from 'react'; + /** * Internal dependencies */ -import { contextConnect } from '../../ui/context'; +import { contextConnect, WordPressComponentProps } from '../../ui/context'; import { Flex } from '../../flex'; import { useCardFooter } from './hook'; +import type { FooterProps } from '../types'; -/** - * @param {import('../../ui/context').WordPressComponentProps} props - * @param {import('react').ForwardedRef} forwardedRef - */ -function CardFooter( props, forwardedRef ) { +function CardFooter( + props: WordPressComponentProps< FooterProps, 'div' >, + forwardedRef: ForwardedRef< HTMLDivElement > +) { const footerProps = useCardFooter( props ); return ; @@ -28,6 +33,8 @@ function CardFooter( props, forwardedRef ) { * * ``` */ -const ConnectedCardFooter = contextConnect( CardFooter, 'CardFooter' ); +const ConnectedCardFooter = contextConnect< + WordPressComponentProps< FooterProps, 'div' > +>( CardFooter, 'CardFooter' ); export default ConnectedCardFooter; diff --git a/packages/components/src/card/card-header/component.js b/packages/components/src/card/card-header/component.tsx similarity index 54% rename from packages/components/src/card/card-header/component.js rename to packages/components/src/card/card-header/component.tsx index f9fe39d03a8c8f..3b48e047e7b7d2 100644 --- a/packages/components/src/card/card-header/component.js +++ b/packages/components/src/card/card-header/component.tsx @@ -1,15 +1,19 @@ /** * Internal dependencies */ -import { contextConnect } from '../../ui/context'; +import { contextConnect, WordPressComponentProps } from '../../ui/context'; import { Flex } from '../../flex'; import { useCardHeader } from './hook'; - +import type { HeaderProps } from '../types'; /** - * @param {import('../../ui/context').WordPressComponentProps} props - * @param {import('react').ForwardedRef} forwardedRef + * External dependencies */ -function CardHeader( props, forwardedRef ) { +import type { ForwardedRef } from 'react'; + +function CardHeader( + props: WordPressComponentProps< HeaderProps, 'div' >, + forwardedRef: ForwardedRef< HTMLDivElement > +) { const headerProps = useCardHeader( props ); return ; @@ -28,6 +32,8 @@ function CardHeader( props, forwardedRef ) { * * ``` */ -const ConnectedCardHeader = contextConnect( CardHeader, 'CardHeader' ); +const ConnectedCardHeader = contextConnect< + WordPressComponentProps< HeaderProps, 'div' > +>( CardHeader, 'CardHeader' ); export default ConnectedCardHeader; diff --git a/packages/components/src/card/card-media/component.js b/packages/components/src/card/card-media/component.tsx similarity index 58% rename from packages/components/src/card/card-media/component.js rename to packages/components/src/card/card-media/component.tsx index 83313b1ce4fe3d..7e83cf10b4ee8e 100644 --- a/packages/components/src/card/card-media/component.js +++ b/packages/components/src/card/card-media/component.tsx @@ -1,15 +1,19 @@ +/** + * External dependencies + */ +import type { ForwardedRef, ReactNode } from 'react'; + /** * Internal dependencies */ -import { contextConnect } from '../../ui/context'; +import { contextConnect, WordPressComponentProps } from '../../ui/context'; import { View } from '../../view'; import { useCardMedia } from './hook'; -/** - * @param {import('../../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props - * @param {import('react').ForwardedRef} forwardedRef - */ -function CardMedia( props, forwardedRef ) { +function CardMedia( + props: WordPressComponentProps< { children: ReactNode }, 'div' >, + forwardedRef: ForwardedRef< HTMLDivElement > +) { const cardMediaProps = useCardMedia( props ); return ; @@ -32,6 +36,8 @@ function CardMedia( props, forwardedRef ) { * ); * ``` */ -const ConnectedCardMedia = contextConnect( CardMedia, 'CardMedia' ); +const ConnectedCardMedia = contextConnect< + WordPressComponentProps< { children: ReactNode }, 'div' > +>( CardMedia, 'CardMedia' ); export default ConnectedCardMedia; diff --git a/packages/components/src/card/card/component.js b/packages/components/src/card/card/component.tsx similarity index 83% rename from packages/components/src/card/card/component.js rename to packages/components/src/card/card/component.tsx index c78d8d69c3b7b4..ec4005103fe0b7 100644 --- a/packages/components/src/card/card/component.js +++ b/packages/components/src/card/card/component.tsx @@ -2,6 +2,7 @@ * External dependencies */ import { css } from '@emotion/react'; +import type { ForwardedRef } from 'react'; /** * WordPress dependencies @@ -11,19 +12,23 @@ import { useMemo } from '@wordpress/element'; /** * Internal dependencies */ -import { contextConnect, ContextSystemProvider } from '../../ui/context'; +import { + contextConnect, + ContextSystemProvider, + WordPressComponentProps, +} from '../../ui/context'; import { Elevation } from '../../elevation'; import { View } from '../../view'; import * as styles from '../styles'; import { useCard } from './hook'; import CONFIG from '../../utils/config-values'; -import { useCx } from '../../utils/hooks/use-cx'; +import { useCx } from '../../utils'; +import type { Props } from '../types'; -/** - * @param {import('../../ui/context').WordPressComponentProps} props - * @param {import('react').ForwardedRef} forwardedRef - */ -function Card( props, forwardedRef ) { +function Card( + props: WordPressComponentProps< Props, 'div' >, + forwardedRef: ForwardedRef< HTMLDivElement > +) { const { children, elevation, @@ -105,6 +110,9 @@ function Card( props, forwardedRef ) { * } * ``` */ -const ConnectedCard = contextConnect( Card, 'Card' ); +const ConnectedCard = contextConnect< WordPressComponentProps< Props, 'div' > >( + Card, + 'Card' +); export default ConnectedCard; From 672a2713a941838904ed0a413a0aa6ffafc6b446 Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Thu, 4 Aug 2022 01:32:12 +0900 Subject: [PATCH 03/20] move MediaProps to types.ts --- packages/components/src/card/card-media/component.tsx | 7 ++++--- packages/components/src/card/types.ts | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/components/src/card/card-media/component.tsx b/packages/components/src/card/card-media/component.tsx index 7e83cf10b4ee8e..84d293c5a30a6e 100644 --- a/packages/components/src/card/card-media/component.tsx +++ b/packages/components/src/card/card-media/component.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import type { ForwardedRef, ReactNode } from 'react'; +import type { ForwardedRef } from 'react'; /** * Internal dependencies @@ -9,9 +9,10 @@ import type { ForwardedRef, ReactNode } from 'react'; import { contextConnect, WordPressComponentProps } from '../../ui/context'; import { View } from '../../view'; import { useCardMedia } from './hook'; +import type { MediaProps } from '../types'; function CardMedia( - props: WordPressComponentProps< { children: ReactNode }, 'div' >, + props: WordPressComponentProps< MediaProps, 'div' >, forwardedRef: ForwardedRef< HTMLDivElement > ) { const cardMediaProps = useCardMedia( props ); @@ -37,7 +38,7 @@ function CardMedia( * ``` */ const ConnectedCardMedia = contextConnect< - WordPressComponentProps< { children: ReactNode }, 'div' > + WordPressComponentProps< MediaProps, 'div' > >( CardMedia, 'CardMedia' ); export default ConnectedCardMedia; diff --git a/packages/components/src/card/types.ts b/packages/components/src/card/types.ts index f95b45d3647507..7589401f43ffac 100644 --- a/packages/components/src/card/types.ts +++ b/packages/components/src/card/types.ts @@ -74,6 +74,13 @@ export type BodyProps = BaseSubComponentProps & { isScrollable?: boolean; }; +export type MediaProps = { + /** + * The children elements. + */ + children: React.ReactNode; +}; + type MarginalSubComponentProps = BaseSubComponentProps & { /** * Renders without a border. From 0e06f765a6c7f531c46c78349a8e9207ab390a08 Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Thu, 4 Aug 2022 01:34:15 +0900 Subject: [PATCH 04/20] fix imports --- packages/components/src/card/card/component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/card/card/component.tsx b/packages/components/src/card/card/component.tsx index ec4005103fe0b7..3196f36ed3545d 100644 --- a/packages/components/src/card/card/component.tsx +++ b/packages/components/src/card/card/component.tsx @@ -22,7 +22,7 @@ import { View } from '../../view'; import * as styles from '../styles'; import { useCard } from './hook'; import CONFIG from '../../utils/config-values'; -import { useCx } from '../../utils'; +import { useCx } from '../../utils/hooks/use-cx'; import type { Props } from '../types'; function Card( From 726e2e2b8825599b461e5a2bec0cb663d5a5690b Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Thu, 4 Aug 2022 02:00:13 +0900 Subject: [PATCH 05/20] component props to DRY --- .../components/src/card/card-body/component.tsx | 11 +++++++---- .../src/card/card-divider/component.tsx | 15 +++++++++++---- .../components/src/card/card-footer/component.tsx | 11 +++++++---- .../components/src/card/card-header/component.tsx | 11 +++++++---- .../components/src/card/card-media/component.tsx | 11 +++++++---- packages/components/src/card/card/component.tsx | 9 ++++----- 6 files changed, 43 insertions(+), 25 deletions(-) diff --git a/packages/components/src/card/card-body/component.tsx b/packages/components/src/card/card-body/component.tsx index ebf3c237617bdd..2a1e4725889e4e 100644 --- a/packages/components/src/card/card-body/component.tsx +++ b/packages/components/src/card/card-body/component.tsx @@ -12,8 +12,10 @@ import { View } from '../../view'; import { useCardBody } from './hook'; import type { BodyProps } from '../types'; +export type CardBodyProps = WordPressComponentProps< BodyProps, 'div' >; + function CardBody( - props: WordPressComponentProps< BodyProps, 'div' >, + props: CardBodyProps, forwardedRef: ForwardedRef< HTMLDivElement > ) { const { isScrollable, ...otherProps } = useCardBody( props ); @@ -40,8 +42,9 @@ function CardBody( * * ``` */ -const ConnectedCardBody = contextConnect< - WordPressComponentProps< BodyProps, 'div' > ->( CardBody, 'CardBody' ); +const ConnectedCardBody = contextConnect< CardBodyProps >( + CardBody, + 'CardBody' +); export default ConnectedCardBody; diff --git a/packages/components/src/card/card-divider/component.tsx b/packages/components/src/card/card-divider/component.tsx index 4a15b62b2f7188..76a6e737a8981b 100644 --- a/packages/components/src/card/card-divider/component.tsx +++ b/packages/components/src/card/card-divider/component.tsx @@ -10,8 +10,14 @@ import { contextConnect, WordPressComponentProps } from '../../ui/context'; import { Divider, DividerProps } from '../../divider'; import { useCardDivider } from './hook'; +export type CardDividerProps = WordPressComponentProps< + DividerProps, + 'hr', + false +>; + function CardDivider( - props: WordPressComponentProps< DividerProps, 'hr', false >, + props: CardDividerProps, forwardedRef: ForwardedRef< HTMLHRElement > ) { const dividerProps = useCardDivider( props ); @@ -34,8 +40,9 @@ function CardDivider( * * ``` */ -const ConnectedCardDivider = contextConnect< - WordPressComponentProps< DividerProps, 'hr', false > ->( CardDivider, 'CardDivider' ); +const ConnectedCardDivider = contextConnect< CardDividerProps >( + CardDivider, + 'CardDivider' +); export default ConnectedCardDivider; diff --git a/packages/components/src/card/card-footer/component.tsx b/packages/components/src/card/card-footer/component.tsx index f2d93f604bd24f..5a77a4fef8a018 100644 --- a/packages/components/src/card/card-footer/component.tsx +++ b/packages/components/src/card/card-footer/component.tsx @@ -11,8 +11,10 @@ import { Flex } from '../../flex'; import { useCardFooter } from './hook'; import type { FooterProps } from '../types'; +export type CardFooterProps = WordPressComponentProps< FooterProps, 'div' >; + function CardFooter( - props: WordPressComponentProps< FooterProps, 'div' >, + props: CardFooterProps, forwardedRef: ForwardedRef< HTMLDivElement > ) { const footerProps = useCardFooter( props ); @@ -33,8 +35,9 @@ function CardFooter( * * ``` */ -const ConnectedCardFooter = contextConnect< - WordPressComponentProps< FooterProps, 'div' > ->( CardFooter, 'CardFooter' ); +const ConnectedCardFooter = contextConnect< CardFooterProps >( + CardFooter, + 'CardFooter' +); export default ConnectedCardFooter; diff --git a/packages/components/src/card/card-header/component.tsx b/packages/components/src/card/card-header/component.tsx index 3b48e047e7b7d2..981bb24e5b4ad3 100644 --- a/packages/components/src/card/card-header/component.tsx +++ b/packages/components/src/card/card-header/component.tsx @@ -10,8 +10,10 @@ import type { HeaderProps } from '../types'; */ import type { ForwardedRef } from 'react'; +export type CardHeaderProps = WordPressComponentProps< HeaderProps, 'div' >; + function CardHeader( - props: WordPressComponentProps< HeaderProps, 'div' >, + props: CardHeaderProps, forwardedRef: ForwardedRef< HTMLDivElement > ) { const headerProps = useCardHeader( props ); @@ -32,8 +34,9 @@ function CardHeader( * * ``` */ -const ConnectedCardHeader = contextConnect< - WordPressComponentProps< HeaderProps, 'div' > ->( CardHeader, 'CardHeader' ); +const ConnectedCardHeader = contextConnect< CardHeaderProps >( + CardHeader, + 'CardHeader' +); export default ConnectedCardHeader; diff --git a/packages/components/src/card/card-media/component.tsx b/packages/components/src/card/card-media/component.tsx index 84d293c5a30a6e..62aad2435a269c 100644 --- a/packages/components/src/card/card-media/component.tsx +++ b/packages/components/src/card/card-media/component.tsx @@ -11,8 +11,10 @@ import { View } from '../../view'; import { useCardMedia } from './hook'; import type { MediaProps } from '../types'; +export type CardMediaProps = WordPressComponentProps< MediaProps, 'div' >; + function CardMedia( - props: WordPressComponentProps< MediaProps, 'div' >, + props: CardMediaProps, forwardedRef: ForwardedRef< HTMLDivElement > ) { const cardMediaProps = useCardMedia( props ); @@ -37,8 +39,9 @@ function CardMedia( * ); * ``` */ -const ConnectedCardMedia = contextConnect< - WordPressComponentProps< MediaProps, 'div' > ->( CardMedia, 'CardMedia' ); +const ConnectedCardMedia = contextConnect< CardMediaProps >( + CardMedia, + 'CardMedia' +); export default ConnectedCardMedia; diff --git a/packages/components/src/card/card/component.tsx b/packages/components/src/card/card/component.tsx index 3196f36ed3545d..a416780c57ad80 100644 --- a/packages/components/src/card/card/component.tsx +++ b/packages/components/src/card/card/component.tsx @@ -25,8 +25,10 @@ import CONFIG from '../../utils/config-values'; import { useCx } from '../../utils/hooks/use-cx'; import type { Props } from '../types'; +export type CardProps = WordPressComponentProps< Props, 'div' >; + function Card( - props: WordPressComponentProps< Props, 'div' >, + props: CardProps, forwardedRef: ForwardedRef< HTMLDivElement > ) { const { @@ -110,9 +112,6 @@ function Card( * } * ``` */ -const ConnectedCard = contextConnect< WordPressComponentProps< Props, 'div' > >( - Card, - 'Card' -); +const ConnectedCard = contextConnect< CardProps >( Card, 'Card' ); export default ConnectedCard; From 7007dbe98ef2236ea4ae22a163dc9a62d949b17c Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Thu, 4 Aug 2022 02:51:45 +0900 Subject: [PATCH 06/20] convert to ts. --- packages/components/CONTRIBUTING.md | 2 +- .../src/card/card-body/{hook.js => hook.ts} | 6 ++---- .../src/card/card-divider/{hook.js => hook.ts} | 6 ++---- .../src/card/card-footer/{hook.js => hook.ts} | 6 ++---- .../src/card/card-header/{hook.js => hook.ts} | 6 ++---- .../src/card/card-media/{hook.js => hook.ts} | 11 +++++++---- .../src/card/card/{hook.js => hook.ts} | 18 ++++++++---------- 7 files changed, 24 insertions(+), 31 deletions(-) rename packages/components/src/card/card-body/{hook.js => hook.ts} (83%) rename packages/components/src/card/card-divider/{hook.js => hook.ts} (79%) rename packages/components/src/card/card-footer/{hook.js => hook.ts} (84%) rename packages/components/src/card/card-header/{hook.js => hook.ts} (84%) rename packages/components/src/card/card-media/{hook.js => hook.ts} (77%) rename packages/components/src/card/card/{hook.js => hook.ts} (75%) diff --git a/packages/components/CONTRIBUTING.md b/packages/components/CONTRIBUTING.md index 0b866036905938..482aba54523e66 100644 --- a/packages/components/CONTRIBUTING.md +++ b/packages/components/CONTRIBUTING.md @@ -156,7 +156,7 @@ function Example( A couple of good examples of how hooks are used for composition are: -- the `Card` component, which builds on top of the `Surface` component by [calling the `useSurface` hook inside its own hook](/packages/components/src/card/card/hook.js); +- the `Card` component, which builds on top of the `Surface` component by [calling the `useSurface` hook inside its own hook](/packages/components/src/card/card/hook.ts); - the `HStack` component, which builds on top of the `Flex` component and [calls the `useFlex` hook inside its own hook](/packages/components/src/h-stack/hook.js).