Skip to content

Commit 3d16b07

Browse files
committed
Sticky app bar
1 parent 97af15e commit 3d16b07

2 files changed

Lines changed: 114 additions & 116 deletions

File tree

hwproj.front/src/components/AppBar.tsx

Lines changed: 113 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -87,128 +87,126 @@ export const Header: React.FC<AppBarProps> = (props: AppBarProps) => {
8787
const isExpert = props.isExpert
8888

8989
return (
90-
<div>
91-
<AppBar style={{
92-
position: "static", width: "100vw", maxWidth: "100%", alignItems: "center",
93-
minHeight: "5vh", justifyContent: "center"
94-
}}>
95-
<div className={"container"} style={{display: "flex", alignItems: "center"}}>
96-
<Grid container spacing={1} alignItems={"center"}>
90+
<AppBar position={"sticky"} style={{
91+
width: "100vw", maxWidth: "100%", alignItems: "center",
92+
minHeight: "5vh", justifyContent: "center"
93+
}}>
94+
<div className={"container"} style={{display: "flex", alignItems: "center"}}>
95+
<Grid container spacing={1} alignItems={"center"}>
96+
<Grid item>
97+
<Link to={"/"}>
98+
<Typography variant="h6" style={{color: 'white', fontFamily: "Helvetica"}}>
99+
HW😺
100+
</Typography>
101+
</Link>
102+
</Grid>
103+
{props.loggedIn && !isExpert &&
97104
<Grid item>
98-
<Link to={"/"}>
99-
<Typography variant="h6" style={{color: 'white', fontFamily: "Helvetica"}}>
100-
HW😺
101-
</Typography>
105+
<Link to={"/notifications"}>
106+
<IconButton>
107+
{props.newNotificationsCount > 0
108+
? <Badge overlap="rectangular" badgeContent={props.newNotificationsCount}
109+
color="primary">
110+
<MailIcon fontSize={"small"} htmlColor={"white"}/>
111+
</Badge>
112+
: <MailIcon fontSize={"small"} htmlColor={"white"}/>
113+
}
114+
</IconButton>
102115
</Link>
103116
</Grid>
104-
{props.loggedIn && !isExpert &&
105-
<Grid item>
106-
<Link to={"/notifications"}>
107-
<IconButton>
108-
{props.newNotificationsCount > 0
109-
? <Badge overlap="rectangular" badgeContent={props.newNotificationsCount} color="primary">
110-
<MailIcon fontSize={"small"} htmlColor={"white"}/>
111-
</Badge>
112-
: <MailIcon fontSize={"small"} htmlColor={"white"}/>
113-
}
114-
</IconButton>
115-
</Link>
116-
</Grid>
117-
}
118-
{props.loggedIn &&
119-
<Grid item>
120-
{contextAction && <Link
121-
style={{color: 'white', fontFamily: "Helvetica", textDecoration: "none"}}
122-
to={(contextAction.link)}>
123-
<Button>
124-
<Typography style={{color: 'white', fontFamily: "Helvetica"}}>
125-
{contextAction.actionName}
126-
</Typography>
127-
</Button>
128-
</Link>}
129-
</Grid>
130-
}
131-
</Grid>
132-
{props.loggedIn && isLecturer && <div>
133-
<IconButton
134-
edge="start"
135-
color="inherit"
136-
aria-label="menu"
137-
onClick={handleClick}
138-
>
139-
<MenuIcon/>
140-
</IconButton>
141-
<Menu
142-
id="simple-menu"
143-
anchorEl={anchorEl}
144-
keepMounted
145-
open={Boolean(anchorEl)}
146-
onClose={handleClose}
147-
>
148-
<Link
149-
style={{textDecoration: "none", color: "black"}}
150-
to={"/user/edit"}>
151-
<MenuItem>
152-
Редактировать профиль
153-
</MenuItem>
154-
</Link>
155-
<MenuItem onClick={openInviteLecturer}>
156-
Пригласить преподавателя
117+
}
118+
{props.loggedIn &&
119+
<Grid item>
120+
{contextAction && <Link
121+
style={{color: 'white', fontFamily: "Helvetica", textDecoration: "none"}}
122+
to={(contextAction.link)}>
123+
<Button>
124+
<Typography style={{color: 'white', fontFamily: "Helvetica"}}>
125+
{contextAction.actionName}
126+
</Typography>
127+
</Button>
128+
</Link>}
129+
</Grid>
130+
}
131+
</Grid>
132+
{props.loggedIn && isLecturer && <div>
133+
<IconButton
134+
edge="start"
135+
color="inherit"
136+
aria-label="menu"
137+
onClick={handleClick}
138+
>
139+
<MenuIcon/>
140+
</IconButton>
141+
<Menu
142+
id="simple-menu"
143+
anchorEl={anchorEl}
144+
keepMounted
145+
open={Boolean(anchorEl)}
146+
onClose={handleClose}
147+
>
148+
<Link
149+
style={{textDecoration: "none", color: "black"}}
150+
to={"/user/edit"}>
151+
<MenuItem>
152+
Редактировать профиль
157153
</MenuItem>
158-
<Link
159-
color={"initial"}
160-
style={{textDecoration: "none", color: "black"}}
161-
to={"/experts"}>
162-
<MenuItem>
163-
К списку экспертов
164-
</MenuItem>
165-
</Link>
166-
<Link
167-
color={"initial"}
168-
style={{textDecoration: "none"}}
169-
to={"/create_course"}>
170-
<MenuItem>
171-
Создать курс
172-
</MenuItem>
173-
</Link>
174-
<MenuItem onClick={props.onLogout}>
175-
Выйти
154+
</Link>
155+
<MenuItem onClick={openInviteLecturer}>
156+
Пригласить преподавателя
157+
</MenuItem>
158+
<Link
159+
color={"initial"}
160+
style={{textDecoration: "none", color: "black"}}
161+
to={"/experts"}>
162+
<MenuItem>
163+
К списку экспертов
176164
</MenuItem>
177-
</Menu>
178-
</div>}
179-
{props.loggedIn && !isLecturer && <div>
180-
<IconButton
181-
edge="start"
182-
color="inherit"
183-
aria-label="menu"
184-
onClick={handleClick}
185-
>
186-
<MenuIcon/>
187-
</IconButton>
188-
<Menu
189-
id="simple-menu"
190-
anchorEl={anchorEl}
191-
keepMounted
192-
open={Boolean(anchorEl)}
193-
onClose={handleClose}
194-
>
195-
<Link
196-
style={{textDecoration: "none", color: "black"}}
197-
to={"/user/edit"}>
198-
<MenuItem>
199-
Редактировать профиль
200-
</MenuItem>
201-
</Link>
202-
<MenuItem onClick={props.onLogout}>
203-
Выйти
165+
</Link>
166+
<Link
167+
color={"initial"}
168+
style={{textDecoration: "none"}}
169+
to={"/create_course"}>
170+
<MenuItem>
171+
Создать курс
172+
</MenuItem>
173+
</Link>
174+
<MenuItem onClick={props.onLogout}>
175+
Выйти
176+
</MenuItem>
177+
</Menu>
178+
</div>}
179+
{props.loggedIn && !isLecturer && <div>
180+
<IconButton
181+
edge="start"
182+
color="inherit"
183+
aria-label="menu"
184+
onClick={handleClick}
185+
>
186+
<MenuIcon/>
187+
</IconButton>
188+
<Menu
189+
id="simple-menu"
190+
anchorEl={anchorEl}
191+
keepMounted
192+
open={Boolean(anchorEl)}
193+
onClose={handleClose}
194+
>
195+
<Link
196+
style={{textDecoration: "none", color: "black"}}
197+
to={"/user/edit"}>
198+
<MenuItem>
199+
Редактировать профиль
204200
</MenuItem>
205-
</Menu>
206-
</div>}
207-
</div>
208-
</AppBar>
201+
</Link>
202+
<MenuItem onClick={props.onLogout}>
203+
Выйти
204+
</MenuItem>
205+
</Menu>
206+
</div>}
207+
</div>
209208
{isOpenInviteLecturer && (
210209
<InviteLecturerModal isOpen={isOpenInviteLecturer} close={closeInviteLecturer}/>
211210
)}
212-
</div>
213-
);
211+
</AppBar>)
214212
}

hwproj.front/src/components/Courses/StudentStats.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
104104
<Alert style={{marginBottom: 5}} severity="info"><b>Поиск: </b>
105105
{searched.replaceAll(" ", "·")}
106106
</Alert>}
107-
<TableContainer style={{maxHeight: "100vh", marginBottom: -50}}>
107+
<TableContainer style={{maxHeight: "93vh", marginBottom: -50}}>
108108
<Table stickyHeader aria-label="sticky table">
109109
<TableHead>
110110
<TableRow>

0 commit comments

Comments
 (0)