summaryrefslogtreecommitdiff
path: root/src-migrate/components/ui/smooth-render.tsx
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-07-10 15:58:51 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-07-10 15:58:51 +0700
commit2e3c726bc8217f3960cfecec44b81303b03de72b (patch)
tree1b85ced7f61f3e4c3f1f27b577b37aa161615065 /src-migrate/components/ui/smooth-render.tsx
parent2b3bd9c0a454dbad69ce29cee877bfb1fca5dfa6 (diff)
parenta99bf6480eea556e53b85e6db45f3b8c2361e693 (diff)
Merge branch 'release' into development
# Conflicts: # src/pages/shop/product/variant/[slug].jsx
Diffstat (limited to 'src-migrate/components/ui/smooth-render.tsx')
-rw-r--r--src-migrate/components/ui/smooth-render.tsx41
1 files changed, 41 insertions, 0 deletions
diff --git a/src-migrate/components/ui/smooth-render.tsx b/src-migrate/components/ui/smooth-render.tsx
new file mode 100644
index 00000000..5de3b28d
--- /dev/null
+++ b/src-migrate/components/ui/smooth-render.tsx
@@ -0,0 +1,41 @@
+import React from 'react'
+import clsxm from '~/libs/clsxm'
+
+type Props = {
+ children: React.ReactNode,
+ isLoaded: boolean,
+ height: string,
+ duration?: string
+ delay?: string
+} & React.HTMLProps<HTMLDivElement>
+
+const SmoothRender = (props: Props) => {
+ const {
+ children,
+ isLoaded,
+ height,
+ duration = 0,
+ delay = 0,
+ style,
+ className,
+ ...rest
+ } = props
+
+ return (
+ <div
+ className={clsxm('overflow-y-hidden transition-all', className)}
+ style={{
+ opacity: isLoaded ? 1 : 0,
+ height: isLoaded ? height : 0,
+ transitionDuration: duration || '',
+ transitionDelay: delay || '',
+ ...style
+ }}
+ {...rest}
+ >
+ {isLoaded && children}
+ </div>
+ )
+}
+
+export default SmoothRender \ No newline at end of file