Skip to content

Commit

Permalink
Merge pull request #54 from contacto-io/bugs/cnto-6410/footer-props
Browse files Browse the repository at this point in the history
[CNTO-6410] - add footer props to control footer rendering in modal
  • Loading branch information
samuellawerentz committed Jun 15, 2023
2 parents 031bc57 + bd5beda commit 8327842
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"registry": "https://npm.pkg.github.com"
},
"repository": "git://github.com/contacto-io/contacto-console",
"version": "0.4.90",
"version": "0.4.91",
"main": "build/index.js",
"module": "build/index.es.js",
"files": [
Expand Down
12 changes: 9 additions & 3 deletions src/components/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const FooterBlock = (props) => {
<Block
className="contacto-modal-footer-block"
display="flex"
justifyContent={props.footerJustify || 'space-between'}
justifyContent={'space-between'}
{...props}
>
{props.children}
</Block>
Expand All @@ -28,6 +29,7 @@ export const Modal = ({
okButtonProps,
cancelButtonProps,
width,
footerProps = {},
...props
}) => {
return (
Expand All @@ -37,10 +39,10 @@ export const Modal = ({
width={width}
footer={
footerButtons?.length ? (
<FooterBlock>{footerButtons.map((button) => button)}</FooterBlock>
<FooterBlock {...footerProps}>{footerButtons.map((button) => button)}</FooterBlock>
) : (
(okButtonProps || cancelButtonProps) && (
<FooterBlock>
<FooterBlock {...footerProps}>
<Button
{...cancelButtonProps}
label={cancelButtonProps?.label || 'Cancel'}
Expand All @@ -67,6 +69,10 @@ Modal.propTypes = {
* To Remove the footer, pass null values to both okButtonProps and cancelButtonProps
*/
footerButtons: PropTypes.array,
/**
* Props for the footer, default to {}
*/
footerProps: PropTypes.object,
/**
* Props for the default Okay button
*/
Expand Down

0 comments on commit 8327842

Please sign in to comment.