-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore(deps): Replace
next-share
with react-share
and add Storyboo…
…k stories for Social component (#1390) * chore(deps): remove `next-share` dependency and add `react-share` dependency * refactor: replace `next-share` with `react-share` for social sharing buttons * feat: add Storybook stories for Social component with various configurations * test: update Social component tests to use FontAwesome icons instead of test IDs
- Loading branch information
1 parent
39575aa
commit 2c9bc6e
Showing
6 changed files
with
161 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import Social from '@/components/Social/Social'; | ||
import ISocial from '@/types/Social'; | ||
|
||
const meta: Meta<typeof Social> = { | ||
title: 'Components/Social', | ||
component: Social, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<div style={{ width: '100%', padding: '1rem', backgroundColor: '#f5f5f5' }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Social>; | ||
|
||
const defaultSocialProps: ISocial = { | ||
channels: ['facebook', 'twitter', 'whatsapp', 'weibo', 'share', 'clipboard'], | ||
url: 'https://example.com/share', | ||
content: 'Check out this awesome content!', | ||
tags: ['storybook', 'testing', 'react'], | ||
}; | ||
|
||
export const AllChannels: Story = { | ||
args: { | ||
social: defaultSocialProps, | ||
}, | ||
}; | ||
|
||
export const SocialMediaOnly: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
channels: ['facebook', 'twitter', 'whatsapp', 'weibo'], | ||
}, | ||
}, | ||
}; | ||
|
||
export const MinimalChannels: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
channels: ['facebook', 'twitter'], | ||
}, | ||
}, | ||
}; | ||
|
||
export const SystemShareOnly: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
channels: ['share', 'clipboard'], | ||
}, | ||
}, | ||
}; | ||
|
||
export const CustomContent: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
content: '🎉 Amazing news! Join us for this special event!', | ||
tags: ['event', 'special', 'celebration'], | ||
}, | ||
}, | ||
}; | ||
|
||
export const LongUrl: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
url: 'https://example.com/very/long/url/with/multiple/parameters?param1=value1¶m2=value2¶m3=value3', | ||
}, | ||
}, | ||
}; | ||
|
||
export const NoTags: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
tags: [], | ||
}, | ||
}, | ||
}; | ||
|
||
export const SingleChannel: Story = { | ||
args: { | ||
social: { | ||
...defaultSocialProps, | ||
channels: ['facebook'], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters