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

fix: typography component updates #497

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
168 changes: 70 additions & 98 deletions src/components/general/Typography/Link.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,74 @@
import { type Meta } from '@storybook/react'
import { type StoryObj } from '@storybook/react'
import { Space } from 'src/components'
import type { Meta } from '@storybook/react'
import type { StoryObj } from '@storybook/react'
import { Flex, Icon, Space, Tooltip } from 'src/components'
import { Typography } from 'src/components/general/Typography/Typography'
import { ExampleStory } from 'src/utils/ExampleStory'
import { TypographyColors } from './colors'

const meta: Meta<typeof Typography.Link> = {
title: 'Components/General/Link',
title: 'Components/General/Typography/Link',
component: props => <Typography.Link {...props}>Example Link</Typography.Link>,

args: {
children: 'Example Text',
type: undefined,
color: undefined,
size: 'base',
code: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hooray! 🎉

copyable: false,
delete: false,
disabled: false,
editable: false,
ellipsis: false,
keyboard: false,
mark: false,
strong: false,
italic: false,
type: undefined,
underline: false,
onClick: (event: React.MouseEvent) => {
console.log('Link Clicked')
},
},
argTypes: {
children: {
control: 'text',
name: 'text',
},
type: {
control: 'select',
options: ['secondary', 'success', 'warning', 'danger'],
},
size: {
control: 'select',
options: ['base', 'sm', 'lg', 'xl'],
},
color: {
control: 'select',
options: TypographyColors,
},
copyable: {
control: 'boolean',
},
delete: {
control: 'boolean',
},
disabled: {
control: 'boolean',
},
editable: {
control: 'boolean',
},
ellipsis: {
control: 'boolean',
},
mark: {
control: 'boolean',
},
strong: {
control: 'boolean',
},
italic: {
control: 'boolean',
},
code: {
control: 'boolean',
},
},
}
export default meta
Expand All @@ -43,95 +82,28 @@ type Story = StoryObj<typeof Typography.Link>

export const Primary: Story = {}

export const Code: Story = {
args: {
code: true,
},
}

export const Copyable: Story = {
args: {
copyable: true,
},
}

export const Deleted: Story = {
args: {
delete: true,
},
}

export const Disabled: Story = {
args: {
disabled: true,
},
}

export const Editable: Story = {
args: {
editable: true,
},
}

export const Keyboard: Story = {
args: {
keyboard: true,
},
}

export const Marked: Story = {
args: {
mark: true,
},
}

export const Strong: Story = {
args: {
strong: true,
},
}

export const Italic: Story = {
args: {
italic: true,
},
}

export const Success: Story = {
args: {
type: 'success',
},
}

export const Secondary: Story = {
args: {
type: 'secondary',
},
}

export const Warning: Story = {
args: {
type: 'warning',
},
}

export const Danger: Story = {
args: {
type: 'danger',
},
}

export const Underline: Story = {
args: {
underline: true,
},
}

export const CustomOnClick: Story = {
args: {
onClick: event => {
alert('Custom Click Handler')
},
export const InsideTooltip: Story = {
render: () => {
return (
<ExampleStory title="Link inside a Tooltip">
<Flex align="center" gap={2}>
<Typography.Text>Typography inside of a tooltip, hover icon to see</Typography.Text>
<Tooltip
title={
<>
<Typography.Text tooltip>
Help lorem ipsum{' '}
<Typography.Link href="/" tooltip>
Learn More
</Typography.Link>
</Typography.Text>
</>
}>
<Icon name="help" size="sm" />
</Tooltip>
</Flex>
</ExampleStory>
)
},
}

Expand Down
147 changes: 47 additions & 100 deletions src/components/general/Typography/Paragraph.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Meta } from '@storybook/react'
import { type StoryObj } from '@storybook/react'
import type { Meta } from '@storybook/react'
import type { StoryObj } from '@storybook/react'
import { Typography } from 'src/components/general/Typography/Typography'
import { ExampleStory } from 'src/utils/ExampleStory'
import { useMemo } from 'react'
Expand All @@ -8,12 +8,16 @@ import { Radio } from 'src/components'
import { Switch } from 'src/components'
import { Slider } from 'src/components'
import { Icon } from 'src/components'
import { TypographyColors } from './colors'

const meta: Meta<typeof Typography.Paragraph> = {
title: 'Components/General/Typography.Paragraph',
title: 'Components/General/Typography/Paragraph',
component: props => <Typography.Paragraph {...props}>Paragraph text goes here</Typography.Paragraph>,

args: {
children: 'Example Text',
type: undefined,
color: undefined,
size: 'base',
code: false,
copyable: false,
delete: false,
Expand All @@ -23,17 +27,52 @@ const meta: Meta<typeof Typography.Paragraph> = {
mark: false,
strong: false,
italic: false,
type: undefined,
underline: false,
onClick: event => {
console.log('Paragraph Clicked')
},
},
argTypes: {
children: {
control: 'text',
name: 'text',
},
type: {
control: 'select',
options: ['secondary', 'success', 'warning', 'danger'],
},
size: {
control: 'select',
options: ['base', 'sm', 'lg', 'xl'],
},
color: {
control: 'select',
options: TypographyColors,
},
copyable: {
control: 'boolean',
},
delete: {
control: 'boolean',
},
disabled: {
control: 'boolean',
},
editable: {
control: 'boolean',
},
ellipsis: {
control: 'boolean',
},
mark: {
control: 'boolean',
},
strong: {
control: 'boolean',
},
italic: {
control: 'boolean',
},
code: {
control: 'boolean',
},
},
}
export default meta
Expand All @@ -47,98 +86,6 @@ type Story = StoryObj<typeof Typography.Paragraph>

export const Primary: Story = {}

export const Code: Story = {
args: {
code: true,
},
}

export const Copyable: Story = {
args: {
copyable: true,
},
}

export const DeletedLine: Story = {
args: {
delete: true,
},
}

export const Disabled: Story = {
args: {
disabled: true,
},
}

export const Editable: Story = {
args: {
editable: true,
},
}

export const Ellipsis: Story = {
args: {
ellipsis: true,
},
}

export const Marked: Story = {
args: {
mark: true,
},
}

export const Strong: Story = {
args: {
strong: true,
},
}

export const Italic: Story = {
args: {
italic: true,
},
}

export const Success: Story = {
args: {
type: 'success',
},
}

export const Secondary: Story = {
args: {
type: 'secondary',
},
}

export const Warning: Story = {
args: {
type: 'warning',
},
}

export const Danger: Story = {
args: {
type: 'danger',
},
}

export const Underline: Story = {
args: {
underline: true,
},
}

export const CustomOnClick: Story = {
args: {
onClick: event => {
alert('Custom Click Handler')
},
},
}

export const ExampleEditable: Story = {
render: () => {
const [editableStr, setEditableStr] = useState('This is an editable text.')
Expand Down
Loading
Loading