Skip to content

Commit

Permalink
Add stories for ContactButton
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus committed Jan 16, 2025
1 parent 96a275e commit 04b19a7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
33 changes: 33 additions & 0 deletions packages/components/src/components/contact-us.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Meta, StoryObj } from '@storybook/react';
import { hiveThemeDecorator } from '../../../../.storybook/hive-theme-decorator';
import {
ContactButton,
ContactButtonProps,
ContactTextLink,
ContactTextLinkProps,
} from './contact-us';

export default {
title: 'Components/ContactUs',
component: ContactButton,
decorators: [hiveThemeDecorator],
parameters: {
padding: true,
},
} satisfies Meta<ContactButtonProps>;

export const Default: StoryObj<ContactButtonProps> = {
name: 'ContactButton',
args: {
// `children` is optional
children: 'Contact us',
},
};

export const TextLink: StoryObj<ContactTextLinkProps> = {
name: 'ContactTextLink',
render: args => <ContactTextLink {...args} />,
args: {
children: 'Reach out to us about the Enterprise plan',
},
};
11 changes: 6 additions & 5 deletions packages/components/src/components/contact-us.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const openCrisp = (event: React.MouseEvent<HTMLAnchorElement>) => {
}
};

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

export function ContactTextLink(props: ContactTextLinkProps) {
return (
Expand All @@ -31,9 +31,10 @@ export function ContactTextLink(props: ContactTextLinkProps) {
);
}

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

export function ContactButton(props: ContactButtonProps) {
return (
Expand Down

0 comments on commit 04b19a7

Please sign in to comment.