您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Checkout.jsx 3.2KB

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