-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/pooriaset/nextjs-shop-app
- Loading branch information
Showing
7 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"Swipeable", | ||
"swiper", | ||
"usehooks", | ||
"Woocommerce", | ||
"Yekan", | ||
"چنده" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/components/VariableProductItem/VariableProductItemSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use client'; | ||
|
||
import { useAppContext } from '@/hooks/useAppContext'; | ||
import { Box, Card, CardContent, Skeleton } from '@mui/material'; | ||
|
||
const VariableProductItemSkeleton = () => { | ||
const { variantImageSize, isMobile } = useAppContext(); | ||
|
||
return ( | ||
<Card | ||
variant="outlined" | ||
sx={{ | ||
display: 'block', | ||
height: '100%', | ||
}} | ||
> | ||
<CardContent | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: isMobile ? 'row' : 'column', | ||
gap: 1, | ||
}} | ||
> | ||
<Skeleton height={variantImageSize} width="100%" /> | ||
{!isMobile && <Box mt={3} />} | ||
|
||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'space-between', | ||
gap: 1, | ||
width: '100%', | ||
}} | ||
> | ||
<Skeleton variant="text" width={90} /> | ||
|
||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'top', | ||
justifyContent: 'space-between', | ||
mt: 1, | ||
}} | ||
> | ||
<Box> | ||
<Skeleton variant="text" width={40} /> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default VariableProductItemSkeleton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as VariableProductItem } from './VariableProductItem'; | ||
export { default as VariableProductItemSkeleton } from './VariableProductItemSkeleton'; | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const MOBILE_PRODUCT_VARIANT_IMAGE_SIZE = 120; | ||
export const DESKTOP_PRODUCT_VARIANT_IMAGE_SIZE = 240; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { DESKTOP_PRODUCT_VARIANT_IMAGE_SIZE } from '@/config/images'; | ||
import { createContext } from 'react'; | ||
|
||
export interface IAppContext { | ||
isMobile: null | boolean; | ||
variantImageSize: number; | ||
} | ||
export const appContext = createContext<IAppContext>({ | ||
isMobile: null, | ||
variantImageSize: DESKTOP_PRODUCT_VARIANT_IMAGE_SIZE, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters