-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fuselage): Modal improves (#776)
Co-authored-by: Tasso Evangelista <[email protected]> Co-authored-by: dougfabris <[email protected]> Co-authored-by: Guilherme Gazzo <[email protected]>
- Loading branch information
1 parent
615ebd4
commit 7660993
Showing
12 changed files
with
258 additions
and
60 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
138 changes: 138 additions & 0 deletions
138
packages/fuselage/src/components/Modal/Modal.stories.tsx
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,138 @@ | ||
import { action } from '@storybook/addon-actions'; | ||
import React from 'react'; | ||
|
||
import { Button, Modal } from '../..'; | ||
|
||
export default { | ||
title: 'Containers/Modal', | ||
component: Modal, | ||
parameters: { | ||
jest: ['Modal/Modal.spec.tsx'], | ||
}, | ||
}; | ||
|
||
export const Default = () => ( | ||
<Modal> | ||
<Modal.Header> | ||
<Modal.HeaderText> | ||
<Modal.Title>Modal Header</Modal.Title> | ||
</Modal.HeaderText> | ||
<Modal.Close /> | ||
</Modal.Header> | ||
<Modal.Content>Modal Body</Modal.Content> | ||
<Modal.Footer> | ||
<Modal.FooterControllers> | ||
<Button>Cancel</Button> | ||
<Button primary onClick={action('click')}> | ||
Submit | ||
</Button> | ||
</Modal.FooterControllers> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
|
||
export const _WithThumb = () => ( | ||
<Modal> | ||
<Modal.Header> | ||
<Modal.Thumb url='data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==' /> | ||
<Modal.HeaderText> | ||
<Modal.Title>Modal Header</Modal.Title> | ||
</Modal.HeaderText> | ||
<Modal.Close /> | ||
</Modal.Header> | ||
<Modal.Content>Modal Body</Modal.Content> | ||
<Modal.Footer> | ||
<Modal.FooterControllers> | ||
<Button>Cancel</Button> | ||
<Button primary onClick={action('click')}> | ||
Submit | ||
</Button> | ||
</Modal.FooterControllers> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
|
||
export const _WithIcon = () => ( | ||
<Modal> | ||
<Modal.Header> | ||
<Modal.Icon name='info' /> | ||
<Modal.HeaderText> | ||
<Modal.Title>Modal Header</Modal.Title> | ||
</Modal.HeaderText> | ||
<Modal.Close /> | ||
</Modal.Header> | ||
<Modal.Content>Modal Body</Modal.Content> | ||
<Modal.Footer> | ||
<Modal.FooterControllers> | ||
<Button>Cancel</Button> | ||
<Button primary onClick={action('click')}> | ||
Submit | ||
</Button> | ||
</Modal.FooterControllers> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
|
||
export const _WithTagline = () => ( | ||
<Modal> | ||
<Modal.Header> | ||
<Modal.HeaderText> | ||
<Modal.Tagline>Tagline</Modal.Tagline> | ||
<Modal.Title>Modal Header</Modal.Title> | ||
</Modal.HeaderText> | ||
<Modal.Close /> | ||
</Modal.Header> | ||
<Modal.Content>Modal Body</Modal.Content> | ||
<Modal.Footer> | ||
<Modal.FooterControllers> | ||
<Button>Cancel</Button> | ||
<Button primary onClick={action('click')}> | ||
Submit | ||
</Button> | ||
</Modal.FooterControllers> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
|
||
export const _WithIconAndTagline = () => ( | ||
<Modal> | ||
<Modal.Header> | ||
<Modal.Icon alignItems='end' name='info' /> | ||
<Modal.HeaderText> | ||
<Modal.Tagline>Tagline</Modal.Tagline> | ||
<Modal.Title>Modal Header</Modal.Title> | ||
</Modal.HeaderText> | ||
<Modal.Close /> | ||
</Modal.Header> | ||
<Modal.Content>Modal Body</Modal.Content> | ||
<Modal.Footer> | ||
<Modal.FooterControllers> | ||
<Button>Cancel</Button> | ||
<Button primary onClick={action('click')}> | ||
Submit | ||
</Button> | ||
</Modal.FooterControllers> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
|
||
export const _WithAnnotation = () => ( | ||
<Modal> | ||
<Modal.Header> | ||
<Modal.HeaderText> | ||
<Modal.Title>Modal Header</Modal.Title> | ||
</Modal.HeaderText> | ||
<Modal.Close /> | ||
</Modal.Header> | ||
<Modal.Content>Modal Body</Modal.Content> | ||
<Modal.Footer justifyContent='space-between'> | ||
<Modal.FooterAnnotation>Anototation</Modal.FooterAnnotation> | ||
<Modal.FooterControllers> | ||
<Button>Cancel</Button> | ||
<Button primary onClick={action('click')}> | ||
Submit | ||
</Button> | ||
</Modal.FooterControllers> | ||
</Modal.Footer> | ||
</Modal> | ||
); |
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
12 changes: 12 additions & 0 deletions
12
packages/fuselage/src/components/Modal/ModalFooterAnnotation.tsx
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,12 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import Box from '../Box'; | ||
|
||
export type ModalFooterAnnotationProps = ComponentProps<typeof Box>; | ||
|
||
export const ModalFooterAnnotation = ({ | ||
children, | ||
}: ModalFooterAnnotationProps) => ( | ||
<Box rcx-modal__footer-annotation>{children}</Box> | ||
); |
14 changes: 14 additions & 0 deletions
14
packages/fuselage/src/components/Modal/ModalFooterControllers.tsx
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,14 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import { ButtonGroup } from '..'; | ||
|
||
export type ModalFooterControllersProps = ComponentProps<typeof ButtonGroup>; | ||
|
||
export const ModalFooterControllers = ({ | ||
children, | ||
}: ModalFooterControllersProps) => ( | ||
<ButtonGroup medium align='end'> | ||
{children} | ||
</ButtonGroup> | ||
); |
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
15 changes: 15 additions & 0 deletions
15
packages/fuselage/src/components/Modal/ModalHeaderText.tsx
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,15 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import Box from '../Box'; | ||
|
||
export type ModalHeaderTextProps = ComponentProps<typeof Box>; | ||
|
||
export const ModalHeaderText = ({ | ||
children, | ||
...props | ||
}: ModalHeaderTextProps) => ( | ||
<Box rcx-modal__header-text {...props}> | ||
{children} | ||
</Box> | ||
); |
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,10 +1,20 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import Box from '../Box'; | ||
import { Icon } from '../Icon'; | ||
|
||
export type ModalIconProps = ComponentProps<typeof Icon>; | ||
export type ModalIconProps = ComponentProps<typeof Box> & { | ||
name: ComponentProps<typeof Icon>['name']; | ||
}; | ||
|
||
export const ModalIcon = ({ size = 'x24', ...props }: ModalIconProps) => ( | ||
<Icon {...props} size={size} /> | ||
export const ModalIcon = ({ | ||
size = 'x24', | ||
name, | ||
alignItems = 'center', | ||
...props | ||
}: ModalIconProps) => ( | ||
<Box {...props} display='flex' alignItems={alignItems}> | ||
<Icon mb='x4' name={name} size={size} /> | ||
</Box> | ||
); |
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,12 @@ | ||
import type { ComponentProps } from 'react'; | ||
import React from 'react'; | ||
|
||
import Box from '../Box'; | ||
|
||
export type ModalTaglineProps = ComponentProps<typeof Box>; | ||
|
||
export const ModalTagline = ({ children, ...props }: ModalTaglineProps) => ( | ||
<Box rcx-modal__tagline {...props}> | ||
{children} | ||
</Box> | ||
); |
Oops, something went wrong.