From abc16cf02527d081008d8ff130233652f9225c59 Mon Sep 17 00:00:00 2001 From: ayushbha Date: Tue, 12 May 2020 17:24:38 -0700 Subject: [PATCH] Modified ChooseProject --- src/components/Student/Module/ProjectModal.js | 117 +++++++++--------- 1 file changed, 58 insertions(+), 59 deletions(-) diff --git a/src/components/Student/Module/ProjectModal.js b/src/components/Student/Module/ProjectModal.js index 5c18d42..2de5699 100644 --- a/src/components/Student/Module/ProjectModal.js +++ b/src/components/Student/Module/ProjectModal.js @@ -13,20 +13,24 @@ import { chooseProjects } from '../../../redux/actions/studentData' import withApiCache, { CACHE_ACTIVITY } from '../../HOC/WithApiCache' const WacProject = withApiCache([CACHE_ACTIVITY])( - ({ wac_data: [project], setListView, setSelectedProject }) => { + ({ wac_data: [project], setSelectedProject,selectedProject }) => { const { image, name, summary, time } = project ?? {} - + //setting default project + if(project!=undefined){ + if(selectedProject==null){ + setSelectedProject(project) + } + } return ( { - setListView(false) setSelectedProject(project) }} /> @@ -41,9 +45,18 @@ const StyledTwoPanel = styled(TwoPanel)` const LeftPanel = styled.div` margin: 0 auto; padding: 1.5em 2.5em 2.5em; - background-color: ${props => props.theme.font}; + background-color: ${props => props.theme.bgVariant}; color: ${props => props.theme.fontInvert}; - height: 100%; + height: auto; + min-height:100%; + display: flex; + flex-direction: column; +` +const RightPanel = styled.div` + margin: 0 auto; + height:100%; + padding: 4em 4em 4em 4em; + background-color: white; display: flex; flex-direction: column; ` @@ -51,11 +64,9 @@ const LeftPanel = styled.div` const FullImg = styled.div` width: 100%; height: 100%; - - background: transparent url(${props => props.img}); - background-size: auto 100%; + background: transparent url(${props => props.img}) no-repeat; + background-size: 100%; background-position: center; - @media screen and (orientation: portrait) and (max-width: ${sizes.thone}px) { background-size: 100% auto; } @@ -64,45 +75,26 @@ const FullImg = styled.div` background-size: 100% auto; } ` - -const Back = styled.p` - cursor: pointer; - display: inline-block; - transition: ease color 0.15s; - - &:hover { - color: #86c5ff; - } -` - -const SmallText = styled.div` - font-size: 80%; -` - const Nbsp = styled.p` @media screen and (orientation: portrait) and (max-width: ${sizes.thone}px) { display: none; } ` - const FinalProject = ({ open, closed, moduleId, projectIds, chosenProjectIds, - onChooseProjects }) => { const themeContext = useContext(ThemeContext) - const [listView, setListView] = useState(true) const [selectedProject, setSelectedProject] = useState(null) const isChosenAlready = chosenProjectIds?.find( p => p.id === selectedProject?.id ) - const handleClickButton = () => { if (!chosenProjectIds) return @@ -123,60 +115,67 @@ const FinalProject = ({ /** * LIST VIEW */ - const choose = ( - <> -   -

Choose a Project

-

- Choose a Project to practice your newfound knowledge in interactive, - challenging projects. -

- - ) const projects = ( -
+
{projectIds?.map((project, index) => { return ( ) })}
) - + const choose = ( +
+   +

Choose a Project

+

+ Choose a Project to practice your newfound knowledge in interactive, + challenging projects. +

+ {projects} +
+ ) /** * DESCRIPTION VIEW */ const description = ( - <> - setListView(true)}>‹ Back -

{selectedProject?.name}

-

{selectedProject?.description}

- difficulty - + // for author just add one more column next to select button + // selectedProject?.authors +
+ +

{selectedProject?.name}

+

{selectedProject?.description}

+
+
+
Difficulty
+ +
+
{selectedProject?.time && ( - estimated time +
Estimated time
)} - {selectedProject?.time} -
+ {selectedProject?.time} +
+
+
- +
) - const fullPic = - const leftPanel = {listView ? choose : description} - const rightPanel = listView ? projects : fullPic + const leftPanel = {choose} + const rightPanel = {description} return ( - + ) } @@ -186,4 +185,4 @@ const mapDispatchToProps = dispatch => ({ dispatch(chooseProjects(moduleId, project)) }) -export default connect(null, mapDispatchToProps)(FinalProject) +export default connect(null, mapDispatchToProps)(FinalProject) \ No newline at end of file