WordPress / wordpress.org

WordPress.org Meta, Git-ified. Synced from git://meta.git.wordpress.org/ This repository is just a mirror of the WordPress Meta subversion repository. Please include a link to a pre-existing ticket on https://meta.trac.wordpress.org/ with every pull request.
https://meta.trac.wordpress.org/
109 stars 140 forks source link

Plugin Directory: Use the shared favorite button for favoriting plugins #350

Closed ryelle closed 1 month ago

ryelle commented 1 month ago

This updates the single plugin page to use the Favorite block, and so that the buttons lined up correctly I've also switched the plugin action buttons (download, preview) to use button blocks as well. Download is now primary, with preview as an outline button, to prevent double primary buttons.

The focus state was also a little rough on the favorite block, so I've copied in the default focus styles from themes & patterns, which does update the style in the content as well (videos at the end to show before/after).

Before After
Favorited
Unfavorited

Focus states, before

https://github.com/user-attachments/assets/0e70b899-eae4-4bca-bcc5-1af0f3355621

Focus states, after

https://github.com/user-attachments/assets/b6665ad6-87c2-478c-8d26-a23a80be3d9e

To test

If you're not logged in, the button is not visible.

StevenDufresne commented 1 month ago

I tested this on my sandbox. It works as expected. It's a bit slow to change states and doesn't have an indicator. Do you think we need a loading state?

Screen Capture on 2024-07-18 at 10-47-35

ryelle commented 1 month ago

I tested this on my sandbox. It works as expected. It's a bit slow to change states and doesn't have an indicator. Do you think we need a loading state?

I think that's just the sandbox. Do you think it needs a loading state on the other sites? It's already in place on themes & patterns.

ryelle commented 1 month ago

I tried it out on themes again and it's pretty quick, but not quite instant. And it could probably use something for slower connections. What do you think of this fade animation?

https://github.com/user-attachments/assets/052851c6-ba61-437e-814b-22a9698241c8

That's using a delay to mimic a 2s load time. A faster example just barely has the fade, but it also adds a nice touch IMO:

https://github.com/user-attachments/assets/85728f80-e99f-4d37-b74f-0279b95ef5cd

StevenDufresne commented 1 month ago

That's a neat animation. 👍

I say we go for it!

ryelle commented 1 month ago

Committed in r13913.