Skip to content

Commit f0d46de

Browse files
committed
merging out standing pull request for demo
2 parents 8fa0385 + 553a704 commit f0d46de

File tree

7 files changed

+29747
-120
lines changed

7 files changed

+29747
-120
lines changed

package-lock.json

Lines changed: 29542 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Content/Content.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import SingleStudentOverview from '../SingleStudentOverview/SingleStudentOvervie
88
import SingleStudentMasteryOverview from '../SingleStudentMasteryOverview/SingleStudentMasteryOverview';
99
import CourseHome from '../CourseHome/CourseHome';
1010
import SingleTargetOverview from '../SingleTargetOverview/SingleTargetOverview';
11-
12-
import './Content.css';
1311
import TaskView from '../../Screens/TaskView/TaskView';
12+
import ClassMastery from '../../Screens/ClassMastery/ClassMastery';
13+
import './Content.css';
1414

1515
export default function Content() {
1616
return (
@@ -43,6 +43,9 @@ export default function Content() {
4343
<Route path="/viewTask">
4444
<TaskView taskId="90e0c730e56" />
4545
</Route>
46+
<Route path="/classMastery">
47+
<ClassMastery />
48+
</Route>
4649
<Route path="/">
4750
<Dashboard />
4851
</Route>

src/Components/SingleStudentMasteryOverview/SingleStudentMasteryOverview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export interface LearningTarget {
9393
learningObjectives: Objective[];
9494
}
9595

96-
export default function SingleStudentMasteryOveriew() {
96+
export default function SingleStudentMasteryOverview() {
9797
const classes = useStyles();
9898
const history = useHistory();
9999
const test: any = history.location.state;

src/Components/constants.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"color": {
3+
"red": "#EA6868",
4+
"yellow": "#F2C94C",
5+
"green": "#30CC30",
6+
"bgGrey": "#C4C4C4",
7+
"textBlack": "#000000",
8+
"textBlue": "#2F80ED"
9+
}
10+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { useState } from 'react';
2+
import styled from 'styled-components';
3+
import { color } from '../../Components/constants.json';
4+
5+
import StudentMasteryRow, { StudentMasteryHeader } from './StudentMasteryRow/StudentMasteryRow';
6+
7+
const Page = styled.div`
8+
margin: 33px 90px;
9+
`;
10+
const Header = styled.div`
11+
color: ${color.textBlue};
12+
font-size: 36px;
13+
font-weight: 550;
14+
margin-bottom: 32px;
15+
`;
16+
17+
const Content = styled.div``;
18+
19+
const MOCK_LOBJ_NAMES = ['Objective 1', 'Objective 2'];
20+
21+
const MOCK_DATA = [
22+
{
23+
name: 'Ryan Fay',
24+
learningObjectives: [
25+
{
26+
objectiveName: 'Objective 1',
27+
percentage: 1,
28+
},
29+
{
30+
objectiveName: 'Objective 2',
31+
percentage: 0.9,
32+
},
33+
],
34+
},
35+
{
36+
name: 'Robert Middleton',
37+
learningObjectives: [
38+
{
39+
objectiveName: 'Objective 1',
40+
percentage: 0.6,
41+
},
42+
{
43+
objectiveName: 'Objective 2',
44+
percentage: 0.7,
45+
},
46+
],
47+
},
48+
{
49+
name: 'Darian Nguyen',
50+
learningObjectives: [
51+
{
52+
objectiveName: 'Objective 1',
53+
percentage: 0.24,
54+
},
55+
{
56+
objectiveName: 'Objective 2',
57+
percentage: 0.14,
58+
},
59+
],
60+
},
61+
];
62+
63+
function ClassMastery() {
64+
//TODO Get real data
65+
return (
66+
<Page>
67+
<Header>Class Mastery</Header>
68+
<Content>
69+
<StudentMasteryHeader learningObjectiveNames={MOCK_LOBJ_NAMES} />
70+
{MOCK_DATA.map(({ name, learningObjectives }) => (
71+
<StudentMasteryRow name={name} learningObjectives={learningObjectives} />
72+
))}
73+
</Content>
74+
</Page>
75+
);
76+
}
77+
78+
export default ClassMastery;
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import { useState } from 'react';
2+
import styled from 'styled-components';
3+
import { color } from '../../../Components/constants.json';
4+
5+
type MasteryBarProps = { percentage: number };
6+
7+
const MasteryBar = styled.div`
8+
position: relative;
9+
border-radius: 11px;
10+
background-color: ${color.bgGrey};
11+
overflow: hidden;
12+
`;
13+
14+
const InnerBar = styled.div<MasteryBarProps>`
15+
position: absolute;
16+
top: 0;
17+
left: 0;
18+
bottom: 0;
19+
background-color: ${({ percentage }) =>
20+
percentage > 0.66 ? color.green : percentage > 0.33 ? color.yellow : color.red};
21+
right: ${({ percentage }) => 100 - percentage * 100 + '%'};
22+
> span {
23+
position: absolute;
24+
color: white;
25+
top: 4px;
26+
font-size: 14px;
27+
right: ${({ percentage }) => (percentage > 0.25 ? '5px' : '-33px')};
28+
}
29+
`;
30+
31+
function Mastery({ percentage }: MasteryBarProps) {
32+
return (
33+
<MasteryBar>
34+
<InnerBar percentage={percentage}>
35+
<span>{Math.floor(percentage * 100)}%</span>
36+
</InnerBar>
37+
</MasteryBar>
38+
);
39+
}
40+
41+
const Container = styled.div`
42+
display: flex;
43+
align-items: center;
44+
width: 100%;
45+
margin-bottom: 6px;
46+
`;
47+
48+
const Header = styled.div`
49+
display: flex;
50+
align-items: center;
51+
color: black;
52+
font-size: 16px;
53+
font-weight: 700;
54+
min-width: 150px;
55+
margin-right: 16px;
56+
`;
57+
58+
const Dot = styled.div`
59+
background-color: ${color.green};
60+
border-radius: 999px;
61+
width: 8px;
62+
height: 8px;
63+
margin-right: 6px;
64+
`;
65+
66+
const Content = styled.div`
67+
display: flex;
68+
align-items: center;
69+
overflow: horizontal;
70+
> :not(last-child) {
71+
margin-right: 21px;
72+
height: 32px;
73+
min-width: 100px;
74+
}
75+
`;
76+
77+
function StudentMasteryRow({ name, learningObjectives }: any) {
78+
return (
79+
<Container>
80+
<Header>
81+
<Dot />
82+
{name}
83+
</Header>
84+
<Content>
85+
{learningObjectives.map(({ percentage }: any) => (
86+
<Mastery percentage={percentage} />
87+
))}
88+
</Content>
89+
</Container>
90+
);
91+
}
92+
93+
const LearningObjectiveName = styled.span`
94+
text-align: center;
95+
`;
96+
97+
function StudentMasteryHeader({ learningObjectiveNames }: { learningObjectiveNames: string[] }) {
98+
return (
99+
<Container style={{ marginBottom: 24 }}>
100+
<Header>Student</Header>
101+
<Content>
102+
{learningObjectiveNames.map((name) => (
103+
<LearningObjectiveName>{name}</LearningObjectiveName>
104+
))}
105+
</Content>
106+
</Container>
107+
);
108+
}
109+
110+
export default StudentMasteryRow;
111+
export { StudentMasteryHeader };

src/__generated__/types.ts

Lines changed: 0 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)