diff --git a/src/pages/orders-details/components/orders-card-skeleton/index.tsx b/src/pages/orders-details/components/orders-card-skeleton/index.tsx new file mode 100644 index 00000000..f8af334a --- /dev/null +++ b/src/pages/orders-details/components/orders-card-skeleton/index.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import styles from './orderDetailsSkeleton.module.scss'; + +export default function OrderDetailsSkeleton() { + return ( +
+
+
+
+
+
+ +
+ +
+ {Array(3).fill(0).map((_, index) => ( +
+ ))} +
+
+ +
+ {Array(4).fill(0).map((_, index) => ( +
+ ))} + +
+
+
+ ); +} diff --git a/src/pages/orders-details/components/orders-card-skeleton/orderDetailsSkeleton.module.scss b/src/pages/orders-details/components/orders-card-skeleton/orderDetailsSkeleton.module.scss new file mode 100644 index 00000000..1092fa46 --- /dev/null +++ b/src/pages/orders-details/components/orders-card-skeleton/orderDetailsSkeleton.module.scss @@ -0,0 +1,102 @@ +.skeletonHolder { + display: flex; + justify-content: space-between; + padding: 2%; + gap: 20px; + width: 100%; + min-height: 650px; + background-color: #f6f6f6; +} + +.skeletonPurchaseCards { + width: 65%; + background-color: #fff; + box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2); + border-radius: 7px; + padding: 20px; +} + +.skeletonHeader { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +} + +.skeletonTitle { + width: 40%; + height: 20px; + background-color: #e0e0e0; + border-radius: 5px; +} + +.skeletonButton { + width: 25%; + height: 30px; + background-color: #e0e0e0; + border-radius: 5px; +} + +.skeletonAddress { + height: 20px; + width: 70%; + background-color: #e0e0e0; + border-radius: 5px; + margin-bottom: 20px; +} + +.skeletonScroll { + height: 400px; + overflow: hidden; + display: flex; + flex-direction: column; + gap: 10px; +} + +.skeletonOrderSubCard { + width: 100%; + height: 80px; + background-color: #e0e0e0; + border-radius: 5px; +} + +.skeletonOrdersResume { + width: 30%; + background-color: #fff; + box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2); + border-radius: 7px; + padding: 20px; + display: flex; + flex-direction: column; + gap: 15px; +} + +.skeletonResumeRow { + width: 100%; + height: 20px; + background-color: #e0e0e0; + border-radius: 5px; +} + +.skeletonCheckoutButton { + width: 100%; + height: 40px; + background-color: #e0e0e0; + border-radius: 7px; + margin-top: 20px; +} + +@media (max-width: 768px) { + .skeletonHolder { + flex-direction: column; + gap: 20px; + } + + .skeletonPurchaseCards { + width: 100%; + } + + .skeletonOrdersResume { + width: 100%; + } +} diff --git a/src/pages/orders-details/controller/order-details.controller.tsx b/src/pages/orders-details/controller/order-details.controller.tsx index 5dcab7cf..ca35c5f5 100644 --- a/src/pages/orders-details/controller/order-details.controller.tsx +++ b/src/pages/orders-details/controller/order-details.controller.tsx @@ -3,8 +3,8 @@ import { useRouter } from 'next/router'; import { HomePageDefault } from '@/components/home-page-default'; import OrderDetails from '../view'; import { useOrdersDetailsInfo } from '@/hooks/use-order-details-info'; -import OrdersCardSkeleton from '../../orders/components/orders-card-skeleton'; import { useEffect } from 'react'; +import OrderDetailsSkeleton from '../components/orders-card-skeleton'; export default function OrderDetailsController() { const router = useRouter(); @@ -21,7 +21,7 @@ export default function OrderDetailsController() { return ( {isLoading ? ( - + ) : ( )} diff --git a/src/pages/orders-details/view/index.tsx b/src/pages/orders-details/view/index.tsx index 701cafd4..e580c754 100644 --- a/src/pages/orders-details/view/index.tsx +++ b/src/pages/orders-details/view/index.tsx @@ -3,11 +3,11 @@ import { useRouter } from 'next/router'; import { AiOutlineArrowLeft } from 'react-icons/ai'; import styles from './orders-details.module.scss'; import { OrderItem } from '@/contexts/orders/types'; -import OrdersCardSkeleton from '../../orders/components/orders-card-skeleton'; import OrderSubCard from '../components/order-subtile-card'; import OrdersResume from '../components/order-resume'; import { useTranslation } from 'react-i18next'; import getDeviceType from '@/utils/get-device-type'; +import OrderDetailsSkeleton from '../components/orders-card-skeleton'; interface OrderDetailsProps { order: OrderItem; @@ -41,7 +41,7 @@ export default function OrderDetails({ order, isLoading }: OrderDetailsProps) { }; if (isLoading) { - return ; + return ; } return ( diff --git a/src/pages/orders/components/orders-card-skeleton/index.tsx b/src/pages/orders/components/orders-card-skeleton/index.tsx index 26c3748d..67f9cbb8 100644 --- a/src/pages/orders/components/orders-card-skeleton/index.tsx +++ b/src/pages/orders/components/orders-card-skeleton/index.tsx @@ -1,17 +1,24 @@ -import { Card, CardContent, CardMedia, Skeleton } from '@mui/material' -import React from 'react' +import React from 'react'; +import styles from './ordersCardSkeleton.module.scss'; export default function OrdersCardSkeleton() { - return ( - - - - - - - - ) + return ( +
+
+
+ {Array(5) + .fill(0) + .map((_, index) => ( +
+
+
+
+
+
+
+
+ ))} +
+
+ ); } diff --git a/src/pages/orders/components/orders-card-skeleton/ordersCardSkeleton.module.scss b/src/pages/orders/components/orders-card-skeleton/ordersCardSkeleton.module.scss new file mode 100644 index 00000000..9c5e2e65 --- /dev/null +++ b/src/pages/orders/components/orders-card-skeleton/ordersCardSkeleton.module.scss @@ -0,0 +1,84 @@ +.skeletonHolder { + width: 100%; + min-height: 390px; + background-color: #f6f6f6; + display: flex; + flex-direction: column; + margin: 2% auto; + padding: 20px; + border-radius: 7px; +} + +.skeletonTitle { + width: 50%; + height: 24px; + background-color: #e0e0e0; + margin-bottom: 20px; + border-radius: 4px; +} + +.skeletonList { + display: flex; + flex-direction: column; + gap: 15px; +} + +.skeletonCard { + height: 150px; + display: flex; + gap: 15px; + padding: 15px; + background-color: #ffffff; + border-radius: 7px; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); +} + +.skeletonImage { + width: 80px; + height: 80px; + background-color: #e0e0e0; + border-radius: 4px; + flex-shrink: 0; +} + +.skeletonContent { + display: flex; + flex-direction: column; + flex-grow: 1; + gap: 10px; +} + +.skeletonText { + width: 80%; + height: 16px; + background-color: #e0e0e0; + border-radius: 4px; +} + +.skeletonText:nth-child(2) { + width: 60%; +} + +.skeletonButton { + width: 100px; + height: 30px; + background-color: #e0e0e0; + border-radius: 4px; + margin-top: auto; +} + +@media (max-width: 768px) { + .skeletonCard { + flex-direction: column; + align-items: center; + } + + .skeletonImage { + width: 60px; + height: 60px; + } + + .skeletonButton { + width: 80%; + } +} diff --git a/src/pages/profile/components/profile-card-skeleton/index.tsx b/src/pages/profile/components/profile-card-skeleton/index.tsx index 9a36abe1..5e2d0049 100644 --- a/src/pages/profile/components/profile-card-skeleton/index.tsx +++ b/src/pages/profile/components/profile-card-skeleton/index.tsx @@ -1,17 +1,34 @@ -import { Card, CardContent, CardMedia, Skeleton } from '@mui/material' -import React from 'react' +import React from 'react'; +import Styles from './profileSkeleton.module.scss'; -export default function ProfileCardSkeleton() { - return ( - - - - - - - - ) +export default function ProfileCardSkeleton() { + return ( +
+
+
+

+
+ {Array(5).fill(0).map((_, index) => ( +
+ + +
+ ))} +
+
+ +
+

+ {Array(7).fill(0).map((_, index) => ( +
+ +
+
+ ))} +
+
+
+
+
+ ); } diff --git a/src/pages/profile/components/profile-card-skeleton/profileSkeleton.module.scss b/src/pages/profile/components/profile-card-skeleton/profileSkeleton.module.scss new file mode 100644 index 00000000..c6100966 --- /dev/null +++ b/src/pages/profile/components/profile-card-skeleton/profileSkeleton.module.scss @@ -0,0 +1,135 @@ +.profileSkeleton { + display: flex; + justify-content: space-between; + width: 100%; + height: 670px; + background-color: #f0f0f0; + padding: 20px; + gap: 20px; + + .avatarSection { + width: 25%; + height: 100%; + background-color: #e0e0e0; + border-radius: 8px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 20px; + + .avatarContainer { + width: 120px; + height: 120px; + border-radius: 50%; + background-color: #ccc; + } + + .skeletonText { + width: 60%; + height: 20px; + background-color: #ccc; + border-radius: 4px; + } + + .userDetails { + width: 100%; + display: flex; + flex-direction: column; + gap: 10px; + + .detailRow { + display: flex; + justify-content: space-between; + padding: 5px; + + .skeletonLabel, .skeletonValue { + width: 45%; + height: 15px; + background-color: #ddd; + border-radius: 4px; + } + } + } + } + + .infoSection { + width: 70%; + height: 100%; + background-color: #e0e0e0; + border-radius: 8px; + padding: 20px; + display: flex; + flex-direction: column; + gap: 20px; + + .skeletonText { + width: 30%; + height: 20px; + background-color: #ccc; + border-radius: 4px; + } + + .inputRow { + display: flex; + align-items: center; + gap: 10px; + + .skeletonLabel { + width: 15%; + height: 15px; + background-color: #ddd; + border-radius: 4px; + } + + .skeletonInput { + flex: 1; + height: 15px; + background-color: #ddd; + border-radius: 4px; + } + } + + .saveButtonContainer { + display: flex; + justify-content: flex-end; + + .skeletonButton { + width: 100px; + height: 35px; + background-color: #ccc; + border-radius: 4px; + } + } + } + + @media (max-width: 768px) { + flex-direction: column; + height: auto; + + .avatarSection { + width: 100%; + height: auto; + + .avatarContainer { + width: 80px; + height: 80px; + } + } + + .infoSection { + width: 100%; + .inputRow { + flex-direction: column; + + .skeletonLabel, .skeletonInput { + width: 100%; + } + } + + .saveButtonContainer { + justify-content: center; + } + } + } +}