From 5f2a2c0700d0d0309112ff7fd6dc6eb60f7e79c2 Mon Sep 17 00:00:00 2001 From: nmsderp <130254323+nmsderp@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:38:07 +0000 Subject: [PATCH] add turbo mode icon --- src/components/green-flag/green-flag.jsx | 24 ++++++++++++++++++++--- src/components/green-flag/icon--turbo.svg | 1 + 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 src/components/green-flag/icon--turbo.svg diff --git a/src/components/green-flag/green-flag.jsx b/src/components/green-flag/green-flag.jsx index a1a87d378ae..7de7f81c910 100644 --- a/src/components/green-flag/green-flag.jsx +++ b/src/components/green-flag/green-flag.jsx @@ -1,8 +1,9 @@ import classNames from 'classnames'; import PropTypes from 'prop-types'; -import React from 'react'; +import React, { useState, useEffect } from 'react'; import greenFlagIcon from './icon--green-flag.svg'; +import turboFlagIcon from './icon--turbo.svg'; import styles from './green-flag.css'; const GreenFlagComponent = function (props) { @@ -13,6 +14,20 @@ const GreenFlagComponent = function (props) { title, ...componentProps } = props; + + const [showTurboFlag, setShowTurboFlag] = useState(false); + + useEffect(() => { + const searchParams = new URLSearchParams(window.location.search); + setShowTurboFlag(searchParams.has('turbo')); + }, []); + + const handleShiftClick = (event) => { + if (event.shiftKey) { + setShowTurboFlag(prevState => !prevState); + } + }; + return ( ); }; + GreenFlagComponent.propTypes = { active: PropTypes.bool, className: PropTypes.string, onClick: PropTypes.func.isRequired, title: PropTypes.string }; + GreenFlagComponent.defaultProps = { active: false, title: 'Go' }; + export default GreenFlagComponent; diff --git a/src/components/green-flag/icon--turbo.svg b/src/components/green-flag/icon--turbo.svg new file mode 100644 index 00000000000..749fc3522e6 --- /dev/null +++ b/src/components/green-flag/icon--turbo.svg @@ -0,0 +1 @@ + \ No newline at end of file