fix: ux bug

This commit is contained in:
jialin
2024-07-02 17:30:03 +08:00
parent 49efbd1a7f
commit 316019586f
19 changed files with 102 additions and 133 deletions
+9 -1
View File
@@ -13,11 +13,18 @@ interface TransitionWrapProps {
header?: React.ReactNode;
variant?: 'bordered' | 'filled';
children: React.ReactNode;
setCollapsed?: (val: boolean) => void;
ref?: any;
}
const TransitionWrapper: React.FC<TransitionWrapProps> = forwardRef(
(props, ref) => {
const { minHeight = 50, header, variant = 'bordered', children } = props;
const {
minHeight = 50,
header,
variant = 'bordered',
children,
setCollapsed
} = props;
const [isOpen, setIsOpen] = useState(true);
const [height, setHeight] = useState(0);
const contentRef = useRef(null);
@@ -32,6 +39,7 @@ const TransitionWrapper: React.FC<TransitionWrapProps> = forwardRef(
const toggleOpen = () => {
setIsOpen(!isOpen);
setCollapsed?.(!isOpen);
};
const setHeightByContent = () => {