Skip to content

feat(Button): add microanimation to favorites button#7379

Merged
mcoker merged 6 commits intopatternfly:mainfrom
srambach:6601-favorites-button
Mar 12, 2025
Merged

feat(Button): add microanimation to favorites button#7379
mcoker merged 6 commits intopatternfly:mainfrom
srambach:6601-favorites-button

Conversation

@srambach
Copy link
Copy Markdown
Member

@srambach srambach commented Mar 5, 2025

Fixes #6601

.pf-m-favorite added to button, and then .pf-m-favorited to indicate that it's been marked as favorite.

I also snuck in a docs line for the .pf-m-notify
Separate commits to do the animation piece, then guard against the old way (in menu and table) and then update examples to use the new way.

Also, I think the table is using the wrong color for the favorite buttons - it uses --pf-t--global--color--favorite--clicked and I think it should be --pf-t--global--color--favorite--default (but I did not change this current behavior) So you'll see a difference in the icon color since I've switched the examples to use the new button variant.

Here's one on the table showing the hover, focused, and un- and then favorited states. You'll see the animation when the buttons is marked as .pf-m-favorited

2025-03-06_15-45-15.mp4

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Mar 5, 2025

Copy link
Copy Markdown
Collaborator

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timing looks much better. I'm happy if you are @kaylachumley

Copy link
Copy Markdown

@kaylachumley kaylachumley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy!!! very niceeee

Copy link
Copy Markdown
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think there is a dupe var block in button unless that's on purpose. Otherwise just little nits.

Comment on lines +318 to +321
--#{$button}--m-favorite__icon--TransitionDuration: var(--pf-t--global--motion--duration--icon--default);
--#{$button}--m-favorite__icon--TransitionTimingFunction: var(--pf-t--global--motion--timing-function--default);
--#{$button}--m-favorited__icon--AnimationDuration: var(--pf-t--global--motion--duration--icon--long);
--#{$button}--m-favorited__icon--AnimationTimingFunction: var(--pf-t--global--motion--timing-function--default);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to include these here as well as in the var list above?


@keyframes #{$button}-icon-favorited {
50% {
transform: scale(1.5); // make a variable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanna go ahead and make this a var since it has design approval?

| `.pf-m-progress` | `.pf-v6-c-button` | Indicates that the button supports the progress state. **Note:** Not used with the plain variation. |
| `.pf-m-in-progress` | `.pf-v6-c-button` | Indicates that the button is in the in progress state. |
| `.pf-m-stateful` | `.pf-v6-c-button` | Indicates that the button is used for one of read, unread, and attention states. **Note:** Always use with a modifier of `.pf-m-read`, `.pf-m-unread`, or `.pf-m-attention`. |
| `.pf-m-notify` | `.pf-v6-c-button` | Indicates that the button should show the user notification of an event. **Note:** This is intended for use with a bell icon in the Notification Badge. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
| `.pf-m-notify` | `.pf-v6-c-button` | Indicates that the button should show the user notification of an event. **Note:** This is intended for use with a bell icon in the Notification Badge. |
| `.pf-m-notify` | `.pf-v6-c-button` | Indicates that the button should show the user notification of an event. **Note:** This is intended for use with a bell icon in the notification badge. |


// TODO: standardize icon fitting
// - Menu item action
// TODO in breaking change - remove button styling here that is taken care of by favorite button no
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐

Suggested change
// TODO in breaking change - remove button styling here that is taken care of by favorite button no
// TODO in breaking change - remove button styling here that is taken care of by favorite button now

&.pf-m-favorited,
&.pf-m-favorited:hover,
&.pf-m-favorited .#{$button} {
&.pf-m-favorited .#{$button}:not(.pf-m-favorited) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine but we could see if react wants to remove .pf-m-favorited from menu__item-action since it will be on the button now - then we wouldn't need to modify this rule.

Copy link
Copy Markdown
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAD TO THE MAX!!!

@mcoker mcoker merged commit 69b09e3 into patternfly:main Mar 12, 2025
4 checks passed
@patternfly-build
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.2.0-prerelease.20 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icon buttons: Create motions for Favorite, Settings and stateful buttons

5 participants