Browse Source

done Checkout Page

master
azri 1 week ago
parent
commit
ad7e4fcc42

+ 69
- 0
src/components/LoginForm/LoginForm.jsx View File

1
+import React from 'react'
2
+import Grid from '@mui/material/Grid2';
3
+import { Box, Button, TextField, Link } from '@mui/material'
4
+
5
+const LoginForm = () => {
6
+
7
+    const handleSubmit = (e) => {
8
+        e.preventDefault();
9
+        // Handle form submission logic
10
+        console.log('Form submitted');
11
+      };
12
+
13
+    return (
14
+        <Grid>
15
+            <Box
16
+                component="form"
17
+                onSubmit={handleSubmit}
18
+                sx={{
19
+                    width: '100%',
20
+                    maxWidth: 400,
21
+                    mx: 'auto',
22
+                    mt: 4,
23
+                    display: 'flex',
24
+                    flexDirection: 'column',
25
+                    gap: 4,
26
+                }}
27
+            >
28
+
29
+                <TextField
30
+                    label="Email"
31
+                    type="email"
32
+                    variant="outlined"
33
+                    fullWidth
34
+                    required
35
+                />
36
+
37
+                <TextField
38
+                    label="Password"
39
+                    type="password"
40
+                    variant="outlined"
41
+                    fullWidth
42
+                    required
43
+                />
44
+
45
+                <Link>Forgot Password?</Link>
46
+
47
+                <Button
48
+                    variant="contained"
49
+                    color="common.black"
50
+                    onClick={() => { window.location.href = "/checkout" }}
51
+                    sx={{
52
+                        backgroundColor: (theme) => theme.palette.common.black,
53
+                        color: "white",
54
+                        textTransform: "none",
55
+                        mx: "auto",
56
+                        px: 8,
57
+                        py: 2,
58
+                        width: "fit-content",
59
+                        "&:hover": {
60
+                            backgroundColor: (theme) => theme.palette.grey[900],
61
+                        },
62
+                    }}>SIGN IN</Button>
63
+
64
+            </Box>
65
+        </Grid>
66
+    )
67
+}
68
+
69
+export default LoginForm

+ 1
- 0
src/components/LoginForm/index.js View File

1
+export { default } from "./LoginForm"

+ 86
- 0
src/components/SignUpForm/SignUpForm.jsx View File

1
+import React from 'react'
2
+import Grid from '@mui/material/Grid2';
3
+import { Box, Button, TextField, Link, Typography } from '@mui/material'
4
+
5
+const SignUpForm = () => {
6
+
7
+    const handleSubmit = (e) => {
8
+        e.preventDefault();
9
+        // Handle form submission logic
10
+        console.log('Form submitted');
11
+      };
12
+
13
+    return (
14
+        <Grid>
15
+            <Box
16
+                component="form"
17
+                onSubmit={handleSubmit}
18
+                sx={{
19
+                    width: '100%',
20
+                    maxWidth: 400,
21
+                    mx: 'auto',
22
+                    mt: 4,
23
+                    display: 'flex',
24
+                    flexDirection: 'column',
25
+                    gap: 4,
26
+                }}
27
+            >
28
+
29
+                <TextField
30
+                    label="Full Name"
31
+                    variant="outlined"
32
+                    fullWidth
33
+                    required
34
+                />
35
+
36
+                <TextField
37
+                    label="Email"
38
+                    type="email"
39
+                    variant="outlined"
40
+                    fullWidth
41
+                    required
42
+                />
43
+
44
+                <TextField
45
+                    label="Password"
46
+                    type="password"
47
+                    variant="outlined"
48
+                    fullWidth
49
+                    required
50
+                />
51
+
52
+                <TextField
53
+                    label="Confirm Password"
54
+                    type="password"
55
+                    variant="outlined"
56
+                    fullWidth
57
+                    required
58
+                />
59
+
60
+                
61
+
62
+                <Button
63
+                    variant="contained"
64
+                    color="common.black"
65
+                    onClick={() => { window.location.href = "/checkout" }}
66
+                    sx={{
67
+                        backgroundColor: (theme) => theme.palette.common.black,
68
+                        color: "white",
69
+                        textTransform: "none",
70
+                        mx: "auto",
71
+                        px: 8,
72
+                        py: 2,
73
+                        width: "fit-content",
74
+                        "&:hover": {
75
+                            backgroundColor: (theme) => theme.palette.grey[900],
76
+                        },
77
+                    }}>REGISTER</Button>
78
+                
79
+                <Typography variant="body1">By registering you agree to our <Link>Terms and Conditions</Link> and <Link>Privacy Policy</Link> </Typography>
80
+
81
+            </Box>
82
+        </Grid>
83
+    )
84
+}
85
+
86
+export default SignUpForm

+ 1
- 0
src/components/SignUpForm/index.js View File

1
+export { default } from "./SignUpForm"

+ 199
- 1
src/pages/Cart.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
+import { Box, Button, IconButton } from '@mui/material'
3
+import SocialMedia from '../components/SocialMedia'
4
+import Feature from '../components/Feature'
5
+import Grid from '@mui/material/Grid2';
6
+import Typography from '@mui/material/Typography';
7
+import Table from '@mui/material/Table';
8
+import TableBody from '@mui/material/TableBody';
9
+import TableCell from '@mui/material/TableCell';
10
+import TableContainer from '@mui/material/TableContainer';
11
+import TableHead from '@mui/material/TableHead';
12
+import TableRow from '@mui/material/TableRow';
13
+import AddIcon from '@mui/icons-material/Add';
14
+import RemoveIcon from '@mui/icons-material/Remove';
2
 
15
 
3
 const Cart = () => {
16
 const Cart = () => {
17
+
18
+  function createData(img_src, description, colour, quantity, price) {
19
+    return { img_src, description, colour, quantity, price };
20
+  }
21
+
22
+  const rows = [
23
+    {
24
+      img_src: 'https://via.placeholder.com/300',
25
+      name: 'MELUR',
26
+      description: 'Atma Sari New Raya Collection 2024',
27
+      colour: 'black',
28
+      quantity: 1,
29
+      price: 335.50
30
+    },
31
+    {
32
+      img_src: 'https://via.placeholder.com/300',
33
+      name: 'MELUR2',
34
+      description: 'Atma Sari New Raya Collection 2025',
35
+      colour: 'red',
36
+      quantity: 2,
37
+      price: 665.00
38
+    },
39
+  ];
40
+
4
   return (
41
   return (
5
-    <div>Cart</div>
42
+    <>
43
+      <Box sx={{ px: 24, my: 10 }}>
44
+
45
+
46
+        {/* Header */}
47
+        <Grid container spacing={2} alignItems="center" sx={{ mb: 5 }}>
48
+
49
+          {/* Type */}
50
+          <Grid item size={2}>
51
+            <Typography variant="body2">
52
+              <p>Mens Fashion <span style={{ fontWeight: "bold", marginLeft: 10, display: "inline-block" }}>Shopping Bag</span></p>
53
+            </Typography>
54
+          </Grid>
55
+
56
+          <Grid item size={4} offset={{ xs: 3 }}>
57
+            <Typography variant="h5" sx={{ fontWeight: "bold" }}>
58
+              SHOPPING BAG
59
+            </Typography>
60
+          </Grid>
61
+
62
+        </Grid>
63
+
64
+        {/* Product List */}
65
+        <TableContainer>
66
+          <Table sx={{ minWidth: 650, borderTop: "1px solid rgba(0,0,0,0.4)", borderBottom: "1px solid rgba(0,0,0,0.4)", mb: 5 }}>
67
+            <TableHead>
68
+              <TableRow>
69
+                <TableCell width={150}>
70
+                  <Typography variant='body1'>Item</Typography>
71
+                </TableCell>
72
+                <TableCell>
73
+                  <Typography variant='body1'>Description</Typography>
74
+                </TableCell>
75
+                <TableCell align='center'>
76
+                  <Typography variant='body1'>Colour</Typography>
77
+                </TableCell>
78
+                <TableCell align='center'>
79
+
80
+                  <Typography variant='body1'>Quantity</Typography>
81
+                </TableCell>
82
+                <TableCell align='center'>
83
+                  <Typography variant='body1'>Unit Price</Typography>
84
+                </TableCell>
85
+              </TableRow>
86
+            </TableHead>
87
+            <TableBody>
88
+              {rows.map((row) => (
89
+                <TableRow
90
+                  key={row.id}
91
+                  sx={{
92
+                    '& td, & th': { border: 0 },
93
+                    '&:last-child td, &:last-child th': { border: 0 }
94
+                  }}
95
+                >
96
+                  <TableCell component="th" scope="row">
97
+                    <img
98
+                      src={row.img_src}
99
+                      alt={row.img_src}
100
+                      style={{
101
+                        width: 100,
102
+                        height: 100,
103
+                        aspectRatio: '4 / 4',
104
+                        objectFit: 'cover',
105
+                      }}
106
+                    />
107
+                  </TableCell>
108
+                  <TableCell>
109
+                    <Typography variant='body2' sx={{ fontWeight: "bold", mb: 1 }}>{row.name}</Typography>
110
+                    <Typography variant='body2'>{row.description}</Typography>
111
+                  </TableCell>
112
+                  <TableCell align='center'>
113
+                    <Typography variant='h6' sx={{ fontWeight: "bold" }} >{row.colour}</Typography>
114
+                  </TableCell>
115
+                  <TableCell align='center'>
116
+                    <Box sx={{ display: "flex", justifyContent: "center" }}>
117
+                      <IconButton>
118
+                        <RemoveIcon sx={{ fontSize: 16, margin: "0 15px" }} />
119
+                      </IconButton>
120
+                      <p style={{ fontSize: 20, fontWeight: "bold" }}>{row.quantity}</p>
121
+                      <IconButton >
122
+                        <AddIcon sx={{ fontSize: 16, margin: "0 15px" }} />
123
+                      </IconButton>
124
+                    </Box>
125
+                  </TableCell>
126
+                  <TableCell align='center'>
127
+                    <Typography variant='h6' sx={{ fontWeight: "bold" }}>{`RM ${parseFloat(row.price).toFixed(2)}`}</Typography>
128
+                  </TableCell>
129
+                </TableRow>
130
+              ))}
131
+            </TableBody>
132
+          </Table>
133
+        </TableContainer>
134
+
135
+        {/* INVOICES */}
136
+        <Grid container spacing={2} sx={{ mb: 5 }}>
137
+
138
+          <Grid item size={3} sx={{ ml: "auto" }}>
139
+            <Box
140
+              display="flex"
141
+              justifyContent="space-between"
142
+              alignItems="center"
143
+              sx={{ mb: 2 }}
144
+            >
145
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>Subtotal</Typography>
146
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>{`RM ${parseFloat(500).toFixed(2)}`}</Typography>
147
+            </Box>
148
+            <Box
149
+              display="flex"
150
+              justifyContent="space-between"
151
+              alignItems="center"
152
+              sx={{ mb: 2 }}
153
+            >
154
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>Shipping</Typography>
155
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>{`RM ${parseFloat(500).toFixed(2)}`}</Typography>
156
+            </Box>
157
+            <Box
158
+              display="flex"
159
+              justifyContent="space-between"
160
+              alignItems="center"
161
+              sx={{ mb: 2 }}
162
+            >
163
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>Taxes</Typography>
164
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>{`RM ${parseFloat(500).toFixed(2)}`}</Typography>
165
+            </Box>
166
+            <Box
167
+              display="flex"
168
+              justifyContent="space-between"
169
+              alignItems="center"
170
+              sx={{ mb: 2 }}
171
+            >
172
+              <Typography variant="body1" sx={{ fontWeight: "400" }}>Total</Typography>
173
+              <Typography variant="body1" sx={{ fontWeight: "bold" }}>{`RM ${parseFloat(500).toFixed(2)}`}</Typography>
174
+            </Box>
175
+          </Grid>
176
+
177
+        </Grid>
178
+
179
+        {/* BUY NOW */}
180
+        <Box sx={{ mb: 15 }}>
181
+          <Box sx={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
182
+            <Typography variant='body2'><span style={{ fontWeight: "bolder" }}>NEED HELP?</span> CALL US: +44 (0)10 2345 6789 | EMAIL CUSTOMER CARE | SHIPPING INFORMATION | RETURNS & EXCHANGES</Typography>
183
+            <Button
184
+              variant="contained"
185
+              color="common.black"
186
+              onClick={()=>{window.location.href = "/checkout"}}
187
+              sx={{
188
+                backgroundColor: (theme) => theme.palette.common.black,
189
+                color: "white",
190
+                textTransform: "none",
191
+                px: 8,
192
+                py: 2,
193
+                "&:hover": {
194
+                  backgroundColor: (theme) => theme.palette.grey[900],
195
+                },
196
+              }}>BUY NOW</Button>
197
+          </Box>
198
+        </Box>
199
+
200
+        <SocialMedia />
201
+        <Feature />
202
+      </Box>
203
+    </>
6
   )
204
   )
7
 }
205
 }
8
 
206
 

+ 83
- 2
src/pages/Checkout.jsx View File

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

Loading…
Cancel
Save