Skip to content

Commit 37aa948

Browse files
committed
feat(ui): refactor SkipToContentButton to use children prop instead of label
1 parent 8e83b4e commit 37aa948

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

apps/site/components/withNavBar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ const WithNavBar: FC = () => {
5656
<div>
5757
<WithBanner section="index" />
5858

59-
<SkipToContentButton label={t('components.common.skipToContent')} />
59+
<SkipToContentButton>
60+
{t('components.common.skipToContent')}
61+
</SkipToContentButton>
6062

6163
<NavBar
6264
navItems={navigationItems.map(([, { label, link, target }]) => ({

packages/ui-components/src/Common/SkipToContentButton/index.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type Meta = MetaObj<typeof SkipToContentButton>;
77

88
export const Default: Story = {
99
args: {
10-
label: 'Skip to content',
10+
children: 'Skip to content',
1111
},
1212
};
1313

packages/ui-components/src/Common/SkipToContentButton/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import type { FC, AnchorHTMLAttributes } from 'react';
1+
import type { FC, AnchorHTMLAttributes, PropsWithChildren } from 'react';
22

33
import styles from './index.module.css';
44

5-
type SkipToContentButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
6-
label: string;
7-
};
5+
type SkipToContentButtonProps = PropsWithChildren<
6+
AnchorHTMLAttributes<HTMLAnchorElement>
7+
>;
88

99
const SkipToContentButton: FC<SkipToContentButtonProps> = ({
10-
label,
10+
children,
1111
href = '#main',
1212
...props
1313
}) => {
1414
return (
1515
<a href={href} className={styles.skipToContent} {...props}>
16-
{label}
16+
{children}
1717
</a>
1818
);
1919
};

0 commit comments

Comments
 (0)