diff --git a/src/App.css b/src/App.css index 350c4001..72dc7379 100644 --- a/src/App.css +++ b/src/App.css @@ -2,40 +2,193 @@ display: flex; flex-direction: column; align-items: center; - justify-content: center; + justify-content: flex-start; + min-height: 100vh; + padding: 2rem 1rem; + max-width: 1200px; + margin: 0 auto; } -.App-logo { - height: 40vmin; - pointer-events: none; +.app-header { + text-align: center; + margin-bottom: 2rem; + width: 100%; } -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } +.app-header h1 { + color: #ffffff; + font-size: 2.5rem; + font-weight: 700; + margin: 0 0 0.5rem 0; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); + letter-spacing: -0.5px; } -.App-header { - background-color: #282c34; - min-height: 100vh; +.app-header p { + color: #ffffff; + font-size: 1.2rem; + margin: 0; + opacity: 0.95; + font-weight: 300; +} + +.cart-container { + background: #ffffff; + border-radius: 16px; + box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); + padding: 2rem; + width: 100%; + margin-bottom: 2rem; + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + +.cart-container:hover { + transform: translateY(-2px); + box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2); +} + +.shipping-container { + background: #ffffff; + border-radius: 16px; + box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); + padding: 2rem; + width: 100%; + margin-bottom: 2rem; +} + +.purchase-button { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + color: white; + border: none; + padding: 1rem 3rem; + font-size: 1.1rem; + font-weight: 600; + border-radius: 12px; + cursor: pointer; + box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); + transition: all 0.3s ease; + text-transform: uppercase; + letter-spacing: 1px; + width: 100%; + max-width: 400px; + margin: 0 auto; + display: block; +} + +.purchase-button:hover { + transform: translateY(-2px); + box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); + background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); +} + +.purchase-button:active { + transform: translateY(0); + box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4); +} + +.cart-items-list { + list-style-type: none; + padding: 0; + margin: 0; display: flex; flex-direction: column; + gap: 1rem; +} + +.cart-summary { + background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); + border-radius: 12px; + padding: 1.5rem; + margin-top: 2rem; + border: 1px solid rgba(0, 0, 0, 0.05); +} + +.cart-summary p { + margin: 0.75rem 0; + font-size: 1rem; + color: #333; + display: flex; + justify-content: space-between; align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; } -.App-link { - color: #61dafb; +.cart-summary hr { + border: none; + border-top: 2px solid rgba(102, 126, 234, 0.3); + margin: 1rem 0; +} + +.cart-summary .order-total { + font-size: 1.5rem; + font-weight: 700; + color: #667eea; + margin-top: 1rem; + padding-top: 1rem; + border-top: 2px solid rgba(102, 126, 234, 0.3); +} + +.cart-title { + color: #333; + font-size: 2rem; + font-weight: 700; + margin: 0 0 1.5rem 0; + padding-bottom: 1rem; + border-bottom: 3px solid #667eea; +} + +.shipping-title { + color: #333; + font-size: 1.5rem; + font-weight: 600; + margin: 0 0 1.5rem 0; +} + +.loading-text, +.error-text { + text-align: center; + padding: 2rem; + color: #333; + font-size: 1.2rem; +} + +.error-text { + color: #e74c3c; + background: #ffeaea; + border-radius: 8px; + border-left: 4px solid #e74c3c; } -@keyframes App-logo-spin { - from { - transform: rotate(0deg); +.shipping-option-label { + display: flex; + align-items: center; + padding: 1rem; + border-radius: 8px; + border: 2px solid #e0e0e0; + transition: all 0.3s ease; + cursor: pointer; +} + +.shipping-option-label:hover { + border-color: #667eea; + background-color: #f8f9ff; +} + +@media (max-width: 768px) { + .App { + padding: 1rem 0.5rem; } - to { - transform: rotate(360deg); + + .app-header h1 { + font-size: 2rem; + } + + .cart-container, + .shipping-container { + padding: 1.5rem; + } + + .purchase-button { + padding: 0.875rem 2rem; + font-size: 1rem; } } diff --git a/src/App.js b/src/App.js index c4b1370b..3e1b17b1 100644 --- a/src/App.js +++ b/src/App.js @@ -15,16 +15,26 @@ function App(props) { return ( <>
+
+

🛍️ Shopping Cart

Thank you for shopping with us!

+
+
+
+
-
+ + })} + > + Make Purchase +
({ root: { display: 'flex', + borderRadius: '12px', + boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)', + transition: 'all 0.3s ease', + overflow: 'hidden', + marginBottom: '0.5rem', + '&:hover': { + transform: 'translateY(-2px)', + boxShadow: '0 6px 20px rgba(0, 0, 0, 0.15)', + }, }, details: { display: 'flex', flexDirection: 'column', + flex: '1 1 auto', + padding: '1rem', }, content: { flex: '1 0 auto', + padding: '0.5rem 1rem !important', }, cover: { - height: 100, - width: '10%', - } + height: '120px', + width: '120px', + minWidth: '120px', + objectFit: 'cover', + background: 'linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%)', + }, + title: { + fontWeight: 600, + color: '#333', + marginBottom: '0.5rem', + fontSize: '1.1rem', + }, + description: { + color: '#666', + marginBottom: '0.5rem', + fontSize: '0.9rem', + }, + price: { + color: '#667eea', + fontWeight: 700, + fontSize: '1.2rem', + marginTop: '0.5rem', + }, })); export default function CartItem(props) { @@ -29,14 +61,14 @@ export default function CartItem(props) {
- + {props.item.title} - + {props.item.description} - - {(props.item.cost/100).toFixed(2)} + + ${(props.item.cost/100).toFixed(2)}
diff --git a/src/cartview.js b/src/cartview.js index 8d0322ec..6b2227a7 100644 --- a/src/cartview.js +++ b/src/cartview.js @@ -32,9 +32,9 @@ function CartView(props) { }, [props.cartId]); if (error) { - return (

Failed to retrieve cart ({error.message})

); + return (

Failed to retrieve cart ({error.message})

); } else if (!cart) { - return (

Loading shopping cart...

); + return (

Loading shopping cart...

); } else { const costs = cart.cartItems.map(a => a.cost); const itemTotal = sum(...costs); @@ -43,8 +43,8 @@ function CartView(props) { return ( <>
-

Shopping Cart

-
    +

    Shopping Cart

    +
      {cart.cartItems.map((cartItemData, idx) =>
    • @@ -52,12 +52,24 @@ function CartView(props) { )}
-
-

Items: ${(itemTotal/100).toFixed(2)}

-

Shipping: ${(props.shippingCost/100).toFixed(2)}

-

Tax: ${(tax/100).toFixed(2)}

+
+

+ Items: + ${(itemTotal/100).toFixed(2)} +

+

+ Shipping: + ${(props.shippingCost/100).toFixed(2)} +

+

+ Tax: + ${(tax/100).toFixed(2)} +


-

Order Total: ${(total/100).toFixed(2)}

+

+ Order Total: + ${(total/100).toFixed(2)} +

); diff --git a/src/index.css b/src/index.css index ec2585e8..5d9ea939 100644 --- a/src/index.css +++ b/src/index.css @@ -1,10 +1,17 @@ +* { + box-sizing: border-box; +} + body { margin: 0; + padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + min-height: 100vh; } code { diff --git a/src/msgYNModal.js b/src/msgYNModal.js index e2363baa..b90d4cab 100644 --- a/src/msgYNModal.js +++ b/src/msgYNModal.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { makeStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button'; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; @@ -7,7 +8,52 @@ import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; +const useStyles = makeStyles((theme) => ({ + dialog: { + borderRadius: '16px', + }, + dialogTitle: { + background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', + color: '#ffffff', + padding: '1.5rem', + fontWeight: 600, + fontSize: '1.5rem', + }, + dialogContent: { + padding: '2rem', + fontSize: '1.1rem', + color: '#333', + }, + dialogActions: { + padding: '1rem 1.5rem', + gap: '1rem', + }, + button: { + borderRadius: '8px', + padding: '0.5rem 2rem', + fontWeight: 600, + textTransform: 'none', + fontSize: '1rem', + }, + cancelButton: { + color: '#666', + border: '2px solid #e0e0e0', + '&:hover': { + backgroundColor: '#f5f5f5', + borderColor: '#ccc', + }, + }, + okButton: { + background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', + color: '#ffffff', + '&:hover': { + background: 'linear-gradient(135deg, #764ba2 0%, #667eea 100%)', + }, + }, +})); + function MsgYNModal(props) { + const classes = useStyles(); const { onClose, message, open, ...other } = props; const handleCancel = () => { @@ -27,20 +73,30 @@ function MsgYNModal(props) { onClose(event, reason) } }} + classes={{ paper: classes.dialog }} {...other} > - Confirmation Of Order - + + Confirmation Of Order + + {message} - - - diff --git a/src/shippingOptions.js b/src/shippingOptions.js index ae0be2bf..b6960b1b 100644 --- a/src/shippingOptions.js +++ b/src/shippingOptions.js @@ -1,11 +1,61 @@ import React, { useState } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; import Radio from '@material-ui/core/Radio'; import RadioGroup from '@material-ui/core/RadioGroup'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import PropTypes from 'prop-types'; import './App.css'; +const useStyles = makeStyles((theme) => ({ + root: { + width: '100%', + }, + title: { + color: '#333', + fontSize: '1.5rem', + fontWeight: 600, + marginBottom: '1.5rem', + }, + radioGroup: { + display: 'flex', + flexDirection: 'column', + gap: '0.75rem', + [theme.breakpoints.up('sm')]: { + flexDirection: 'row', + justifyContent: 'space-around', + }, + }, + radioLabel: { + margin: 0, + padding: '1rem', + borderRadius: '8px', + border: '2px solid #e0e0e0', + transition: 'all 0.3s ease', + width: '100%', + '&:hover': { + borderColor: '#667eea', + backgroundColor: '#f8f9ff', + }, + [theme.breakpoints.up('sm')]: { + width: 'auto', + minWidth: '200px', + flex: '1', + }, + }, + radioLabelChecked: { + borderColor: '#667eea !important', + backgroundColor: '#f0f2ff !important', + }, + radio: { + color: '#667eea', + '&.Mui-checked': { + color: '#667eea', + }, + }, +})); + function ShippingOptions(props) { + const classes = useStyles(); const [shipping, setShipping] = useState(0) const handleChange = (event, value) => { @@ -14,19 +64,34 @@ function ShippingOptions(props) { } return ( -
-

Choose your delivery option:

+
+

Choose your delivery option:

handleChange(event, value)} > - } label="Free 10 day shipping" /> - } label="$5.00 2-day shipping" /> - } label="$20.00 overnight shipping" /> + } + label="Free 10 day shipping" + classes={{ root: `${classes.radioLabel} ${shipping === 0 ? classes.radioLabelChecked : ''}` }} + /> + } + label="$5.00 2-day shipping" + classes={{ root: `${classes.radioLabel} ${shipping === 500 ? classes.radioLabelChecked : ''}` }} + /> + } + label="$20.00 overnight shipping" + classes={{ root: `${classes.radioLabel} ${shipping === 2000 ? classes.radioLabelChecked : ''}` }} + />
);