-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* renaming Footer to DebugFooter * basic footer layout and positioning * Footer positioning * Addedd Logo component * Footer containing logos * Change position of Footer * Style images in Footer * Add menuitems to Footer * Fix some thinks after review --------- Co-authored-by: matushl <[email protected]>
- Loading branch information
1 parent
4d45bd5
commit 5a75014
Showing
10 changed files
with
159 additions
and
30 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/components/PageLayout/DebugFooter/DebugFooter.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.debugFooter { | ||
position: fixed; | ||
left: 25%; | ||
right: 0; | ||
bottom: 0; | ||
|
||
background-color: black; | ||
color: white; | ||
|
||
display: flex; | ||
flex-direction: row; | ||
gap: 40px; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/components/PageLayout/DebugFooter/DebugFooter.module.scss.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type Styles = { | ||
debugFooter: string | ||
} | ||
|
||
export type ClassNames = keyof Styles | ||
|
||
declare const styles: Styles | ||
|
||
export default styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {useQuery} from '@tanstack/react-query' | ||
import axios from 'axios' | ||
import {FC} from 'react' | ||
|
||
import {Profile} from '@/types/api/personal' | ||
import {AuthContainer} from '@/utils/AuthContainer' | ||
|
||
import styles from './DebugFooter.module.scss' | ||
|
||
export const DebugFooter: FC = () => { | ||
const {isAuthed} = AuthContainer.useContainer() | ||
|
||
const {data} = useQuery({ | ||
queryKey: ['personal', 'profiles', 'myprofile'], | ||
queryFn: () => axios.get<Profile>(`/api/personal/profiles/myprofile`), | ||
enabled: isAuthed, | ||
}) | ||
const profile = data?.data | ||
|
||
return ( | ||
<div className={styles.debugFooter}> | ||
<span>Debug info: </span> | ||
<span>user name: {profile?.first_name + ' ' + profile?.last_name} </span> | ||
<span>isAuthed: {`${isAuthed}`}</span> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
.footer { | ||
position: fixed; | ||
left: 25%; | ||
right: 0; | ||
bottom: 0; | ||
|
||
.container { | ||
width: 100%; | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
background-color: black; | ||
color: white; | ||
// bottom offset because of sticky debug footer | ||
padding-bottom: 1rem; | ||
} | ||
|
||
display: flex; | ||
flex-direction: row; | ||
gap: 40px; | ||
.content { | ||
grid-column-start: 2; | ||
grid-column-end: 4; | ||
} | ||
|
||
.menuItem { | ||
background-color: transparent; | ||
|
||
a { | ||
border-color: white; | ||
color: white; | ||
background-color: inherit; | ||
} | ||
} | ||
|
||
.menuItem:hover { | ||
background-color: white; | ||
|
||
a { | ||
color: black; | ||
border-color: black; | ||
background-color: inherit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,61 @@ | ||
import {Stack} from '@mui/material' | ||
import {useQuery} from '@tanstack/react-query' | ||
import axios from 'axios' | ||
import {FC} from 'react' | ||
|
||
import {Profile} from '@/types/api/personal' | ||
import {AuthContainer} from '@/utils/AuthContainer' | ||
import {Link} from '@/components/Clickable/Link' | ||
import {Loading} from '@/components/Loading/Loading' | ||
import {ILogo, Logo} from '@/components/PageLayout/Footer/Logo' | ||
import {MenuItemShort} from '@/types/api/cms' | ||
import {useSeminarInfo} from '@/utils/useSeminarInfo' | ||
|
||
import styles from './Footer.module.scss' | ||
|
||
export const Footer: FC = () => { | ||
const {isAuthed} = AuthContainer.useContainer() | ||
const {seminar, seminarId} = useSeminarInfo() | ||
|
||
const {data} = useQuery({ | ||
queryKey: ['personal', 'profiles', 'myprofile'], | ||
queryFn: () => axios.get<Profile>(`/api/personal/profiles/myprofile`), | ||
enabled: isAuthed, | ||
const { | ||
data: menuItemsData, | ||
isLoading: menuItemsIsLoading, | ||
error: menuItemsError, | ||
} = useQuery({ | ||
queryKey: ['cms', 'menu-item', 'on-site', seminarId], | ||
queryFn: () => axios.get<MenuItemShort[]>(`/api/cms/menu-item/on-site/${seminarId}`), | ||
}) | ||
const profile = data?.data | ||
const menuItems = menuItemsData?.data ?? [] | ||
|
||
const { | ||
data: logosData, | ||
isLoading: logosIsLoading, | ||
error: logosError, | ||
} = useQuery({ | ||
queryKey: ['cms', 'logo'], | ||
queryFn: () => axios.get<ILogo[]>('/api/cms/logo'), | ||
}) | ||
const logos = logosData?.data.filter((logo) => !logo.disabled) ?? [] | ||
|
||
return ( | ||
<div className={styles.footer}> | ||
<span>Debug info: </span> | ||
<span>user name: {profile?.first_name + ' ' + profile?.last_name} </span> | ||
<span>isAuthed: {`${isAuthed}`}</span> | ||
<div className={styles.container}> | ||
<div className={styles.content}> | ||
<Stack direction="row" m={2} gap={2} justifyContent="center" sx={{flexWrap: 'wrap'}}> | ||
{menuItemsIsLoading && <Loading />} | ||
{menuItems.map((item) => ( | ||
<div key={item.id} className={styles.menuItem}> | ||
<Link variant="button2" href={`/${seminar}${item.url}`}> | ||
{item.caption} | ||
</Link> | ||
</div> | ||
))} | ||
{menuItemsError && <p>{menuItemsError.message}</p>} | ||
</Stack> | ||
<Stack direction="row" m={2} mt={5} gap={2} justifyContent="center" sx={{flexWrap: 'wrap'}}> | ||
{logosIsLoading && <Loading />} | ||
{logos.map((logo) => ( | ||
<Logo key={logo.id} {...logo} /> | ||
))} | ||
{logosError && <p>{logosError.message}</p>} | ||
</Stack> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Box} from '@mui/material' | ||
import {FC} from 'react' | ||
|
||
export interface ILogo { | ||
id: number | ||
name: string | ||
disabled: string | ||
image: string | ||
} | ||
|
||
export const Logo: FC<ILogo> = ({name, image}) => { | ||
return ( | ||
<Box | ||
component={'img'} | ||
src={image} | ||
alt={name} | ||
sx={{ | ||
maxHeight: '9rem', | ||
}} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters