Skip to content

Commit 9d4cc9f

Browse files
committed
Use as for component specification
withComponent did not work as expected
1 parent 790b87b commit 9d4cc9f

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

client/landing/gutenboarding/onboarding-block/design-selector/design-card.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import classnames from 'classnames';
99
/**
1010
* Internal dependencies
1111
*/
12-
import { Card as CardComponent, CardMedia as CardMediaComponent } from '@wordpress/components';
13-
14-
const Card = CardComponent.withComponent( 'button' );
15-
const CardMedia = CardMediaComponent.withComponent( 'span' );
12+
import { Card, CardMedia } from '@wordpress/components';
1613

1714
const gridWidth = 960;
1815
const srcSet = ( src: string, widths: number[] ) =>
@@ -39,8 +36,9 @@ const DesignCard: FunctionComponent< Props > = ( {
3936
style={ style }
4037
aria-haspopup="dialog"
4138
aria-controls={ dialogId }
39+
as="button"
4240
>
43-
<CardMedia>
41+
<CardMedia as="span">
4442
<img
4543
width={ 480 }
4644
height={ 360 }

client/landing/gutenboarding/onboarding-block/design-selector/page-layout-selector.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,10 @@ import { useSelect, useDispatch } from '@wordpress/data';
99
/**
1010
* Internal dependencies
1111
*/
12-
import {
13-
Card as CardComponent,
14-
CardFooter as CardFooterComponent,
15-
CardMedia as CardMediaComponent,
16-
Icon,
17-
} from '@wordpress/components';
12+
import { Card, CardFooter, CardMedia, Icon } from '@wordpress/components';
1813
import { removeQueryArgs } from '@wordpress/url';
1914
import { STORE_KEY as ONBOARD_STORE } from '../../stores/onboard';
2015

21-
const Card = CardComponent.withComponent( 'button' );
22-
const CardFooter = CardFooterComponent.withComponent( 'span' );
23-
const CardMedia = CardMediaComponent.withComponent( 'span' );
24-
2516
type Template = import('@automattic/data-stores').VerticalsTemplates.Template;
2617

2718
interface Props {
@@ -48,18 +39,19 @@ const PageLayoutSelector: FunctionComponent< Props > = ( { templates } ) => {
4839
'is-selected': pageLayouts.includes( template.slug ),
4940
} ) }
5041
onClick={ () => togglePageLayout( template ) }
42+
as="button"
5143
key={ template.slug }
5244
>
5345
<span className="page-layout-selector__selected-indicator">
5446
<Icon icon="yes" size={ 24 } />
5547
</span>
56-
<CardMedia className="page-layout-selector__card-media">
48+
<CardMedia className="page-layout-selector__card-media" as="span">
5749
<img
5850
alt={ template.description }
5951
src={ removeQueryArgs( template.preview, 'w' ) }
6052
/>
6153
</CardMedia>
62-
<CardFooter className="page-layout-selector__card-footer">
54+
<CardFooter className="page-layout-selector__card-footer" as="span">
6355
{ template.title }
6456
</CardFooter>
6557
</Card>

0 commit comments

Comments
 (0)