summaryrefslogtreecommitdiff
path: root/src/screens/student/Classroom/Header
diff options
context:
space:
mode:
authorLeonardo Murça <106257713+leomurca@users.noreply.github.com>2023-02-07 20:40:41 -0300
committerGitHub <noreply@github.com>2023-02-07 20:40:41 -0300
commit8eca8b79ce4bfc40f8416309cbcfe397ed935ec4 (patch)
treeca4152122b67605e76f7a53ed1a14402255b23aa /src/screens/student/Classroom/Header
parente3de3c8e5fe06f7d14b2dc99a8b6aadc3b9bf18a (diff)
parentc1f1286c86a47b87abcca55cbd0177d2a9c92fcd (diff)
Merge pull request #20 from leomurca/feature/professor_classroomHEADmain
Feature/professor classroom
Diffstat (limited to 'src/screens/student/Classroom/Header')
-rw-r--r--src/screens/student/Classroom/Header/index.js62
-rw-r--r--src/screens/student/Classroom/Header/styles.js90
2 files changed, 152 insertions, 0 deletions
diff --git a/src/screens/student/Classroom/Header/index.js b/src/screens/student/Classroom/Header/index.js
new file mode 100644
index 0000000..6a4a1a8
--- /dev/null
+++ b/src/screens/student/Classroom/Header/index.js
@@ -0,0 +1,62 @@
+import {
+ Avatar,
+ AvatarGroup,
+ Container,
+ Paper,
+ Skeleton,
+ Stack,
+ Tab,
+ Tabs,
+ Tooltip,
+ Typography,
+} from '@mui/material';
+import { TAB_OPTIONS } from '../tabOptions';
+import styles from './styles';
+
+function Header({
+ layoutType,
+ classroom,
+ selectedTabOption,
+ onSelectTabOption,
+ isLoading,
+}) {
+ const { title, paper, tabs, avatar, tooltip } = styles[layoutType];
+ return classroom === null ? (
+ <Skeleton variant="rectangular" width="100%" height={240} />
+ ) : (
+ <Container disableGutters>
+ <Paper sx={paper(classroom.color)} elevation={4} variant="elevation">
+ <h1 style={title}>{classroom.name}</h1>
+ <Stack alignItems="center" direction="row" spacing={1}>
+ <AvatarGroup total={classroom.teachers.length}>
+ {classroom.teachers.map(t => (
+ <Avatar key={t.name} alt={t.name} src={t.avatar} sx={avatar} />
+ ))}
+ </AvatarGroup>
+ <Tooltip title={classroom.teachers.map(t => t.name).join(', ')}>
+ <Typography sx={tooltip} variant="body3" color="text.secondary">
+ {classroom.teachers.map(t => t.name).join(', ')}
+ </Typography>
+ </Tooltip>
+ </Stack>
+ <Tabs
+ value={selectedTabOption}
+ onChange={onSelectTabOption}
+ aria-label="Tabs para informações da disciplina"
+ variant="fullWidth"
+ sx={tabs}
+ >
+ {Object.values(TAB_OPTIONS).map(option => (
+ <Tab
+ key={option.value}
+ label={option.lable}
+ disabled={isLoading && option.value !== selectedTabOption}
+ />
+ ))}
+ </Tabs>
+ </Paper>
+ </Container>
+ );
+}
+
+export default Header;
diff --git a/src/screens/student/Classroom/Header/styles.js b/src/screens/student/Classroom/Header/styles.js
new file mode 100644
index 0000000..58d19aa
--- /dev/null
+++ b/src/screens/student/Classroom/Header/styles.js
@@ -0,0 +1,90 @@
+// ========== Desktop ==========
+const desktopTitle = {
+ fontWeight: 500,
+};
+
+const desktopPaper = classColor => ({
+ width: '100%',
+ borderTop: `5px solid ${classColor}`,
+ padding: '20px',
+});
+
+const desktopTabs = {
+ marginLeft: '-20px',
+ marginRight: '-20px',
+ marginBottom: '-20px',
+ marginTop: '30px',
+};
+
+const desktopAvatar = {
+ width: 30,
+ height: 30,
+};
+
+const desktopTooltip = {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+};
+
+const desktop = {
+ title: desktopTitle,
+ paper: desktopPaper,
+ tabs: desktopTabs,
+ avatar: desktopAvatar,
+ tooltip: desktopTooltip,
+};
+
+// ========== Mobile ==========
+const mobileTitle = {
+ fontWeight: 500,
+ fontSize: '25px',
+};
+
+const mobilePaper = classColor => ({
+ width: '100%',
+ borderTop: `5px solid ${classColor}`,
+ padding: '10px',
+});
+
+const mobileTabs = {
+ marginLeft: '-10px',
+ marginRight: '-10px',
+ marginBottom: '-10px',
+ marginTop: '30px',
+};
+
+const mobileAvatar = {
+ width: 30,
+ height: 30,
+};
+
+const mobileTooltip = {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+};
+
+const mobile = {
+ title: mobileTitle,
+ paper: mobilePaper,
+ tabs: mobileTabs,
+ avatar: mobileAvatar,
+ tooltip: mobileTooltip,
+};
+
+// ========== Unset ==========
+const unset = {
+ title: null,
+ paper: null,
+ tabs: null,
+ avatar: null,
+ tooltip: null,
+};
+
+const styles = { desktop, mobile, unset };
+export default styles;