Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scrollbar to menu #277

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.authenticationDisplayButtons {
position: absolute;
left: 0px;
bottom: 0px;
width: 100%;
margin-top: 1rem;
text-align: center;
color: white;

15 changes: 0 additions & 15 deletions src/components/PageLayout/MenuMain/MenuMain.module.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
.menu {
position: fixed;
width: 25%;
height: 100vh;
top: -100%;
background-color: black;
transition: 750ms;
z-index: 100;

&.visible {
left: 0;
top: 0;
}
}

.menuButton {
cursor: pointer;
display: grid;
2 changes: 0 additions & 2 deletions src/components/PageLayout/MenuMain/MenuMain.module.scss.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
export type Styles = {
active: string
loading: string
menu: string
menuButton: string
menuCloseButton: string
menuItem: string
menuOpenButton: string
visible: string
}

export type ClassNames = keyof Styles
58 changes: 38 additions & 20 deletions src/components/PageLayout/MenuMain/MenuMain.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Stack, Theme, Typography, useMediaQuery} from '@mui/material'
import {Box, Stack, Theme, Typography, useMediaQuery} from '@mui/material'
import {useQuery} from '@tanstack/react-query'
import axios from 'axios'
import clsx from 'clsx'
@@ -45,27 +45,45 @@ export const MenuMain: FC = () => {
<Menu width={iconSize} height={iconSize} />
</div>
)}
<div className={clsx(styles.menu, isVisible && styles.visible)}>
<CloseButton size={iconSize} onClick={toggleMenu} className={clsx(styles.menuButton, styles.menuCloseButton)} />
{menuItemsIsLoading && (
<div className={styles.loading}>
<Loading />
</div>
)}
<Stack mt="176px">
{menuItems.map(({id, caption, url}) => (
// `url` je vo formate `/vysledky/` alebo `/akcie/matboj/`
<MenuMainItem key={id} caption={caption} url={`/${seminar}${url}`} />
))}
</Stack>
{hasPermissions && (
<Stack sx={{mt: 4, mx: 2, borderTop: '8px dashed white', pt: 4}}>
<MenuMainItem caption="TODO: Opravovanie" url={`/${seminar}/admin/opravovanie`} />
<MenuMainItem caption="Admin" url="/admin" />
<Stack
sx={{
position: 'fixed',
width: '25%',
height: '100%',
left: 0,
top: isVisible ? 0 : '-100%',
overflow: 'auto',
backgroundColor: 'black',
transition: '750ms',
zIndex: 100,
}}
>
<Box flexGrow={1}>
<CloseButton
size={iconSize}
onClick={toggleMenu}
className={clsx(styles.menuButton, styles.menuCloseButton)}
/>
{menuItemsIsLoading && (
<div className={styles.loading}>
<Loading />
</div>
)}
<Stack mt="176px">
{menuItems.map(({id, caption, url}) => (
// `url` je vo formate `/vysledky/` alebo `/akcie/matboj/`
<MenuMainItem key={id} caption={caption} url={`/${seminar}${url}`} />
))}
</Stack>
)}
{hasPermissions && (
<Stack sx={{mt: 4, mx: 2, borderTop: '8px dashed white', pt: 4}}>
<MenuMainItem caption="TODO: Opravovanie" url={`/${seminar}/admin/opravovanie`} />
<MenuMainItem caption="Admin" url="/admin" />
</Stack>
)}
</Box>
<Authentication />
</div>
</Stack>
</>
)
}

Unchanged files with check annotations Beta

import {FC} from 'react'
import {Datagrid, DateField, FunctionField, List, NumberField, RaRecord, TextField} from 'react-admin'

Check warning on line 2 in src/components/Admin/resources/cms/post/PostList.tsx

GitHub Actions / branch-test

'NumberField' is defined but never used
import {SitesArrayField} from '@/components/Admin/custom/SitesArrayField'
import {TruncatedTextField} from '@/components/Admin/custom/TruncatedTextField'
import styles from './StromLogo.module.scss'
const handleClick = (e: MouseEvent<HTMLElement>) => {

Check warning on line 5 in src/components/PageLayout/StromLogo/StromLogo.tsx

GitHub Actions / branch-test

'e' is defined but never used. Allowed unused args must match /^_/u
console.log('Clicked')

Check warning on line 6 in src/components/PageLayout/StromLogo/StromLogo.tsx

GitHub Actions / branch-test

Unexpected console statement
}
export const StromLogo: FC = () => {
sites: number[]
}
export const Post: FC<IPost> = ({id, caption, short_text, links, sites, added_at}) => {

Check warning on line 21 in src/components/Posts/Post.tsx

GitHub Actions / branch-test

'id' is defined but never used. Allowed unused args must match /^_/u
const {seminarId} = useSeminarInfo()
if (!sites.includes(seminarId)) return null
invalidateSeriesQuery()
alert('Riešenie úspešne nahrané.')
} else {
console.warn(response)

Check warning on line 38 in src/components/Problems/UploadProblemForm.tsx

GitHub Actions / branch-test

Unexpected console statement
alert(
'Niečo sa ASI pokazilo, skontroluj, či bolo riešenie nahrané, a ak si technický typ, môžeš pozrieť chybu v konzole.',
)