-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rid of the .Plate suffix in components
- Loading branch information
Showing
42 changed files
with
662 additions
and
714 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
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,24 +1,3 @@ | ||
// @flow | ||
|
||
import { CardPlate } from './CardPlate'; | ||
import { CardHeader, cardHeaderTheme } from './CardHeader'; | ||
import { CardBody, cardBodyTheme } from './CardBody'; | ||
import { CardSection, cardSectionTheme } from './CardSection'; | ||
import { CardFooter, cardFooterTheme } from './CardFooter'; | ||
|
||
const Card = { | ||
Plate: CardPlate, | ||
Header: CardHeader, | ||
Body: CardBody, | ||
Section: CardSection, | ||
Footer: CardFooter, | ||
}; | ||
|
||
const theme = { | ||
...cardHeaderTheme, | ||
...cardBodyTheme, | ||
...cardSectionTheme, | ||
...cardFooterTheme, | ||
}; | ||
|
||
export { Card, theme }; | ||
export { Card, theme } from './Card'; |
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,23 +1,111 @@ | ||
import { DialogBody as Body, theme as dialogBodyTheme } from './DialogBody'; | ||
import { DialogFooter as Footer, theme as dialogFooterTheme } from './DialogFooter'; | ||
import { DialogHeader as Header, theme as dialogHeaderTheme } from './DialogHeader'; | ||
import { DialogPlate as Plate, theme as dialogPlateTheme } from './DialogPlate'; | ||
|
||
const Dialog = { | ||
Body, | ||
Footer, | ||
Header, | ||
Plate, | ||
}; | ||
import React from 'react'; | ||
|
||
import { createStyledTag, createComponentTheme } from '../../utils'; | ||
import { Modal } from '../Modal'; | ||
import { Card } from '../Card'; | ||
import type { PropSizes } from '../../types'; | ||
|
||
import { DialogBody, theme as dialogBodyTheme } from './DialogBody'; | ||
import { DialogFooter, theme as dialogFooterTheme } from './DialogFooter'; | ||
import { DialogHeader, theme as dialogHeaderTheme } from './DialogHeader'; | ||
|
||
type DialogPlateProps = {| | ||
children?: React$Node, | ||
isOpen?: boolean, | ||
onClose?: (any) => void, | ||
onOpen?: (any) => void, | ||
shouldCloseOnOverlayClick?: boolean, | ||
shouldCloseOnEscPress ?: boolean, | ||
padding?: PropSizes, | ||
tagName?: string, | ||
|}; | ||
|
||
const name = 'dialog'; | ||
|
||
const dialogTheme = createComponentTheme(name, { | ||
modifiers: { | ||
size: { | ||
xs: { | ||
width: '300px', | ||
}, | ||
sm: { | ||
width: '400px', | ||
}, | ||
md: { | ||
width: '500px', | ||
}, | ||
lg: { | ||
width: '600px', | ||
}, | ||
xl: { | ||
width: '800px', | ||
}, | ||
}, | ||
}, | ||
defaults: { | ||
size: 'md', | ||
padding: 'md', | ||
}, | ||
}); | ||
|
||
const theme = { | ||
...dialogTheme, | ||
...dialogBodyTheme, | ||
...dialogFooterTheme, | ||
...dialogHeaderTheme, | ||
...dialogPlateTheme, | ||
}; | ||
|
||
export { | ||
Dialog, | ||
theme, | ||
const DialogTag = createStyledTag(name, { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
maxHeight: '90%', | ||
flex: '0 1 90%', | ||
}); | ||
|
||
const Dialog = ({ | ||
children, | ||
id, | ||
isOpen, | ||
onOpen, | ||
onClose, | ||
shouldCloseOnOverlayClick, | ||
shouldCloseOnEscPress, | ||
size, | ||
args, | ||
tagName, | ||
...rest | ||
}: DialogPlateProps) => { | ||
return ( | ||
<Modal | ||
id={ id } | ||
isOpen={ isOpen } | ||
onOpen={ onOpen } | ||
onClose={ onClose } | ||
args={ args } | ||
shouldCloseOnOverlayClick={ shouldCloseOnOverlayClick } | ||
shouldCloseOnEscPress={ shouldCloseOnEscPress } | ||
> | ||
{ | ||
({ args, onClose }) => ( | ||
<DialogTag tagName={ tagName } size={ size }> | ||
<Card { ...rest } args={ args } onClose={ onClose }> | ||
{ children } | ||
</Card> | ||
</DialogTag> | ||
) | ||
} | ||
</Modal> | ||
); | ||
}; | ||
|
||
Dialog.defaultProps = { | ||
...dialogTheme[name].defaults, | ||
tagName: 'div', | ||
}; | ||
|
||
Dialog.Body = DialogBody; | ||
Dialog.Header = DialogHeader; | ||
Dialog.Footer = DialogFooter; | ||
|
||
export { Dialog, theme }; |
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
Oops, something went wrong.