diff --git a/src/components/ClassCard.js b/src/components/ClassCard.js index 5dd9744..a8961d1 100644 --- a/src/components/ClassCard.js +++ b/src/components/ClassCard.js @@ -9,56 +9,124 @@ import { AvatarGroup, } from '@mui/material'; -function ClassCard({ abbreviation, title, color, teachers }) { - return ( - - - -

{abbreviation}

-
- - - {title} - - - - {teachers.map(t => ( - - ))} - - + + - {teachers.map(t => t.name).join(',')} - - - -
-
- ); +

{abbreviation}

+ + + + {title} + + + + {teachers.map(t => ( + + ))} + + + {teachers.map(t => t.name).join(',')} + + + + + + ); + + case 'mobile': + return ( + + + +

{abbreviation}

+
+ + + {title} + + + + {teachers.map(t => ( + + ))} + + + {teachers.map(t => t.name).join(',')} + + + +
+
+ ); + + default: + return null; + } } export default ClassCard; diff --git a/src/components/MainMenu.js b/src/components/MainMenu.js index b15a15c..65bd601 100644 --- a/src/components/MainMenu.js +++ b/src/components/MainMenu.js @@ -46,7 +46,7 @@ function MainMenu({ options, layoutType }) { case 'mobile': return ( - + { const newOption = options.find(option => option.id === newValue); diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js index ab0d672..f98f9f8 100644 --- a/src/screens/Home/index.js +++ b/src/screens/Home/index.js @@ -3,8 +3,10 @@ import { Grid, Skeleton, Stack } from '@mui/material'; import { useUser } from '../../context/user'; import ClassCard from '../../components/ClassCard'; +import useLayoutType from '../../hooks/useLayoutType'; function Home() { + const layoutType = useLayoutType(); const { fetchClassrooms } = useUser(); const [classrooms, setClassrooms] = useState(null); @@ -16,69 +18,166 @@ function Home() { getClassrooms(); }, [fetchClassrooms]); - return ( - - -

Turmas

- - {classrooms === null ? ( - Array(6) - .fill() - .map((_, index) => ( - + +

Turmas

+ + {classrooms === null ? ( + Array(6) + .fill() + .map((_, index) => ( + + )) + ) : classrooms.length !== 0 ? ( + classrooms.map(classroom => ( + + )) + ) : ( +

Nenhuma sala de aula encontrada!

+ )} +
+
+ +

Atividades

+

Atribuídas

+ + {classrooms === null ? ( + Array(6) + .fill() + .map((_, index) => ( + + )) + ) : classrooms.length !== 0 ? ( + classrooms.map(classroom => ( + + )) + ) : ( +

Nenhuma sala de aula encontrada!

+ )} +
+
+
+ ); + + case 'mobile': + return ( + +

Turmas

+ + {classrooms === null ? ( + Array(6) + .fill() + .map((_, index) => ( + + )) + ) : classrooms.length !== 0 ? ( + classrooms.map(classroom => ( + )) - ) : classrooms.length !== 0 ? ( - classrooms.map(classroom => ( - - )) - ) : ( -

Nenhuma sala de aula encontrada!

- )} -
-
- -

Atividades

-

Atribuídas

- - {classrooms === null ? ( - Array(6) - .fill() - .map((_, index) => ( - Nenhuma sala de aula encontrada! + )} + +

Atividades

+

Atribuídas

+ + {classrooms === null ? ( + Array(6) + .fill() + .map((_, index) => ( + + )) + ) : classrooms.length !== 0 ? ( + classrooms.map(classroom => ( + )) - ) : classrooms.length !== 0 ? ( - classrooms.map(classroom => ( - - )) - ) : ( -

Nenhuma sala de aula encontrada!

- )} + ) : ( +

Nenhuma sala de aula encontrada!

+ )} +
-
- - ); + ); + default: + return null; + } } export default Home;