diff --git a/src/App.js b/src/App.js index 4ba5928..2c81abc 100644 --- a/src/App.js +++ b/src/App.js @@ -10,7 +10,6 @@ import { IS_MOBILE, POLICY_PRIVACY_PAGE, } from './utils/globals'; -import Challenge from './pages/Challenge'; import KeyCloakService from './services/KeyCloakService'; import React from 'react'; import LoggedBar from './components/navigation/LoggedBar'; @@ -19,6 +18,7 @@ import Loading from './components/generic/Loading'; import { FlexColumn } from './utils/containers'; import PopupMessage from './components/generic/PopupMessage'; import PolicyPrivacy from './pages/PolicyPrivacy'; +import Challenge from './components/specific_challenge/Challenge'; const App = () => { const [loggedBarVisible, setLoggedBarVisible] = React.useState('100vw'); @@ -104,7 +104,27 @@ const App = () => { } + element={} + /> + } + /> + } + /> + } + /> + } + /> + } /> } /> { +const Challenge = (props) => { const challengeName = useParams().challengeId; const [challenge, setChallenge] = React.useState([]); - const [section, setSection] = React.useState(0); const [loading, setLoading] = React.useState(true); const [user, setUser] = React.useState(''); @@ -30,7 +29,7 @@ const Challenge = () => { }, [challengeName]); const sectionRender = () => { - switch (section) { + switch (props.section) { case 0: return ( {

{challenge.title}

- + { if (!loading) { return ( <> - + theme.shadowRight}; + box-shadow: ${({ theme }) => theme.shadowRight}; `; const Option = styled(FlexColumn)` @@ -24,46 +25,50 @@ 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}; + background-color: ${({ theme, active }) => + active ? theme.colors.green05 : theme.colors.white}; * { cursor: pointer; } &:hover { - background-color: ${({theme}) => theme.colors.green05}; + background-color: ${({ theme }) => theme.colors.green05}; } `; const DesktopChallengeMenu = (props) => { - let options = ['Leaderboard', 'Readme', 'How to']; - if (KeyCloakService.isLoggedIn()) - options = ['Leaderboard', 'Readme', 'How to', 'My entries', 'Submit']; - return ( - - {options.map((option, index) => { - return ( - - ); - })} - - ); + let options = ['Leaderboard', 'Readme', 'How to']; + if (KeyCloakService.isLoggedIn()) + options = ['Leaderboard', 'Readme', 'How to', 'My entries', 'Submit']; + return ( + + {options.map((option, index) => { + return ( + + ); + })} + + ); }; DesktopChallengeMenu.propTypes = { - section: PropsTypes.number, - setSection: PropsTypes.func + section: PropsTypes.number, + setSection: PropsTypes.func, }; DesktopChallengeMenu.defaultProps = { - section: 0, - setSection: null, + section: 0, + setSection: null, }; -export default DesktopChallengeMenu; \ No newline at end of file +export default DesktopChallengeMenu; diff --git a/src/components/specific_challenge/MobileChallengeMenu.js b/src/components/specific_challenge/MobileChallengeMenu.js index bc38b02..9393483 100644 --- a/src/components/specific_challenge/MobileChallengeMenu.js +++ b/src/components/specific_challenge/MobileChallengeMenu.js @@ -27,16 +27,14 @@ const MobileChallengeMenu = (props) => { props.setSection(3)} + to={`${props.challengeName}/${options[3].toLowerCase()}`} > {options[3]} props.setSection(4)} + to={`${props.challengeName}/${options[4].toLowerCase()}`} > {options[4]} @@ -50,24 +48,21 @@ const MobileChallengeMenu = (props) => { props.setSection(0)} + to={`${props.challengeName}/${options[0].toLowerCase()}`} > {options[0]} props.setSection(1)} + to={`${props.challengeName}/${options[1].toLowerCase()}`} > {options[1]} props.setSection(2)} + to={`${props.challengeName}/${options[2].toLowerCase()}`} > {options[2]}