Skip to content

Commit

Permalink
✨ feat: isLargeプロパティを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
takashi0602 committed Dec 28, 2023
1 parent ab6c59b commit a746b83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/components/base/TextLink/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export const TextLink: Story = {
target="_blank" TextLink
</BaseTextLink>
</dd>
<dt style={{ color: 'white' }}>isLarge=&quot;true&quot;</dt>
<dd style={{ marginBottom: '16px' }}>
<BaseTextLink href={pagesPath.$url()} isLarge={true}>
isLarge=&quot;true&quot; TextLink
</BaseTextLink>
</dd>
</dl>
),
};
9 changes: 7 additions & 2 deletions src/components/base/TextLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import clsx from 'clsx';
import NextLink, { type LinkProps } from 'next/link';

import { getSafeLinkRel } from '@/utils/getSafeLinkRel';
Expand All @@ -16,6 +17,10 @@ type BaseProps = {
* <TextLink href={pagesPath.$url()}>link text</TextLink>
*/
href: LinkProps['href'];
/**
* 文字サイズを大きくするかどうか
*/
isLarge?: boolean;
/**
* リンクのコンテンツ
*/
Expand All @@ -24,11 +29,11 @@ type BaseProps = {

type Props = BaseProps & Omit<ComponentPropsWithoutRef<'a'>, keyof BaseProps>;

const TextLink: FC<Props> = ({ href, children, rel, target, ...props }) => {
const TextLink: FC<Props> = ({ href, isLarge = false, children, rel, target, ...props }) => {
return (
<NextLink
{...props}
className={styles.link}
className={clsx(styles.link, isLarge && styles.large)}
href={href}
rel={getSafeLinkRel(rel, target)}
target={target}
Expand Down
8 changes: 8 additions & 0 deletions src/components/base/TextLink/styles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ const styles = {
textDecoration: 'underline',
},
]),
large: sprinkles({
fontSize: {
mobile: 24,
desktop: 36,
},
fontWeight: 'bold',
lineHeight: 1.3,
}),
};

export { styles };

0 comments on commit a746b83

Please sign in to comment.