Skip to content
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

Add hover state to site thumbnail #357

Merged
merged 10 commits into from
Jul 16, 2024
Merged

Add hover state to site thumbnail #357

merged 10 commits into from
Jul 16, 2024

Conversation

wojtekn
Copy link
Contributor

@wojtekn wojtekn commented Jul 12, 2024

Related to #103

Proposed Changes

I propose adding a hover state to the site thumbnail to let the user open the site by clicking it.

Screenshot 2024-07-12 at 16 01 36

Testing Instructions

  1. Start site
  2. Confirm the new thumbnail hover state works as expected
  3. Click the thumbnail and confirm it opens the site
  4. Stop the site
  5. Confirm there is no hover state anymore

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wojtekn wojtekn requested a review from a team July 12, 2024 14:02
@wojtekn wojtekn self-assigned this Jul 12, 2024
{ ! loading && siteRunning && (
<button
aria-label={ __( 'Open WP Admin' ) }
className={ cx( `relative group` ) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't make the focus state work and it was yellow all the time. How to do it correctly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try using something like Button component that we have: https://github.com/Automattic/studio/blob/trunk/src/components/button.tsx ? It would take care of all these styles including focus so you would not need to manually fix them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, and it was even worse. I've just pushed the fix for the outline issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hahaha, it does not surprise me 😅

Ideally I would love for us to use the components we have instead of adding the button manually but I have not explored this solution in detail.

`opacity-0 group-hover:opacity-90 group-hover:bg-white duration-300 absolute size-full flex justify-center items-center bg-white text-a8c-blueberry`
) }
>
{ __( 'Open Site' ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{ __( 'Open Site' ) }
{ __( 'Open site' ) }

This seems to be the spelling according to the design

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed the letter casing, thanks.

{ ! loading && (
{ ! loading && siteRunning && (
<button
aria-label={ __( 'Open WP Admin' ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

I am finding a bit strange that the aria-label is Open WP admin but the text on the actual thumbnail is Open site. Should we consolidate the two to be consistent there? Perhaps the text on the thumbnail should be Open WP admin if that is what the action of clicking on the thumbnail does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it already when I changed the link to open site frontend instead of WP Admin.


return (
<div className="p-8 flex max-w-3xl">
<div className="w-52 ltr:mr-8 rtl:ml-8 flex-col justify-start items-start gap-8">
<h2 className="mb-3 a8c-subtitle-small">{ __( 'Theme' ) }</h2>
<div
className={ cx(
'w-full min-h-40 max-h-60 overflow-hidden rounded-sm border border-a8c-gray-5 bg-a8c-gray-0 mb-2 flex items-center justify-center',
'w-full min-h-40 max-h-64 rounded-sm border border-a8c-gray-5 bg-a8c-gray-0 mb-2 flex justify-center',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to fix the missing top and bottom thumbnail outline on focus.

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

LGMT 🎊 ! I've added some comments but none should be considered a blocker for this PR.

src/components/content-tab-overview.tsx Outdated Show resolved Hide resolved
src/components/content-tab-overview.tsx Outdated Show resolved Hide resolved
src/components/content-tab-overview.tsx Outdated Show resolved Hide resolved
src/components/content-tab-overview.tsx Outdated Show resolved Hide resolved
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Carlos' suggestions make sense.

I tested the Pr and it looks good. I have two questions:

  1. I think the hover effect should be present even if the server is stopped. In that case we should start the server before opening the browser.
  2. The focus effect should be the same as the hover effect, displaying the open site effect, as shown here Feature Request: Clicking site thumbnail should open site #103 (comment)
Screenshot 2024-07-15 at 16 17 18

Screencast:

U9djHa.mp4

@wojtekn
Copy link
Contributor Author

wojtekn commented Jul 16, 2024

Thanks for testing it!

I think the hover effect should be present even if the server is stopped. In that case, we should start the server before opening the browser.

It may make some sense. However, it would introduce a difference between the 'WP Admin' and 'Open site' buttons and the thumbnail. The buttons in the site header are disabled when the site is not running, and they don't allow the site to start automatically. For those reasons, I would prefer to keep those aligned. What if we displayed the disabled cursor over the thumbnail on a stopped site?

The focus effect should be the same as the hover effect, displaying the open site effect, as shown here #103 (comment)

Thanks, fixed: 8242879

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

Re-tested using the latest changes. It worked as expected 🎊.

@wojtekn wojtekn merged commit 4fe49bd into trunk Jul 16, 2024
10 checks passed
@wojtekn wojtekn deleted the add/site-thumbnail-link branch July 16, 2024 13:19
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the group-focus 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants