Files
clash-verge-rev/src/components/layout/scroll-top-button.tsx
T
Slinetrac c672a6fef3 refactor: lint (#6511)
* refactor: lint

* chore: remove eslint-plugin/config-prettier
2026-03-15 07:40:11 +00:00

38 lines
968 B
TypeScript

import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'
import { IconButton, Fade, SxProps, Theme } from '@mui/material'
interface Props {
onClick: () => void
show: boolean
sx?: SxProps<Theme>
}
export const ScrollTopButton = ({ onClick, show, sx }: Props) => {
return (
<Fade in={show}>
<IconButton
onClick={onClick}
sx={{
position: 'absolute',
bottom: '20px',
right: '20px',
backgroundColor: (theme) =>
theme.palette.mode === 'dark'
? 'rgba(255,255,255,0.1)'
: 'rgba(0,0,0,0.1)',
'&:hover': {
backgroundColor: (theme) =>
theme.palette.mode === 'dark'
? 'rgba(255,255,255,0.2)'
: 'rgba(0,0,0,0.2)',
},
visibility: show ? 'visible' : 'hidden',
...sx,
}}
>
<KeyboardArrowUpIcon />
</IconButton>
</Fade>
)
}