-
Notifications
You must be signed in to change notification settings - Fork 391
feat(Modal,Backdrop): Add opt-in animation support #12552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GAUNSD
wants to merge
18
commits into
patternfly:main
Choose a base branch
from
GAUNSD:gmurcia/modal-backdrop-animations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2d4c4d8
feat(Modal,Backdrop): Add animation support
GAUNSD bcfd6b4
refactor: Previous ad-hoc animation impl now aligns with standard PF …
GAUNSD df1305e
chore: Cleanup
GAUNSD fa54f31
chore: PR feedback
GAUNSD 014a139
chore: PR feedback
GAUNSD ca4d8f3
chore: PR feedback
GAUNSD cf29347
chore: updates to support new CSS (#1)
mcoker 800a2c8
Merge branch 'main' into gmurcia/modal-backdrop-animations
GAUNSD 5702796
chore: Update to @patternfly/patternfly@npm:6.6.0-prerelease.44
GAUNSD 58ab3a7
fix(Backdrop): Default isVisible to true for standalone backdrops.
GAUNSD 811e1cc
fix(ModalContent): Hide the dialog during its closing transition.
GAUNSD 4ca62ea
fix(ModalContent): Complete the close without transitionend when redu…
GAUNSD 278653c
refactor(Modal): Enable animations on by default
GAUNSD 848cb6b
removed the reduced-motion shortcut that immediately unmounted closin…
GAUNSD 526bde0
chore: Add disabled animations modal example
GAUNSD b2c3320
chore: Remove unnecessary styles (PR feedback)
GAUNSD f3f0779
Merge branch 'gmurcia/modal-backdrop-animations' of github.com:GAUNSD…
GAUNSD 6207f26
chore: Remove unnecessary styles
GAUNSD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,20 +1,39 @@ | ||
| import { css } from '@patternfly/react-styles'; | ||
| import styles from '@patternfly/react-styles/css/components/Backdrop/backdrop'; | ||
| import { useHasAnimations } from '../../helpers'; | ||
|
|
||
| export interface BackdropProps extends React.HTMLProps<HTMLDivElement> { | ||
| /** Content rendered inside the backdrop */ | ||
| children?: React.ReactNode; | ||
| /** Additional classes added to the backdrop */ | ||
| className?: string; | ||
| /** Flag indicating whether animations are enabled. Animations are enabled by default. */ | ||
| hasAnimations?: boolean; | ||
| /** Flag to show the backdrop when animations are enabled. Set to false while the backdrop remains mounted to play its exit transition. */ | ||
| isVisible?: boolean; | ||
| } | ||
|
|
||
| export const Backdrop: React.FunctionComponent<BackdropProps> = ({ | ||
| children = null, | ||
| className = '', | ||
| hasAnimations: hasAnimationsProp = true, | ||
| isVisible = true, | ||
| ...props | ||
| }: BackdropProps) => ( | ||
| <div {...props} className={css(styles.backdrop, className)}> | ||
| {children} | ||
| </div> | ||
| ); | ||
| }: BackdropProps) => { | ||
| const hasAnimations = useHasAnimations(hasAnimationsProp); | ||
|
|
||
| return ( | ||
| <div | ||
| {...props} | ||
| className={css( | ||
| styles.backdrop, | ||
| hasAnimations && styles.modifiers.animate, | ||
| hasAnimations && isVisible && styles.modifiers.show, | ||
| className | ||
| )} | ||
| > | ||
| {children} | ||
| </div> | ||
| ); | ||
| }; | ||
| Backdrop.displayName = 'Backdrop'; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.