From c84bb6219f97789d37458c7e6ec660aafd5199f6 Mon Sep 17 00:00:00 2001 From: Kateryna Stetsenko Date: Thu, 19 Sep 2024 19:27:07 -0700 Subject: [PATCH] Updated ChallengeInviteSteps component: - Improved hover behavior for step icons and text. - Changed icons to active on hover and text styles on hover. - Adjusted styles for matching the design prototype. --- .../Navigation/ChallengeInviteSteps.jsx | 303 +++++++++++------- 1 file changed, 183 insertions(+), 120 deletions(-) diff --git a/src/js/common/components/Navigation/ChallengeInviteSteps.jsx b/src/js/common/components/Navigation/ChallengeInviteSteps.jsx index 7e5c41e40..6ad434b10 100644 --- a/src/js/common/components/Navigation/ChallengeInviteSteps.jsx +++ b/src/js/common/components/Navigation/ChallengeInviteSteps.jsx @@ -3,115 +3,53 @@ import { Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import { withStyles } from '@mui/styles'; import commonMuiStyles from '../Style/commonMuiStyles'; -import historyPush from '../../utils/historyPush';//We can use this to navigate to different steps later -import { OuterWrapper, StepCircle, StepNumber, StepWrapper } from '../Style/stepDisplayStyles'; - -// URLs for the steps -const STEP1_URL = '/:challengeSEOFriendlyPath/+/customize-message'; -const STEP2_URL = '/:challengeSEOFriendlyPath/+/copy-message'; - -// Import the rocket ship SVG icon +// Import icons +import RocketIcon from '../../../../img/global/svg-icons/issues/rocket-ship.svg'; import StepOneIcon from '../../../../img/global/svg-icons/issues/material-symbols-counter-1.svg'; +import StepOneActiveIcon from '../../../../img/global/svg-icons/issues/material-symbols-counter-1-active.svg'; import StepTwoIcon from '../../../../img/global/svg-icons/issues/material-symbols-counter-2.svg'; -import RocketIcon from '../../../../img/global/svg-icons/issues/rocket-ship.svg'; +import StepTwoActiveIcon from '../../../../img/global/svg-icons/issues/material-symbols-counter-2-active.svg'; +import historyPush from '../../utils/historyPush'; // We will use this to navigate to different steps later +import { + OuterWrapper, + StepCircle, + StepNumber, + StepWrapper, +} from '../Style/stepDisplayStyles'; -// Styles Object -const styles = { - outerWrapper: { - alignItems: 'center', - backgroundColor: '#F2F2F0', - display: 'flex', - flexDirection: 'column', - padding: '20px', - position: 'relative', - }, - headerContainer: { - alignItems: 'center', - display: 'flex', - justifyContent: 'space-between', - position: 'relative', - textAlign: 'left', - width: '100%', - }, - rocketIcon: { - height: '70px', - position: 'relative', - width: '40px', - }, - headerText: { - flex: '1', - fontFamily: 'Poppins', - fontSize: '28px', - fontWeight: '600', - lineHeight: '35px', - margin: '0 10px', - textAlign: 'left', - }, - verticalLine: { - backgroundColor: '#D2D2D2', - height: '25px', - marginRight: '10px', - width: '1px', - }, - learnMoreLink: { - color: '#0858A1', - fontSize: '16px', - fontWeight: '500', - textDecoration: 'none', - width: '52px', - }, - stepsContainer: { - alignItems: 'flex-start', - display: 'flex', - justifyContent: 'center', - marginTop: '20px', - position: 'relative', - width: '100%', - }, - stepIconContainer: { - alignItems: 'center', - display: 'flex', - flexDirection: 'column', - marginRight: '10px', - zIndex: 1, - }, - stepIcon: { - height: '24px', - marginBottom: '5px', - width: '24px', - }, - stepText: { - fontSize: '16px', - marginBottom: '15px', - textAlign: 'center', - width: '169px', - }, - horizontalLine: { - borderTop: '1px solid #D2D2D2', - left: 'calc(50% - 90px)', - position: 'absolute', - top: '10%', - width: '170px', - zIndex: 0, - }, - }; +// URLs for the steps (Use later for navigation) +const STEP1_URL = '/:challengeSEOFriendlyPath/+/customize-message'; +const STEP2_URL = '/:challengeSEOFriendlyPath/+/copy-message'; + +// Color and font variables +const baseTextColor = '#2A2A2C'; +const hoverFontWeight = '600'; +const defaultFontWeight = '400'; +const fontFamily = 'Poppins'; +const commonTextStyle = { + fontSize: '13px', + lineHeight: '15px', + textAlign: 'center', + fontFamily, +}; // ChallengeInviteSteps component class ChallengeInviteSteps extends React.Component { - constructor(props) { + constructor (props) { super(props); this.state = { step1Completed: false, step2Completed: false, + isHovered1: false, + isHovered2: false, }; } - componentDidMount() { + componentDidMount () { // Status for the steps const step1Completed = false; const step2Completed = false; - this.setState({ step1Completed, step2Completed, @@ -127,58 +65,183 @@ class ChallengeInviteSteps extends React.Component { challengeBasePath = `/+/${challengeWeVoteId}/`; } return challengeBasePath; - } + }; + + // Handle mouse enter and leave events for hover effects + handleMouseEnter = (step) => { + this.setState({ [`isHovered${step}`]: true }); + }; - render() { - const { step1Completed, step2Completed } = this.state; - const { classes, currentStep } = this.props; + handleMouseLeave = (step) => { + this.setState({ [`isHovered${step}`]: false }); + }; + + render () { + const { step1Completed, step2Completed, isHovered1, isHovered2 } = + this.state; return ( - +
{/* Rocket, Invite more friends, and Learn More */} -
- {/* Rocket Icon */} - Rocket Icon - - {/* Title Text */} -

+
+ Rocket Icon +

To boost your ranking, invite your friends to join.

- - {/* Vertical Line and Learn More Link */} -
- {/* Vertical Line */} -
- - {/* Learn More Link */} - + {/* Steps (Step 1, Line, Step 2) */} -
+
{/* Step 1 Icon and Text */} -
- Step 1 Icon - +
this.handleMouseEnter(1)} + onMouseLeave={() => this.handleMouseLeave(1)} + > + Step 1 Icon + Customize the message to your friends
{/* Horizontal Line */} -
+
{/* Step 2 Icon and Text */} -
- Step 2 Icon - +
this.handleMouseEnter(2)} + onMouseLeave={() => this.handleMouseLeave(2)} + > + Step 2 Icon + Copy message & link
- +
); } }