feat: add smooth transition animation to narrow mode toggle (#8740)

This commit is contained in:
Konv Suu 2025-08-01 14:45:08 +08:00 committed by GitHub
parent a789a59ad8
commit b7394c98a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,22 +9,23 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
const NarrowLayout: FC<Props> = ({ children, ...props }) => {
const { narrowMode } = useSettings()
if (narrowMode) {
return (
<Container className="narrow-mode" {...props}>
{children}
</Container>
)
}
return children
return (
<Container className={`narrow-mode ${narrowMode ? 'active' : ''}`} {...props}>
{children}
</Container>
)
}
const Container = styled.div`
max-width: 800px;
max-width: 100%;
width: 100%;
margin: 0 auto;
position: relative;
transition: max-width 0.3s ease-in-out;
&.active {
max-width: 800px;
}
`
export default NarrowLayout