Skip to content

Commit c940725

Browse files
committed
chore: change styles in class view
1 parent bd697ad commit c940725

8 files changed

Lines changed: 37 additions & 26 deletions

File tree

client/src/Components/ClassView/CheckboxListSession.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const CheckboxListSession: React.FC<Props> = ({ studentList, sessionId }) => {
3636
(attendee) => attendee?.email === student.email
3737
)
3838
) {
39-
return <CheckBoxChecked className="w-10 h-10" />;
39+
return <CheckBoxChecked className="w-10 h-10 mx-2" />;
4040
}
41-
return <CheckBoxEmpty className="w-10 h-10" />;
41+
return <CheckBoxEmpty className="w-10 h-10 mx-2" />;
4242
})}
4343
</div>
4444
);

client/src/Components/ClassView/ClassDashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SessionBtn from './SessionBtn';
44
import RegisterBtn from './RegisterBtn';
55

66
const viewStyle = 'flex flex-row justify-around';
7-
const listStyle = 'rounded-sm shadow-xl w-1/2';
7+
const listStyle = 'rounded-sm shadow-sm w-1/2';
88

99
const ClassDashboard: React.FC<{ courseId: number }> = ({ courseId }) => {
1010
return (

client/src/Components/ClassView/ClassView.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import User from '../../Types/user';
1111
const headerStyle =
1212
'bg-black text-white flex flex-row justify-between items-center content-center p-8 h-20 mb-4 text-3xl';
1313
const attendanceStyle =
14-
'flex justify-center bg-black py-4 rounded-sm font-bold text-lg w-1/3 text-white mb-4';
14+
'flex justify-center bg-black py-4 rounded-sm text-lg w-1/3 text-white mb-4 h-16';
1515
const listHeader =
16-
'w-1/2 bg-green p-2 text-white text-bold text-lg rounded-t-sm';
16+
'w-1/2 bg-green p-2 text-white text-lg rounded-t-sm h-16';
1717

1818
const ClassView: React.FC = () => {
1919
const dispatch = useDispatch();
@@ -50,11 +50,12 @@ const ClassView: React.FC = () => {
5050
</div>
5151
<Link to={link} className={attendanceStyle}>
5252
<h3
53-
className="text-lg"
53+
className="text-lg invisible md:visible w-0 md:w-full flex justify-center h-0 md:h-full"
5454
onClick={() => dispatch(setHistory(history))}
5555
>
5656
{history ? 'Back to dashboard' : 'Attendance history'}
5757
</h3>
58+
<h3 className="visible md:invisible md:w-0 md:h-0">History</h3>
5859
</Link>
5960
</div>
6061
{history ? <Outlet /> : <ClassDashboard courseId={courseId} />}

client/src/Components/ClassView/RegisterBtn.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
const registerStyle = 'flex justify-center bg-green hover:bg-green-light py-4 rounded-sm font-bold text-lg mb-8 text-white h-16 w-full';
3+
const registerStyle = 'flex justify-center bg-green hover:bg-green-light py-4 rounded-sm text-lg mb-8 text-white h-16';
44

55
const RegisterBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
66
function openQR() {
@@ -11,7 +11,10 @@ const RegisterBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
1111
);
1212
}
1313

14-
return <button onClick={openQR} className={registerStyle}>Register students</button>;
14+
return <div className={registerStyle}>
15+
<button onClick={openQR} className="invisible md:visible w-0 md:w-full flex justify-center h-0 md:h-full">Register students</button>
16+
<p className="visible md:invisible md:w-0 md:h-0">Register</p>
17+
</div>;
1518
};
1619

1720
export default RegisterBtn;

client/src/Components/ClassView/SessionBtn.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { setSession } from '../../store/actions';
88
import Session from '../../Types/session';
99

1010
const sessionBtnStyle =
11-
'flex justify-center bg-green hover:bg-green-light py-4 rounded-sm font-bold text-lg mb-4 h-16';
12-
const btnTextStyle = 'font-bold text-lg text-white';
11+
'flex justify-center bg-green hover:bg-green-light py-4 rounded-sm text-lg mb-4 h-16 shadow-2xl';
12+
const btnTextStyle = 'text-lg text-white';
1313

1414
const SessionBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
1515
const [running, setRunning] = useState(false);
@@ -21,6 +21,7 @@ const SessionBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
2121
);
2222

2323
const btnText = running ? 'End Session' : 'Start Session';
24+
const smallBtn = running ? 'End' : 'Start';
2425

2526
const createSessionDB = async () => {
2627
// create new session in DB
@@ -64,7 +65,8 @@ const SessionBtn: React.FC<{ courseId: number }> = ({ courseId }) => {
6465
return (
6566
<div className={sessionBtnStyle}>
6667
<button className={btnTextStyle} onClick={handleClick}>
67-
{btnText}
68+
<p className="invisible md:visible w-0 md:w-full flex justify-center h-0 md:h-full">{btnText}</p>
69+
<p className="visible md:invisible md:w-0 md:h-0">{smallBtn}</p>
6870
</button>
6971
</div>
7072
);

client/src/Components/ClassView/StudentElement.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ interface Props {
77

88
const StudentElement: React.FC<Props> = ({ name, lastname }) => {
99
return (
10-
<div className='flex justify-center place-items-center p-4'>
11-
<h3>{lastname} {name}</h3>
10+
<div className='flex h-10 mx-2'>
11+
<h3 className="mt-2">{lastname} {name}</h3>
1212
</div>
1313
);
1414
};

client/src/Components/ClassView/StudentsList.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CheckboxListSession from './CheckboxListSession';
1111
import CheckboxListHistory from '../Calendar/CheckboxListHistory';
1212
const ENDPOINT = 'http://localhost:4000';
1313

14-
const listStyle = 'flex flex-col justify-start items-start';
14+
const listStyle = 'flex flex-col justify-start items-start shadow-bottom';
1515

1616
const StudentsList: React.FC<{ courseId: number }> = ({ courseId }) => {
1717
const studentsState = useSelector(
@@ -57,8 +57,8 @@ const StudentsList: React.FC<{ courseId: number }> = ({ courseId }) => {
5757
return (
5858
<div className={listStyle}>
5959
{students?.length ? (
60-
<div className='flex'>
61-
<div>
60+
<div className='flex flex-row w-full justify-between'>
61+
<div className="flex flex-col">
6262
{students.map((student) => {
6363
return (
6464
<StudentElement
@@ -69,16 +69,18 @@ const StudentsList: React.FC<{ courseId: number }> = ({ courseId }) => {
6969
);
7070
})}
7171
</div>
72-
{!!session && (
73-
<CheckboxListSession
74-
// @ts-ignore
75-
studentList={students}
76-
sessionId={session.id}
77-
/>
78-
)}
79-
{history && studentsState && (
80-
<CheckboxListHistory studentList={studentsState} />
81-
)}
72+
<div>
73+
{!!session && (
74+
<CheckboxListSession
75+
// @ts-ignore
76+
studentList={students}
77+
sessionId={session.id}
78+
/>
79+
)}
80+
{history && studentsState && (
81+
<CheckboxListHistory studentList={studentsState} />
82+
)}
83+
</div>
8284
</div>
8385
) : (
8486
<p>No students registered for this class yet</p>

client/tailwind.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ module.exports = {
2828
DEFAULT: '#000000',
2929
},
3030
},
31+
boxShadow: {
32+
bottom: '0 3px 2px -1px rgba(0, 0, 0, 0.2)'
33+
},
3134
extend: {
3235
fontFamily: {
3336
sans: ['Inter', ...defaultTheme.fontFamily.sans],

0 commit comments

Comments
 (0)