-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ModalFooter): basic modal footer (#2463)
- Loading branch information
1 parent
97d81fa
commit b18754a
Showing
8 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
packages/core/src/components/ModalNew/footers/ModalFooter/ModalFooter.module.scss
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 @@ | ||
.primary { | ||
order: 2; | ||
|
||
&:only-child { | ||
margin-left: auto; | ||
} | ||
} | ||
|
||
.secondary { | ||
order: 1; | ||
margin-left: auto; | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/core/src/components/ModalNew/footers/ModalFooter/ModalFooter.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,32 @@ | ||
import React, { forwardRef } from "react"; | ||
import cx from "classnames"; | ||
import ModalFooterBase from "../ModalFooterBase/ModalFooterBase"; | ||
import { getTestId } from "../../../../tests/test-ids-utils"; | ||
import { ComponentDefaultTestId } from "../../../../tests/constants"; | ||
import { ModalFooterProps } from "./ModalFooter.types"; | ||
import styles from "./ModalFooter.module.scss"; | ||
|
||
const ModalFooter = forwardRef( | ||
( | ||
{ primaryButton, secondaryButton, renderSideAction, "data-testid": dataTestId, className, id }: ModalFooterProps, | ||
ref: React.ForwardedRef<HTMLDivElement> | ||
) => { | ||
const primary = { ...primaryButton, className: cx(primaryButton.className, styles.primary) }; | ||
const secondary = secondaryButton | ||
? { ...secondaryButton, className: cx(secondaryButton.className, styles.secondary) } | ||
: undefined; | ||
return ( | ||
<ModalFooterBase | ||
ref={ref} | ||
className={className} | ||
id={id} | ||
data-testid={dataTestId || getTestId(ComponentDefaultTestId.MODAL_NEXT_FOOTER, id)} | ||
primaryButton={primary} | ||
secondaryButton={secondary} | ||
renderAction={renderSideAction} | ||
/> | ||
); | ||
} | ||
); | ||
|
||
export default ModalFooter; |
6 changes: 6 additions & 0 deletions
6
packages/core/src/components/ModalNew/footers/ModalFooter/ModalFooter.types.ts
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,6 @@ | ||
import React from "react"; | ||
import { ModalFooterBaseProps } from "../ModalFooterBase/ModalFooterBase.types"; | ||
|
||
export interface ModalFooterProps extends Omit<ModalFooterBaseProps, "renderAction"> { | ||
renderSideAction?: React.ReactNode; | ||
} |
File renamed without changes.
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
File renamed without changes.
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