Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Checkout.jsx 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import React, { useState } from 'react'
  2. import { Box, Button, IconButton, TextField, Typography } from '@mui/material'
  3. import SocialMedia from '../components/SocialMedia'
  4. import Feature from '../components/Feature'
  5. import LoginForm from '../components/LoginForm'
  6. import SignUpForm from '../components/SignUpForm'
  7. import ShippingForm from '../components/ShippingForm'
  8. import BillingForm from '../components/BillingForm'
  9. import ConfirmOrder from '../components/ConfirmOrder'
  10. import Grid from '@mui/material/Grid2';
  11. const Checkout = () => {
  12. const [content, setContent] = useState(0);
  13. return (
  14. <Box sx={{ px: 24, my: 10 }}>
  15. {/* Header */}
  16. <Grid container spacing={2} sx={{ mb: 5 }}>
  17. <Grid item size={4} sx={{ mx: "auto" }}>
  18. <Typography variant="h5" sx={{ fontWeight: "bold", textAlign: "center" }}>
  19. {[
  20. 'LOGIN',
  21. 'SHIPPING',
  22. 'BILLING',
  23. 'CONFIRMATION'
  24. ][content]}
  25. </Typography>
  26. </Grid>
  27. </Grid>
  28. {/* Navigation */}
  29. <Grid container>
  30. <Grid item size={12} sx={{ borderTop: "1px solid rgba(0,0,0,0.2)", borderBottom: "1px solid rgba(0,0,0,0.2)", display: "flex", justifyContent: "space-evenly", py: 1 }}>
  31. <Typography variant="body1" onClick={() => { setContent(0) }} sx={{ cursor: "pointer", color: (content == 0) ? "#93ABC7" : "black" }}>Login</Typography>
  32. <Typography variant="body1" onClick={() => { setContent(1) }} sx={{ cursor: "pointer", color: (content == 1) ? "#93ABC7" : "black" }}>Shipping</Typography>
  33. <Typography variant="body1" onClick={() => { setContent(2) }} sx={{ cursor: "pointer", color: (content == 2) ? "#93ABC7" : "black" }}>Billing</Typography>
  34. <Typography variant="body1" onClick={() => { setContent(3) }} sx={{ cursor: "pointer", color: (content == 3) ? "#93ABC7" : "black" }}>Confirmation</Typography>
  35. </Grid>
  36. </Grid>
  37. {/* Content */}
  38. {(content == 0) && <Grid container sx={{ mb: 5 }}>
  39. <Grid item size={6} sx={{ borderRight: "1px solid rgba(0,0,0,0.2)", borderBottom: "1px solid rgba(0,0,0,0.2)", py: 4, textAlign: "center" }}>
  40. <Typography variant="body1" sx={{ fontWeight: "500" }}>EXISTING CUSTOMER</Typography>
  41. </Grid>
  42. <Grid item size={6} sx={{ textAlign: "center", py: 4, borderBottom: "1px solid rgba(0,0,0,0.2)" }}>
  43. <Typography variant="body1" sx={{ fontWeight: "500" }}>NEW CUSTOMER</Typography>
  44. </Grid>
  45. <Grid item size={6} sx={{ borderRight: "1px solid rgba(0,0,0,0.2)", py: 4, textAlign: "center", px: 8 }}>
  46. <Typography variant="body2">Make purchases faster using previously saved details. Track previous orders and easily request returns from the website.</Typography>
  47. <LoginForm />
  48. </Grid>
  49. <Grid item size={6} sx={{ textAlign: "center", py: 4, px: 8 }}>
  50. <Typography variant="body2">You’ll need an account to purchase watches, track and review orders, and manage your personal details.</Typography>
  51. <SignUpForm />
  52. </Grid>
  53. </Grid>}
  54. {(content == 1) && <Grid container sx={{ mb: 5 }}>
  55. <Grid item size={12}>
  56. <ShippingForm/>
  57. </Grid>
  58. </Grid>}
  59. {(content == 2) && <Grid container sx={{ mb: 5 }}>
  60. <Grid item size={12}>
  61. <BillingForm/>
  62. </Grid>
  63. </Grid>}
  64. {(content == 3) && <Grid container sx={{ mb: 5 }}>
  65. <Grid item size={12}>
  66. <ConfirmOrder/>
  67. </Grid>
  68. </Grid>}
  69. <SocialMedia />
  70. <Feature />
  71. </Box>
  72. )
  73. }
  74. export default Checkout