Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stories for ContactButton and ContactTextLink #1988

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions packages/components/src/components/contact-us.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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',
variant: 'secondary-inverted',
},
};

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
Loading