aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/buttons
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-21 18:42:19 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-21 19:24:48 +0200
commit4581c262ca06704baaa3c0a172d509207f41f5c3 (patch)
tree45ef2fe8eafbcb3c54d7e4bee708299da40c715c /src/components/molecules/buttons
parent0145e687ccd49da08982f6e281ebcbdcb9ef74a7 (diff)
chore: complete Storybook stories
Diffstat (limited to 'src/components/molecules/buttons')
-rw-r--r--src/components/molecules/buttons/back-to-top.stories.tsx8
-rw-r--r--src/components/molecules/buttons/heading-button.stories.tsx1
-rw-r--r--src/components/molecules/buttons/help-button.stories.tsx8
-rw-r--r--src/components/molecules/buttons/help-button.tsx11
4 files changed, 4 insertions, 24 deletions
diff --git a/src/components/molecules/buttons/back-to-top.stories.tsx b/src/components/molecules/buttons/back-to-top.stories.tsx
index 7d4bc39..a338b8b 100644
--- a/src/components/molecules/buttons/back-to-top.stories.tsx
+++ b/src/components/molecules/buttons/back-to-top.stories.tsx
@@ -1,5 +1,4 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
-import { IntlProvider } from 'react-intl';
import BackToTopComponent from './back-to-top';
/**
@@ -33,13 +32,6 @@ export default {
},
},
},
- decorators: [
- (Story) => (
- <IntlProvider locale="en">
- <Story />
- </IntlProvider>
- ),
- ],
} as ComponentMeta<typeof BackToTopComponent>;
const Template: ComponentStory<typeof BackToTopComponent> = (args) => (
diff --git a/src/components/molecules/buttons/heading-button.stories.tsx b/src/components/molecules/buttons/heading-button.stories.tsx
index d1b5ed4..59f7be9 100644
--- a/src/components/molecules/buttons/heading-button.stories.tsx
+++ b/src/components/molecules/buttons/heading-button.stories.tsx
@@ -1,3 +1,4 @@
+import headingStories from '@components/atoms/headings/heading.stories';
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { useState } from 'react';
import HeadingButtonComponent from './heading-button';
diff --git a/src/components/molecules/buttons/help-button.stories.tsx b/src/components/molecules/buttons/help-button.stories.tsx
index cfc603e..4968b27 100644
--- a/src/components/molecules/buttons/help-button.stories.tsx
+++ b/src/components/molecules/buttons/help-button.stories.tsx
@@ -1,5 +1,4 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
-import { IntlProvider } from 'react-intl';
import HelpButtonComponent from './help-button';
/**
@@ -36,13 +35,6 @@ export default {
},
},
},
- decorators: [
- (Story) => (
- <IntlProvider locale="en">
- <Story />
- </IntlProvider>
- ),
- ],
} as ComponentMeta<typeof HelpButtonComponent>;
const Template: ComponentStory<typeof HelpButtonComponent> = (args) => (
diff --git a/src/components/molecules/buttons/help-button.tsx b/src/components/molecules/buttons/help-button.tsx
index e351453..ccf1ebd 100644
--- a/src/components/molecules/buttons/help-button.tsx
+++ b/src/components/molecules/buttons/help-button.tsx
@@ -3,12 +3,7 @@ import { forwardRef, ForwardRefRenderFunction } from 'react';
import { useIntl } from 'react-intl';
import styles from './help-button.module.scss';
-export type HelpButtonProps = Pick<ButtonProps, 'onClick'> & {
- /**
- * Set additional classnames to the button wrapper.
- */
- className?: string;
-};
+export type HelpButtonProps = Pick<ButtonProps, 'className' | 'onClick'>;
/**
* HelpButton component
@@ -18,7 +13,7 @@ export type HelpButtonProps = Pick<ButtonProps, 'onClick'> & {
const HelpButton: ForwardRefRenderFunction<
HTMLButtonElement,
HelpButtonProps
-> = ({ className = '', onClick }, ref) => {
+> = ({ className = '', ...props }, ref) => {
const intl = useIntl();
const text = intl.formatMessage({
defaultMessage: 'Help',
@@ -29,9 +24,9 @@ const HelpButton: ForwardRefRenderFunction<
return (
<Button
className={`${styles.btn} ${className}`}
- onClick={onClick}
ref={ref}
shape="circle"
+ {...props}
>
<span className="screen-reader-text">{text}</span>
<span className={styles.icon}>?</span>