Skip to content

Commit

Permalink
Merge pull request #45 from Ekta29yadav/ui-designs
Browse files Browse the repository at this point in the history
Task #0000 - domain carousel
  • Loading branch information
paritshivani authored Apr 4, 2024
2 parents 4472f03 + 928aedf commit 23e06c4
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/nulp_elite/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import DomainList from "pages/search/DomainList";
import Registrationnew from "pages/registration/Registration";
import Registrationold from "pages/registration/Registrationold";
import ContentList from "pages/search/ContentList";
import LearningHistory from "pages/profile/learningHistory";

function App() {
// const [t] = useTranslation();
Expand Down Expand Up @@ -79,6 +80,11 @@ function App() {
path: "profile/certificate",
component: Certificate,
},
{
moduleName: "nulp_elite",
path: "profile/learningHistory",
component: LearningHistory,
},
{
moduleName: "nulp_elite",
path: "/help",
Expand Down
118 changes: 118 additions & 0 deletions packages/nulp_elite/src/components/domainCarousel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import * as React from 'react';
import AspectRatio from '@mui/joy/AspectRatio';
import Box from '@mui/joy/Box';
import Typography from '@mui/joy/Typography';
import Card from '@mui/joy/Card';
import Button from '@mui/joy/Button';
import { NavigateBefore, NavigateNext } from '@mui/icons-material';
import Carousel from 'react-multi-carousel';
import 'react-multi-carousel/lib/styles.css';

export default function DomainCarousel({ domain }) {
const containerRef = React.useRef(null);
const [activeIndex, setActiveIndex] = React.useState(0);

const handleScroll = (scrollOffset) => {
if (containerRef.current) {
containerRef.current.scrollLeft += scrollOffset;
}
};

const handlePrev = () => {
setActiveIndex((prevIndex) => Math.max(prevIndex - 1, 0));
};

const handleNext = () => {
setActiveIndex((prevIndex) => Math.min(prevIndex + 1, domain.length - 1));
};

const handleDotClick = (index) => {
setActiveIndex(index);
};

return (

<Box
sx={{
position: 'relative',
overflow: 'hidden',
width: '100%',
}}
>
<Box
ref={containerRef}
sx={{
display: 'flex',
gap: 1,
py: 1,
overflow: 'auto',
scrollSnapType: 'x mandatory',
'& > *': {
scrollSnapAlign: 'center',
},
'::-webkit-scrollbar': { display: 'none' },
}}
>

{domain.map((item, index) => (
<Box key={index} orientation="horizontal" size="sm" variant="outlined" style={{display:'flex'}}>
<Box style={{background:'#fff',padding:'10px',borderRadius:'10px',height:'45px',width:'45px',border:'solid 1px #E1E1E1'}}>
<img src={require("../assets/swm.png")} style={{width:'40px',objectFit:'contain'}} alt={item.name} />
</Box>
<Box sx={{ alignSelf:'center',padding:'0 19px 0 5px' }}>
<Typography level="title-md">{item.name}</Typography>
</Box>
</Box>
))}
</Box>
<Box
sx={{
position: 'absolute',
top: '50%',
transform: 'translateY(-50%)',
display: 'flex',
justifyContent: 'space-between',
width: '100%',
px: 2,
}}
>
<Button
disabled={activeIndex === 0}
onClick={handlePrev}
startIcon={<NavigateBefore />}
sx={{ alignSelf: 'center' }}
>
Prev
</Button>
<Box
sx={{
display: 'flex',
gap: 1,
}}
>
{domain.map((_, index) => (
<Box
key={index}
sx={{
width: 8,
height: 8,
borderRadius: '50%',
backgroundColor: activeIndex === index ? 'primary.main' : 'grey.500',
cursor: 'pointer',
}}
onClick={() => handleDotClick(index)}
/>
))}
</Box>
<Button
disabled={activeIndex === domain.length - 1}
onClick={handleNext}
endIcon={<NavigateNext />}
sx={{ alignSelf: 'center' }}
>
Next
</Button>
</Box>
</Box>
);
}
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import{changeLanguage} from "i18next";


const pages = ['Content', 'Connections', 'Profile'];
const settings = ['Profile', 'Account', 'Logout'];
const settings = ['Profile', 'Help', 'Logout'];


function Header( ) {
Expand Down
1 change: 1 addition & 0 deletions packages/nulp_elite/src/pages/profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Profile = () => {

<Box textAlign="center" padding="10">
<Card sx={{marginTop:'10px', padding:'10px',boxShadow: '0px 4px 4px 0px #00000040' }}>

<Box sx={{ display: 'flex', flexDirection: 'row', justifyContent:'space-between' }}>
<Box style={{display:'flex',alignItems:'center'}}><PersonIcon style={{paddingRight:'10px',fontSize:'28px'}}/>{t("ABOUT_ME")} </Box>
<ModeEditIcon/>
Expand Down
91 changes: 91 additions & 0 deletions packages/nulp_elite/src/pages/profile/learningHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Profile.js

import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import Footer from "components/Footer";
import Header from "components/header";
import Container from '@mui/material/Container';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import SimCardDownloadOutlinedIcon from '@mui/icons-material/SimCardDownloadOutlined';
import Link from '@mui/material/Link';
import Grid from '@mui/material/Grid';
import data from "../../assets/certificates.json";
import DescriptionOutlinedIcon from '@mui/icons-material/DescriptionOutlined';
import Breadcrumbs from "@mui/material/Breadcrumbs";
import Card from '@mui/material/Card';


const LearningHistory = () => {
const { t } = useTranslation();

return (
<div>
<Header/>

<Container maxWidth="xxl" role="main" className="container-pb">

<Box textAlign="center" padding="10">
<Breadcrumbs
aria-label="breadcrumb"
style={{
padding: "25px 0",
fontSize: "16px",
fontWeight: "600",
}}
>
<Link underline="hover" color="#004367" href="/">
{t("MY_PROFILE")}
</Link>
<Link
underline="hover"
href=""
aria-current="page"
color="#484848"
>
{t("CERTIFICATES")}
</Link>
</Breadcrumbs>
<Card style={{padding:'20px',textAlign:'left'}}>
<Box style={{display:'flex',alignItems:'end'}}>
<DescriptionOutlinedIcon/> {t("CERTIFICATES")}

</Box>
<Grid container spacing={2} style={{ textAlign: 'left', paddingTop: '10px' }} >

{data.result && data.result.response.content && data.result.response.content.map((faqIndex) => (
<Grid item xs={12} md={4} key={faqIndex._id}>
<Card sx={{ marginTop: '10px', padding: '10px',borderRadius:'10px',border:'solid 1px #EFEFEF',boxShadow:'none',color:'#484848' }}>
<Typography className="twoLineEllipsis" variant="subtitle1" color="text.secondary" component="div" style={{ fontSize: '14px', paddingBottom: '15px',height:'42px',fontWeight:'600' }}>
{faqIndex._source.data.badge.name}
</Typography>
<Typography variant="subtitle1" color="text.secondary" component="div" style={{ fontSize: '12px' }}>
{t("CERTIFICATE_GIVEN_BY")}: {faqIndex._source.data.badge.issuer.name}
</Typography>
<Typography variant="subtitle1" color="text.secondary" component="div" style={{ fontSize: '12px' }}>
{t("CERTIFICATE_ISSUE_DATE")}: -{faqIndex._source.data.issuedOn}
</Typography>
<Box style={{ display: 'flex', alignItems: 'end', color: '#1976d2' }}>
<SimCardDownloadOutlinedIcon />
<Link href="{faqIndex._source.pdfUrl}" underline="none" style={{ fontSize: '12px', marginTop: '15px', display: 'block' }}>{t("CERTIFICATES")} </Link>
</Box>
</Card>

</Grid>
))}
</Grid>




</Card>
</Box>
</Container>
<Footer/>

</div>

);
};

export default LearningHistory;
1 change: 1 addition & 0 deletions packages/nulp_elite/src/pages/search/ContentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const ContentList = (props) => {

<Container maxWidth="xxl" role="main" className="container-pb">
<Box style={{ margin: "20px 0" }}>
<domainCarousel></domainCarousel>
<Filter
options={gradeLevels}
label="Filter by Grade Level"
Expand Down
12 changes: 10 additions & 2 deletions packages/nulp_elite/src/pages/search/DomainList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { frameworkService } from "@shiksha/common-lib";
import { generatePath, useNavigate ,useLocation} from "react-router-dom";
import Footer from "../../components/Footer";
import { contentService } from "@shiksha/common-lib";
import DomainCarousel from "components/domainCarousel";


const Item = styled(Paper)(({ theme }) => ({
Expand Down Expand Up @@ -111,6 +112,7 @@ const DomainList = () => {
console.log(term);
navigate('/search/contentList', { state: { domain: term.code } });
}
console.log(frameworkHardCodedData.result.framework.categories[0].terms);
return (
<div>
<Header/>
Expand All @@ -126,20 +128,26 @@ const DomainList = () => {
<ThemeProvider theme={theme}>
<Typography variant="h3" sx={{ marginTop: '30px' }}>Filter by popular domain</Typography>
</ThemeProvider>
<DomainCarousel domain={frameworkHardCodedData.result.framework.categories[0].terms}></DomainCarousel>
{/* <DomainCarousel data={data.framework.categories[0].terms}></DomainCarousel> */}

<Box sx={{paddingTop:'30px'}}>
{data && data.framework && data.framework.categories && data.framework.categories.map((faqIndex) => (
// {frameworkHardCodedData.result.framework.categories.map((faqIndex) => (
{/* {data && data.framework && data.framework.categories && data.framework.categories.map((faqIndex) => ( */}
{frameworkHardCodedData.result.framework.categories.map((faqIndex) => (
<Grid container spacing={2} style={{margin:'20px 0',marginBottom:'10px'}} key={faqIndex}>
{faqIndex.terms.map(term => (

<Grid item xs={12} md={6} lg={3} style={{marginBottom:'10px'}}>

<Box onClick={() => loadContents(term)} style={{display:'flex', flexDirection:'row', alignItems:'center'}} key={faqIndex.id}>
<Box style={{background:'#fff',padding:'10px',borderRadius:'10px',height:'48px',width:'48px',border:'solid 1px #E1E1E1'}}><img src={require("../../assets/swm.png")} style={{width:'100%'}} /></Box>
<h5 style={{fontSize:'14px',fontWeight:'500',paddingLeft:'10px',margin:'0'}}>{term.name}</h5>
</Box>
</Grid>

))}
</Grid>

))}
</Box>
</Container>
Expand Down

0 comments on commit 23e06c4

Please sign in to comment.