Skip to content

Commit 546a354

Browse files
[examples] Remove React Spring from themed example (#4890)
1 parent 74f8f10 commit 546a354

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

examples/core/auth-nextjs-themed/app/components/CustomTreeView.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client';
22
import * as React from 'react';
33
import clsx from 'clsx';
4-
import { animated, useSpring } from '@react-spring/web';
54
import { TransitionProps } from '@mui/material/transitions';
65
import Box from '@mui/material/Box';
76
import Card from '@mui/material/Card';
@@ -81,17 +80,25 @@ function DotIcon({ color }: { color: string }) {
8180
);
8281
}
8382

84-
const AnimatedCollapse = animated(Collapse);
85-
8683
function TransitionComponent(props: TransitionProps) {
87-
const style = useSpring({
88-
to: {
89-
opacity: props.in ? 1 : 0,
90-
transform: `translate3d(0,${props.in ? 0 : 20}px,0)`,
91-
},
92-
});
84+
const { in: inProp, children, ...rest } = props;
9385

94-
return <AnimatedCollapse style={style} {...props} />;
86+
return (
87+
<Collapse
88+
{...rest}
89+
in={inProp}
90+
timeout={300}
91+
sx={{
92+
'& .collapse-content': {
93+
opacity: inProp ? 1 : 0,
94+
transform: `translateY(${inProp ? 0 : 20}px)`,
95+
transition: 'opacity 300ms ease, transform 300ms ease',
96+
},
97+
}}
98+
>
99+
<Box className="collapse-content">{children}</Box>
100+
</Collapse>
101+
);
95102
}
96103

97104
interface CustomLabelProps {

examples/core/auth-nextjs-themed/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"@mui/x-data-grid": "^8",
1919
"dayjs": "^1",
2020
"clsx": "^2",
21-
"@react-spring/web": "^9",
2221
"@toolpad/core": "^0.14.0",
2322
"next": "^15",
2423
"next-auth": "^5.0.0-beta.25",

0 commit comments

Comments
 (0)