Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Modal): refactored modal for better customization (#85)
BREAKING CHANGE: removed all props in favor of passing in subcomponents
- Loading branch information
1 parent
75d203a
commit a24406c
Showing
5 changed files
with
136 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
import { IComponentBaseProps } from '../types' | ||
|
||
type ModalActionsProps = React.HTMLAttributes<HTMLDivElement> & | ||
IComponentBaseProps | ||
|
||
const ModalActions = React.forwardRef<HTMLDivElement, ModalActionsProps>(({ | ||
children, | ||
className, | ||
...props | ||
}, ref) => { | ||
const classes = twMerge('modal-action', className) | ||
return ( | ||
<div | ||
{...props} | ||
className={classes} | ||
ref={ref} | ||
> | ||
{children} | ||
</div> | ||
) | ||
}) | ||
|
||
ModalActions.displayName = "ModalActions" | ||
|
||
export default ModalActions |
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,23 @@ | ||
import React from 'react' | ||
|
||
type ModalBodyProps = React.HTMLAttributes<HTMLDivElement> | ||
|
||
const ModalBody = React.forwardRef<HTMLDivElement, ModalBodyProps>(({ | ||
children, | ||
className, | ||
...props | ||
}, ref) => { | ||
return ( | ||
<div | ||
{...props} | ||
className={className} | ||
ref={ref} | ||
> | ||
{children} | ||
</div> | ||
) | ||
}) | ||
|
||
ModalBody.displayName = "ModalBody" | ||
|
||
export default ModalBody |
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,25 @@ | ||
import React from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
type ModalHeaderProps = React.HTMLAttributes<HTMLDivElement> | ||
|
||
const ModalHeader = React.forwardRef<HTMLDivElement, ModalHeaderProps>(({ | ||
children, | ||
className, | ||
...props | ||
}, ref) => { | ||
const classes = twMerge('w-full mb-8 text-xl', className) | ||
return ( | ||
<div | ||
{...props} | ||
className={classes} | ||
ref={ref} | ||
> | ||
{children} | ||
</div> | ||
) | ||
}) | ||
|
||
ModalHeader.displayName = "ModalHeader" | ||
|
||
export default ModalHeader |