-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAY-1604] Global Hover Visibility Prop (#3905)
**What does this PR do?** - Create a `visibility` hover prop (like background, shadow, and scale) that hides the component unless it or the group component is hovered over - Use opacity of 0 for hidden state and animate to 1 when hovered over - Add to Hover doc - Refactor Group Hover doc to use background and visibility **Screenshots:** Screenshots to visualize your addition/change <img width="1188" alt="Screenshot 2024-11-13 at 2 45 09 PM" src="https://github.com/user-attachments/assets/c38af90f-b017-4199-8493-0f39a2fd8344"> <img width="1163" alt="Screenshot 2024-11-13 at 2 45 17 PM" src="https://github.com/user-attachments/assets/06e6c430-6369-4c5e-97a2-8cd3dd7248b0"> **How to test?** Steps to confirm the desired behavior: 1. Review /visual_guidelines/hover 2. Review /visual_guidelines/group_hover 3. Make sure the Card kit's background works as normal #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review.
- Loading branch information
Showing
6 changed files
with
134 additions
and
42 deletions.
There are no files selected for viewing
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
61 changes: 42 additions & 19 deletions
61
playbook-website/app/views/pages/code_snippets/group_hover_jsx.txt
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 |
---|---|---|
@@ -1,21 +1,44 @@ | ||
<Card | ||
cursor="pointer" | ||
groupHover | ||
background="neutral_subtle" | ||
cursor="pointer" | ||
groupHover | ||
hover={{ background: "info_subtle" }} | ||
padding="sm" | ||
> | ||
<Title | ||
alignSelf="center" | ||
groupHover | ||
hover={{ scale: "lg"}} | ||
text="If the card is hovered, I'm hovered too!" | ||
/> | ||
<Title | ||
alignSelf="center" | ||
paddingY="lg" | ||
text="I don't have any hover effect on me" | ||
/> | ||
<Title | ||
alignSelf="center" | ||
hover={{ scale: "lg"}} | ||
text="I need to be hovered over directly" | ||
/> | ||
</Card> | ||
<Flex align="center" justify="between"> | ||
<Flex align="center"> | ||
{/* Individual hover effects show when hovered over directly */} | ||
<Avatar | ||
hover={{ scale: "lg" }} | ||
imageAlt="Anna Black" | ||
imageUrl="https://randomuser.me/api/portraits/women/44.jpg" | ||
marginRight="xs" | ||
name="Anna Black" | ||
size="md" | ||
/> | ||
<User | ||
align="center" | ||
name="Anna Black" | ||
orientation="horizontal" | ||
size="md" | ||
title="Remodeling Consultant" | ||
/> | ||
</Flex> | ||
|
||
{/* Group hover effects show when the outside card is hovered over */} | ||
<Card | ||
background="product_4_highlight" | ||
borderRadius="rounded" | ||
borderNone | ||
hover={{ visibility: true }} | ||
padding="xs" | ||
groupHover | ||
> | ||
<Flex align="center"> | ||
<Title dark size={4} marginRight="xs">Promote</Title> | ||
<Icon icon="trophy" color="text_dk_default" fixedWidth /> | ||
<Icon icon="chevron-right" color="text_dk_default" fixedWidth /> | ||
</Flex> | ||
</Card> | ||
</Flex> | ||
</Card> |
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
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