Skip to content

Commit 0883f26

Browse files
authored
Add stories for ContactButton and ContactTextLink (#1988)
1 parent 96a275e commit 0883f26

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Meta, StoryObj } from '@storybook/react';
2+
import { hiveThemeDecorator } from '../../../../.storybook/hive-theme-decorator';
3+
import {
4+
ContactButton,
5+
ContactButtonProps,
6+
ContactTextLink,
7+
ContactTextLinkProps,
8+
} from './contact-us';
9+
10+
export default {
11+
title: 'Components/ContactUs',
12+
component: ContactButton,
13+
decorators: [hiveThemeDecorator],
14+
parameters: {
15+
padding: true,
16+
},
17+
} satisfies Meta<ContactButtonProps>;
18+
19+
export const Default: StoryObj<ContactButtonProps> = {
20+
name: 'ContactButton',
21+
args: {
22+
// `children` is optional
23+
children: 'Contact us',
24+
variant: 'secondary-inverted',
25+
},
26+
};
27+
28+
export const TextLink: StoryObj<ContactTextLinkProps> = {
29+
name: 'ContactTextLink',
30+
render: args => <ContactTextLink {...args} />,
31+
args: {
32+
children: 'Reach out to us about the Enterprise plan',
33+
},
34+
};

packages/components/src/components/contact-us.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const openCrisp = (event: React.MouseEvent<HTMLAnchorElement>) => {
1010
}
1111
};
1212

13-
// the errors are more readable if you add an interface for this
14-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
1513
export interface ContactTextLinkProps
16-
extends Omit<React.HTMLAttributes<HTMLAnchorElement>, 'href' | 'onClick'> {}
14+
extends Omit<React.HTMLAttributes<HTMLAnchorElement>, 'href' | 'onClick'> {
15+
children?: React.ReactNode;
16+
}
1717

1818
export function ContactTextLink(props: ContactTextLinkProps) {
1919
return (
@@ -31,9 +31,10 @@ export function ContactTextLink(props: ContactTextLinkProps) {
3131
);
3232
}
3333

34-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
3534
export interface ContactButtonProps
36-
extends Omit<CallToActionProps.AnchorProps, 'onClick' | 'href'> {}
35+
extends Omit<CallToActionProps.AnchorProps, 'onClick' | 'href' | 'children'> {
36+
children?: React.ReactNode;
37+
}
3738

3839
export function ContactButton(props: ContactButtonProps) {
3940
return (

0 commit comments

Comments
 (0)