summaryrefslogtreecommitdiff
path: root/src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-08-08 10:39:34 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-08-08 10:39:34 +0700
commit16fed2e7d00252f5df3f9b5bdf0a5a2b2a094f76 (patch)
tree53d9f4d8991ba699b30eacfac1b2498ae1b0bf48 /src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx
parentf862f6426c28fb9245d13fb7386a88b209639d64 (diff)
Improve home page performance
Diffstat (limited to 'src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx')
-rw-r--r--src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx b/src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx
new file mode 100644
index 00000000..e9a200d9
--- /dev/null
+++ b/src/lib/flashSale/skeleton/FlashSaleSkeleton.jsx
@@ -0,0 +1,36 @@
+import useDevice from '@/core/hooks/useDevice'
+import PopularProductSkeleton from '@/lib/home/components/Skeleton/PopularProductSkeleton'
+import Skeleton from 'react-loading-skeleton'
+
+const FlashSaleSkeleton = () => {
+ return (
+ <div className='px-4 md:px-0'>
+ <TitleSkeleton />
+ <div className='my-4'>
+ <BannerSkeleton />
+ </div>
+ <PopularProductSkeleton />
+ </div>
+ )
+}
+
+const TitleSkeleton = () => {
+ return (
+ <div className='w-full md:w-[36%] flex gap-x-4'>
+ <Skeleton containerClassName='block w-1/2' height={24} />
+ <div className='w-1/2 flex gap-x-1'>
+ <Skeleton height={40} containerClassName='w-full' />
+ <Skeleton height={40} containerClassName='w-full' />
+ <Skeleton height={40} containerClassName='w-full' />
+ <Skeleton height={40} containerClassName='w-full' />
+ </div>
+ </div>
+ )
+}
+
+const BannerSkeleton = () => {
+ const { isDesktop } = useDevice()
+ return <Skeleton duration={1.2} height={isDesktop ? 192 : 48} containerClassName='w-full' />
+}
+
+export { FlashSaleSkeleton, TitleSkeleton, BannerSkeleton }