-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from builtbysuraj/style-refactor-client
Style, husky, lint-staged
- Loading branch information
Showing
14 changed files
with
915 additions
and
115 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 |
---|---|---|
@@ -1,45 +1 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
echo ' | ||
💅🛠️ Formatting and testing project before committing... | ||
' | ||
|
||
# Check tsconfig standards | ||
npm run check-types || | ||
( | ||
echo ' | ||
TypeScript Check Failed. ❌ | ||
Make the required changes listed above, add changes and try to commit again. | ||
' | ||
false; | ||
) | ||
|
||
|
||
# Check ESLint Standards | ||
npm run check-lint || | ||
( | ||
echo ' | ||
ESLint Check Failed. ❌ | ||
Make the required changes listed above, add changes and try to commit again. | ||
' | ||
false; | ||
) | ||
|
||
|
||
# Check Prettier standards | ||
npm run check-format-client || | ||
( | ||
echo ' | ||
Prettier Check Failed. ❌ | ||
Run npm run format, add changes and try commit again.'; | ||
false; | ||
) | ||
|
||
npm run check-format-server || | ||
( | ||
echo ' | ||
Prettier Check Failed. ❌ | ||
Run npm run format, add changes and try commit again.'; | ||
false; | ||
) | ||
npx lint-staged |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,12 @@ | ||
import { ServerStatusContext } from '@/context/ServerStatusProvider' | ||
import { useContext } from 'react' | ||
|
||
export default function useServerStatus() { | ||
const context = useContext(ServerStatusContext) | ||
if (context === undefined) { | ||
throw new Error( | ||
'useServerStatus must be used within an ServerStatusProvider' | ||
) | ||
} | ||
return context | ||
} |
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,11 +1,9 @@ | ||
@import '../../assets/css/colors.css'; | ||
|
||
.cart-container { | ||
width: 1300px; | ||
display: flex; | ||
justify-content: space-between; | ||
margin: auto; | ||
margin-top: 1.2rem; | ||
gap: 1.2rem; | ||
min-height: 100%; | ||
min-height: 100vh; | ||
} |
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
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
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
66 changes: 42 additions & 24 deletions
66
client/src/pages/cart/components/cart-price-details/CartPriceDetails.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 |
---|---|---|
@@ -1,38 +1,56 @@ | ||
import { Divider } from '@mui/material' | ||
|
||
import type { CartType } from '@/types' | ||
import { totalCartPrice } from '@/utils' | ||
import { calculateTotalDiscount, cx, totalCartPrice } from '@/utils' | ||
import shield from '../../../../assets/img/shield.svg' | ||
import styles from './CartPriceDetails.module.css' | ||
|
||
type Props = { | ||
type CartDataProps = { | ||
cartData: CartType[] | ||
} | ||
|
||
export default function CartPriceDetails({ cartData }: Props) { | ||
export default function CartPriceDetails({ cartData }: CartDataProps) { | ||
return ( | ||
<div className={styles.cartPrice}> | ||
<span>PRICE DETAILS</span> | ||
<Divider /> | ||
<section> | ||
<span>{`Price (${cartData.length} items) `}</span> | ||
<span>${`${totalCartPrice(cartData)}`}</span> | ||
</section> | ||
<section> | ||
<span>Discount</span> | ||
<span>- $134</span> | ||
</section> | ||
<section> | ||
<span>Delivery Charges</span> | ||
<div> | ||
<div className={styles.cartPrice}> | ||
<span className={styles.cartPriceHeading}>PRICE DETAILS</span> | ||
<Divider /> | ||
<section className={styles.price}> | ||
<span>{`Price (${cartData.length} items) `}</span> | ||
<span>${`${totalCartPrice(cartData)}`}</span> | ||
</section> | ||
<section> | ||
<span>Discount</span> | ||
<span className={styles.green}> | ||
− ${calculateTotalDiscount(cartData)} | ||
</span> | ||
</section> | ||
<section className={styles.delivery}> | ||
<span>Delivery Charges</span> | ||
<span> | ||
<s>$40</s> | ||
<span className={styles.green}>Free</span> | ||
</span> | ||
</section> | ||
<Divider /> | ||
<section className={styles.totalAmount}> | ||
<div>Total Amount</div> | ||
<span>${`${totalCartPrice(cartData)}`}</span> | ||
</section> | ||
<Divider /> | ||
<p className={cx(styles.green, styles.saving)}> | ||
You will save ${calculateTotalDiscount(cartData)} on this order | ||
</p> | ||
</div> | ||
<div className={styles.secureSection}> | ||
<span> | ||
<s>$340</s> Free | ||
<img width={25} src={shield} alt="shield" /> | ||
</span> | ||
</section> | ||
<Divider /> | ||
<section> | ||
<strong>Total Amount</strong> | ||
<strong>${`${totalCartPrice(cartData)}`}</strong> | ||
</section> | ||
<p>You will save $134 on this order</p> | ||
<span> | ||
Safe and Secure Payments. Easy returns. <br /> 100% Authentic | ||
products. | ||
</span> | ||
</div> | ||
</div> | ||
) | ||
} |
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
Oops, something went wrong.