-
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-1587] Group hover Global Prop (#3833)
**What does this PR do?** A clear and concise description with your runway ticket url. Runway https://runway.powerhrg.com/backlog_items/PLAY-1587 This story adds a new global prop, Group Hover When you add the `group_hover` prop to a kit and the children inside that kit. The children's hover effects will take place when the parent is hovered. You just need to pass the `group_hover: true` or `groupHover` global prop to the parent and children(s) **Screenshots:** Screenshots to visualize your addition/change ![Screenshot 2024-10-31 at 11 11 30 AM](https://github.com/user-attachments/assets/7f119416-8b72-4e5c-b9e9-a7e5732273eb) **How to test?** Steps to confirm the desired behavior: 1. Go to https://pr3833.playbook.beta.gm.powerapp.cloud/visual_guidelines/group_hover 2. hover over the card/text in the card to see the different behaviors #### 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. - [😈] **TESTS** I have added test coverage to my code.
- Loading branch information
1 parent
c69799d
commit 95eef34
Showing
8 changed files
with
134 additions
and
45 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
49 changes: 49 additions & 0 deletions
49
playbook-website/app/javascript/components/VisualGuidelines/Examples/GroupHover.tsx
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-disable flowtype/no-types-missing-file-annotation */ | ||
|
||
import React from 'react' | ||
|
||
import { | ||
Card, | ||
Title, | ||
} from 'playbook-ui' | ||
|
||
import Example from '../Templates/Example' | ||
|
||
const GroupHoverDescription = () => ( | ||
<> | ||
You can hover over a kit and its children's hover affects will be applied. Check out <a href="https://playbook.powerapp.cloud/visual_guidelines/hover">{"our hover affects here."}</a> | ||
</> | ||
) | ||
|
||
const GroupHover = ({ example }: {example: string}) => ( | ||
<Example | ||
backgroundClass='group-hover-class' | ||
description={<GroupHoverDescription />} | ||
example={example} | ||
title="Group Hover" | ||
> | ||
<Card | ||
cursor="pointer" | ||
groupHover | ||
> | ||
<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> | ||
</Example> | ||
) | ||
|
||
export default GroupHover |
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
21 changes: 21 additions & 0 deletions
21
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Card | ||
cursor="pointer" | ||
groupHover | ||
> | ||
<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> |
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,51 +1,54 @@ | ||
@import "../tokens/exports/scale.module"; | ||
|
||
@mixin hover-color-classes($colors-list) { | ||
@each $name, $color in $colors-list { | ||
.hover_background_#{"" + $name}:hover { | ||
background-color: $color !important; | ||
transition: background-color $transition-speed ease; | ||
} | ||
.hover_color_#{"" + $name}:hover { | ||
color: $color !important; | ||
transition: color $transition-speed ease; | ||
} | ||
@mixin hover-scale-classes($scales-list) { | ||
@each $name, $scale in $scales-list { | ||
.hover_#{"" + $name}:hover, | ||
.group_hover:hover .group_hover.hover_#{"" + $name} { | ||
transform: $scale; | ||
transition: transform $transition-speed ease; | ||
} | ||
} | ||
|
||
@mixin hover-shadow-classes($shadows-list) { | ||
@each $name, $shadow in $shadows-list { | ||
.hover_#{"" + $name}:hover { | ||
box-shadow: $shadow; | ||
transition: box-shadow $transition-speed ease; | ||
} | ||
} | ||
|
||
@mixin hover-shadow-classes($shadows-list) { | ||
@each $name, $shadow in $shadows-list { | ||
.hover_#{"" + $name}:hover, | ||
.group_hover:hover .group_hover.hover_#{"" + $name} { | ||
box-shadow: $shadow; | ||
transition: box-shadow $transition-speed ease; | ||
} | ||
} | ||
|
||
@mixin hover-scale-classes($scales-list) { | ||
@each $name, $scale in $scales-list { | ||
.hover_#{"" + $name}:hover { | ||
transform: $scale; | ||
transition: transform $transition-speed ease; | ||
} | ||
} | ||
|
||
@mixin hover-color-classes($colors-list) { | ||
@each $name, $color in $colors-list { | ||
.hover_background_#{"" + $name}:hover, | ||
.group_hover:hover .group_hover.hover_background_#{"" + $name} { | ||
background-color: $color !important; | ||
transition: background-color $transition-speed ease; | ||
} | ||
.hover_color_#{"" + $name}:hover, | ||
.group_hover:hover .group_hover.hover_color_#{"" + $name} { | ||
color: $color !important; | ||
transition: color $transition-speed ease; | ||
} | ||
} | ||
@include hover-scale-classes($scales); | ||
@include hover-shadow-classes($box_shadows); | ||
@include hover-color-classes($product_colors); | ||
@include hover-color-classes($status_colors); | ||
@include hover-color-classes($data_colors); | ||
@include hover-color-classes($shadow_colors); | ||
@include hover-color-classes($colors); | ||
@include hover-color-classes($interface_colors); | ||
@include hover-color-classes($main_colors); | ||
@include hover-color-classes($background_colors); | ||
@include hover-color-classes($card_colors); | ||
@include hover-color-classes($active_colors); | ||
@include hover-color-classes($action_colors); | ||
@include hover-color-classes($hover_colors); | ||
@include hover-color-classes($border_colors); | ||
@include hover-color-classes($text_colors); | ||
@include hover-color-classes($category_colors); | ||
} | ||
|
||
@include hover-scale-classes($scales); | ||
@include hover-shadow-classes($box_shadows); | ||
@include hover-color-classes($product_colors); | ||
@include hover-color-classes($status_colors); | ||
@include hover-color-classes($data_colors); | ||
@include hover-color-classes($shadow_colors); | ||
@include hover-color-classes($colors); | ||
@include hover-color-classes($interface_colors); | ||
@include hover-color-classes($main_colors); | ||
@include hover-color-classes($background_colors); | ||
@include hover-color-classes($card_colors); | ||
@include hover-color-classes($active_colors); | ||
@include hover-color-classes($action_colors); | ||
@include hover-color-classes($hover_colors); | ||
@include hover-color-classes($border_colors); | ||
@include hover-color-classes($text_colors); | ||
@include hover-color-classes($category_colors); |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ export default [ | |
"right", | ||
"top", | ||
"hover", | ||
"groupHover", | ||
"zIndex", | ||
"verticalAlign", | ||
"truncate", | ||
|
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