Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Fix ExternalLinkCard story (#5256)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunyatasattva committed Dec 1, 2021
1 parent 59e1573 commit 3b90c4b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 23 deletions.
15 changes: 9 additions & 6 deletions assets/js/editor-components/external-link-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ import { VisuallyHidden } from '@wordpress/components';
*/
import './editor.scss';

export interface ExternalLinkCardProps {
href: string;
title: string;
description?: string;
}

/**
* Show a link that displays a title, description, and optional icon. Links are opened in a new tab.
* Show a link that displays a title, description, and an icon showing that the link is external.
* Links are opened in a new tab.
*/
const ExternalLinkCard = ( {
href,
title,
description,
}: {
href: string;
title: string;
description?: string;
} ): JSX.Element => {
}: ExternalLinkCardProps ): JSX.Element => {
return (
<a
href={ href }
Expand Down
17 changes: 0 additions & 17 deletions assets/js/editor-components/external-link-card/stories/index.js

This file was deleted.

27 changes: 27 additions & 0 deletions assets/js/editor-components/external-link-card/stories/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* External dependencies
*/
import { Story, Meta } from '@storybook/react';

/**
* Internal dependencies
*/
import ExternalLinkCard, { ExternalLinkCardProps } from '..';

export default {
title: 'WooCommerce Blocks/editor-components/ExternalLinkCard',
component: ExternalLinkCard,
} as Meta< ExternalLinkCardProps >;

const Template: Story< ExternalLinkCardProps > = ( args ) => (
<ExternalLinkCard { ...args } />
);

export const Default = Template.bind( {} );
Default.args = {
description:
'This is the description of the link, perhaps a bit of a longer paragraph or a summary of a blog post, or whatever could give more context',
href:
'https://woocommerce.com/posts/seven-tips-to-extend-holiday-sales-momentum/',
title: 'Seven tips to extend holiday sales momentum',
};

0 comments on commit 3b90c4b

Please sign in to comment.