desktop Challenge menu option background green when active

This commit is contained in:
mattyl006 2022-07-18 11:50:46 +02:00
parent 98f5848993
commit 81fa27c48c
4 changed files with 16 additions and 14 deletions

View File

@ -22,6 +22,7 @@ const Option = styled(FlexColumn)`
width: 100%;
transition: background-color 0.3s ease-in-out;
cursor: pointer;
background-color: ${({theme, active}) => active ? theme.colors.green05 : theme.colors.white};
* {
cursor: pointer;
@ -39,6 +40,7 @@ const DesktopChallengeMenu = (props) => {
{options.map((option, index) => {
return (
<Option key={`challenge_menu_option-${index}`} as='button'
active={index === props.section}
onClick={() => props.setSection(index)}>
<H3 textTransform='uppercase'>
{option}

View File

@ -50,10 +50,10 @@ const MobileNavMenu = (props) => {
<TransBack transition='transform' alignmentX='flex-start' top='42px'
translateY={props.translateY} onClick={props.toggleNavMenu}>
<MobileNavMenuStyle as='ul'>
<FlexRow as={Link} to='/' gap='16px'>
<Svg width='16px' height='16px' src={loginIco}/>
<FlexRow as={Link} to={CHALLENGES_PAGE} gap='16px'>
<Svg width='16px' height='16px' src={cupIco}/>
<Menu as='li'>
Sign in
Challenges
</Menu>
</FlexRow>
<FlexRow as={Link} to='/' gap='16px'>
@ -62,10 +62,10 @@ const MobileNavMenu = (props) => {
Register
</Menu>
</FlexRow>
<FlexRow as={Link} to={CHALLENGES_PAGE} gap='16px'>
<Svg width='16px' height='16px' src={cupIco}/>
<FlexRow as={Link} to='/' gap='16px'>
<Svg width='16px' height='16px' src={loginIco}/>
<Menu as='li'>
Challenges
Sign in
</Menu>
</FlexRow>
</MobileNavMenuStyle>

View File

@ -43,10 +43,10 @@ const NavBar = () => {
<Logo/>
<MenuButton as='button' onClick={toggleNavMenu}/>
<FlexRow as='ul' className='ul-desktop' gap='32px'>
<FlexRow as={Link} to='/' gap='16px'>
<Svg width='16px' height='16px' src={loginIco}/>
<FlexRow as={Link} to={CHALLENGES_PAGE} gap='16px'>
<Svg width='16px' height='16px' src={cupIco}/>
<Menu as='li'>
Sign in
Challenges
</Menu>
</FlexRow>
<FlexRow as={Link} to='/' gap='16px'>
@ -55,10 +55,10 @@ const NavBar = () => {
Register
</Menu>
</FlexRow>
<FlexRow as={Link} to={CHALLENGES_PAGE} gap='16px'>
<Svg width='16px' height='16px' src={cupIco}/>
<FlexRow as={Link} to='/' gap='16px'>
<Svg width='16px' height='16px' src={loginIco}/>
<Menu as='li'>
Challenges
Sign in
</Menu>
</FlexRow>
</FlexRow>

View File

@ -18,7 +18,7 @@ import textIco from "../assets/text_ico.svg";
const Challenge = () => {
const challengeName = useParams().challengeId;
const [challenges, setChallenges] = React.useState([]);
const [section, setSection] = React.useState([0]);
const [section, setSection] = React.useState(0);
React.useEffect(() => {
getChallenges(setChallenges);
@ -67,7 +67,7 @@ const Challenge = () => {
const desktopRender = () => {
return (
<>
<DesktopChallengeMenu setSection={setSection}/>
<DesktopChallengeMenu setSection={setSection} section={section}/>
<FlexColumn minHeight='100vh' alignmentY='flex-start' padding='64px 0 64px 310px'>
<FlexRow gap='32px' margin='0 0 32px 0' padding='16px'>
<FlexColumn alignmentX='flex-start' gap='24px' maxWidth='500px'>