-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from ballyalley-o/other/TCCP157-bootcamp-deta…
…ils-page [Client] Perf: SerializableStateInvariantMiddleware #159: Fix serializableCheck and immutableCheck configuration in store.ts
- Loading branch information
Showing
51 changed files
with
929 additions
and
160 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { useState, useEffect, useRef, Fragment, MouseEvent } from 'react' | ||
import { m } from 'framer-motion' | ||
import { useNavigate, useLocation } from 'react-router-dom' | ||
import { ICON_NAME, useIcon } from 'hook' | ||
import { useSettingContext } from 'component/setting' | ||
import { Typography } from '@mui/material' | ||
import { useTheme } from '@mui/material/styles' | ||
import { KEY, LABEL, TYPOGRAPHY, VARIANT } from 'constant' | ||
import { SPopover, SBackIconButton } from 'component/button' | ||
|
||
const BackButton = () => { | ||
const [open, setOpen] = useState(false) | ||
const [anchorEl, setAnchorEl] = useState<EventTarget | null>(null) | ||
|
||
const { themeMode } = useSettingContext() | ||
const { pathname } = useLocation() | ||
const navigate = useNavigate() | ||
const navRef = useRef(null) | ||
const theme = useTheme() | ||
|
||
const { Icon, iconSrc: backIconSrc } = useIcon(ICON_NAME.BACK) | ||
|
||
const handleClick = (event: MouseEvent<HTMLButtonElement>) => { | ||
setAnchorEl(event.currentTarget) | ||
navigate(-1) | ||
} | ||
|
||
useEffect(() => { | ||
if (open) { | ||
handleClose() | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [pathname]) | ||
|
||
useEffect(() => { | ||
const appBarEl = Array.from(document.querySelectorAll('.MuiAppBar-root')) as HTMLElement[] | ||
|
||
const styles = () => { | ||
document.body.style.overflow = '' | ||
document.body.style.padding = '' | ||
|
||
appBarEl.forEach((elem) => { | ||
elem.style.padding = '' | ||
}) | ||
} | ||
|
||
if (open) { | ||
styles() | ||
} else { | ||
styles() | ||
} | ||
}, [open]) | ||
|
||
const handleOpen = (event: MouseEvent<HTMLButtonElement>) => { | ||
setAnchorEl(event.currentTarget) | ||
setOpen(true) | ||
} | ||
|
||
const handleClose = () => { | ||
setOpen(false) | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<SBackIconButton onClick={handleClick} aria-label={LABEL.GO_BACK} onMouseEnter={handleOpen} onMouseLeave={handleClose}> | ||
<Icon icon={backIconSrc} width={50} /> | ||
</SBackIconButton> | ||
<SPopover | ||
open={open} | ||
anchorEl={anchorEl as Element} | ||
anchorOrigin={{ vertical: KEY.CENTER, horizontal: KEY.RIGHT }} | ||
transformOrigin={{ vertical: KEY.CENTER, horizontal: KEY.LEFT }} | ||
sx={{ | ||
marginLeft: 3 | ||
}}> | ||
<m.div> | ||
<Typography variant={TYPOGRAPHY.BODY1} color={themeMode === KEY.LIGHT ? theme.palette.grey[700] : theme.palette.grey[400]}> | ||
{LABEL.GO_BACK} | ||
</Typography> | ||
</m.div> | ||
</SPopover> | ||
</Fragment> | ||
) | ||
} | ||
|
||
export default BackButton |
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 @@ | ||
export { default as BackButton } from './back' |
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,2 +1,4 @@ | ||
export { default as Button } from './button' | ||
export { default as BackButton } from './back/back' | ||
export { default as AnimatedButton } from './button-animated' | ||
export * from './style' |
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,29 @@ | ||
import { styled } from '@mui/material/styles' | ||
import { Popover, IconButton } from '@mui/material' | ||
|
||
export const SPopover = styled(Popover)(({ theme }) => ({ | ||
'& .MuiPaper-root': { | ||
backgroundColor: 'transparent', | ||
boxShadow: 'none', | ||
size: '100%', | ||
overflow: 'hidden', | ||
borderRadius: 0 | ||
}, | ||
'& .MuiPopover-paper': { | ||
overflow: 'hidden' | ||
}, | ||
'& .MuiPopover-paper .MuiList-root': { | ||
padding: '0px' | ||
}, | ||
'& .MuiPopover-paper .MuiTypography-root': { | ||
fontSize: '1rem' | ||
}, | ||
boxShadow: 'none', | ||
pointerEvents: 'none' | ||
})) | ||
|
||
export const SBackIconButton = styled(IconButton)(({ theme }) => ({ | ||
borderRadius: 2, | ||
padding: 1, | ||
marginBottom: 2 | ||
})) |
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,5 +1,6 @@ | ||
export { default as Navbar } from './navbar' | ||
export { default as AppNavBar } from './appbar' | ||
export { default as AppBar } from './appbar' | ||
export { default as AppNavBar } from './app-appbar' | ||
export { default as AppFooter } from './footer' | ||
export { default as NavDrawer } from './nav-drawer' | ||
export { default as AccountPopover } from './account-popover' |
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
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.