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

Onboarding task card behavior on hover #1169

Merged
merged 2 commits into from
Jun 10, 2023

Conversation

rinagobo
Copy link
Contributor

@rinagobo rinagobo commented Jun 5, 2023

  1. Added &.hovered to the style of OnboardingCardContainer in StyledOnboardingCard.js
  2. Created highlight function for OnboardingCard component when it's hovered

@changeset-bot
Copy link

changeset-bot bot commented Jun 5, 2023

⚠️ No Changeset found

Latest commit: a11dcd8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@judeamos judeamos left a 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}>
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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 => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted.

Copy link
Contributor

@judeamos judeamos left a 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.

@rinagobo rinagobo merged commit f44e438 into development/user-profile Jun 10, 2023
1 check passed
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.

None yet

2 participants