-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(components): refactor modal for web (app and pd) (#17193)
* refactor(components): refactor modal for web (app and pd)
- Loading branch information
Showing
6 changed files
with
96 additions
and
112 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,52 +1,36 @@ | ||
import type * as React from 'react' | ||
import { PrimaryButton, StyledText } from '../atoms' | ||
import { SPACING } from '../ui-style-constants' | ||
import { Flex } from '../primitives' | ||
import { JUSTIFY_END } from '../styles' | ||
import { Modal as ModalComponent } from './Modal' | ||
|
||
import { LegacyStyledText } from '../atoms' | ||
import { SPACING, TYPOGRAPHY } from '../ui-style-constants' | ||
import { PrimaryBtn } from '../primitives' | ||
import { COLORS } from '../helix-design-system' | ||
import { Modal } from './Modal' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import type { Story, Meta } from '@storybook/react' | ||
|
||
export default { | ||
const meta: Meta<typeof ModalComponent> = { | ||
title: 'Library/Molecules/modals/Modal', | ||
component: Modal, | ||
} as Meta | ||
|
||
const Template: Story<React.ComponentProps<typeof Modal>> = args => ( | ||
<Modal {...args} /> | ||
) | ||
component: ModalComponent, | ||
} | ||
export default meta | ||
type Story = StoryObj<typeof ModalComponent> | ||
const bodyText = 'Modal body goes here' | ||
|
||
const Children = ( | ||
<> | ||
<LegacyStyledText | ||
fontWeight={TYPOGRAPHY.fontWeightSemiBold} | ||
fontSize={TYPOGRAPHY.fontSizeP} | ||
paddingTop={SPACING.spacing4} | ||
> | ||
{'Modal body goes here'} | ||
</LegacyStyledText> | ||
<StyledText desktopStyle="bodyDefaultRegular">{bodyText}</StyledText> | ||
) | ||
|
||
<PrimaryBtn | ||
backgroundColor={COLORS.blue50} | ||
marginTop="28rem" | ||
textTransform={TYPOGRAPHY.textTransformNone} | ||
> | ||
<LegacyStyledText | ||
fontWeight={TYPOGRAPHY.fontWeightRegular} | ||
fontSize={TYPOGRAPHY.fontSizeP} | ||
> | ||
{'btn text'} | ||
</LegacyStyledText> | ||
</PrimaryBtn> | ||
</> | ||
const Footer = ( | ||
<Flex justifyContent={JUSTIFY_END} padding={SPACING.spacing24}> | ||
<PrimaryButton onClick={() => {}}>{'btn text'}</PrimaryButton> | ||
</Flex> | ||
) | ||
|
||
export const Primary = Template.bind({}) | ||
Primary.args = { | ||
type: 'info', | ||
onClose: () => {}, | ||
closeOnOutsideClick: false, | ||
title: 'Modal Title', | ||
children: Children, | ||
export const Modal: Story = { | ||
args: { | ||
type: 'info', | ||
onClose: () => {}, | ||
closeOnOutsideClick: false, | ||
title: 'Modal Title', | ||
children: Children, | ||
footer: Footer, | ||
}, | ||
} |
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