-
Notifications
You must be signed in to change notification settings - Fork 30
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
Onboarding task card behavior on hover #1169
Onboarding task card behavior on hover #1169
Conversation
rinagobo
commented
Jun 5, 2023
- Added &.hovered to the style of OnboardingCardContainer in StyledOnboardingCard.js
- Created highlight function for OnboardingCard component when it's hovered
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at comments below, let me know once you've made the changes.
return ( | ||
<OnboardingCardContainer completed = {completed}> | ||
<OnboardingCardContainer completed = {completed} className={isActive ? 'hovered' : ''} onMouseEnter={detectHover} onMouseLeave={detectHover}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a hover effect, you don't need to actually create the functionality to know whether someone has hovered over an html element/tag. There is a CSS selector you can use to easily do this. have a look at this to see how: https://www.w3schools.com/cssref/sel_hover.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted.
@@ -62,6 +62,10 @@ export const OnboardingCardContainer = styled.div` | |||
background: ${props => props.completed ? '#E2E2E2' : 'white'}; | |||
box-shadow: ${props => props.completed ? '' : '0px 10px 18px 10px rgba(127, 126, 127, 0.25)'}; | |||
margin-bottom: 15px; | |||
|
|||
&.hovered { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use CSS psuedo selector instead, i've already pasted a link on another comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified code using css hover selector.
@@ -12,8 +12,12 @@ export default function OnboardingCard({ | |||
subtitle, | |||
completed, | |||
}) { | |||
const [isActive, setIsActive] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this logic once CSS applied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted.
@@ -12,8 +12,12 @@ export default function OnboardingCard({ | |||
subtitle, | |||
completed, | |||
}) { | |||
const [isActive, setIsActive] = useState(false); | |||
const detectHover = event => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awsome work, looks good.