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

Commit

Permalink
feat(StorybookLink): add size prop
Browse files Browse the repository at this point in the history
  • Loading branch information
talkor committed Dec 4, 2023
1 parent d92bb61 commit 9110754
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/storybook-link/storybook-link.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { FC, useEffect, useState } from 'react';
import Link from '../link/link';
import Link, { LinkProps } from '../link/link';
import { hrefTo } from '@storybook/addon-links';
import { LinkSize } from '../link/LinkConstants';
import { withStaticProps } from '../../types';

interface StorybookLinkProps {
interface StorybookLinkProps extends LinkProps {
page: string;
children: string;
story?: string;
}

const StorybookLink: FC<StorybookLinkProps> = ({ page, story = '', children }) => {
const StorybookLink: FC<StorybookLinkProps> & { sizes?: typeof LinkSize } = ({ page, story = '', children, size }) => {
const [url, setUrl] = useState('');

useEffect(() => {
Expand All @@ -20,10 +22,10 @@ const StorybookLink: FC<StorybookLinkProps> = ({ page, story = '', children }) =
}, []);

return (
<Link href={url} target={Link.targets.TOP} withoutSpacing>
<Link href={url} target={Link.targets.TOP} withoutSpacing size={size}>
{children}
</Link>
);
};

export default StorybookLink;
export default withStaticProps(StorybookLink, { sizes: LinkSize });

0 comments on commit 9110754

Please sign in to comment.