test commit
This commit is contained in:
@@ -81,7 +81,7 @@ export const AVATAR_STYLES: StyleDef[] = [
|
||||
},
|
||||
]
|
||||
|
||||
export const DEFAULT_STYLE_ID = 'bottts'
|
||||
export const DEFAULT_STYLE_ID = 'avataaars'
|
||||
|
||||
export function getStyleById(id: string | null | undefined): StyleDef {
|
||||
return AVATAR_STYLES.find((s) => s.id === id) ?? AVATAR_STYLES[0]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { useEffect } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
|
||||
export function ScrollOnNavigate() {
|
||||
const { pathname } = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0)
|
||||
}, [pathname])
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import Fab from '@mui/material/Fab'
|
||||
import useScrollTrigger from '@mui/material/useScrollTrigger'
|
||||
import Zoom from '@mui/material/Zoom'
|
||||
import { ArrowUp } from 'lucide-react'
|
||||
|
||||
export function ScrollToTop() {
|
||||
const trigger = useScrollTrigger({ threshold: 400, disableHysteresis: true })
|
||||
|
||||
const handleClick = () => {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}
|
||||
|
||||
return (
|
||||
<Zoom in={trigger}>
|
||||
<Fab
|
||||
color="primary"
|
||||
size="small"
|
||||
onClick={handleClick}
|
||||
aria-label="К началу страницы"
|
||||
sx={{
|
||||
position: 'fixed',
|
||||
bottom: 24,
|
||||
right: 24,
|
||||
zIndex: 1100,
|
||||
}}
|
||||
>
|
||||
<ArrowUp size={20} />
|
||||
</Fab>
|
||||
</Zoom>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user