Skip to content

Commit 61fb3c9

Browse files
fix: style issue contacts
1 parent 893f0e0 commit 61fb3c9

File tree

3 files changed

+111
-71
lines changed

3 files changed

+111
-71
lines changed

src/components/CustomFormInputs/index.tsx

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// src/form-component/FormInputText.tsx
22
import { Control, Controller } from 'react-hook-form';
33
import TextField from '@mui/material/TextField';
4+
import { FormGroup, FormLabel, InputLabel, useTheme } from '@mui/material';
45

56
type FormInputProps = {
67
name: string;
@@ -9,22 +10,18 @@ type FormInputProps = {
910
};
1011

1112
export const FormInputText = ({ name, control, label }: FormInputProps) => {
13+
const theme = useTheme();
14+
1215
const classes = {
1316
textField: {
1417
borderRadius: '10px',
15-
background: '#FFF',
16-
color: '#000',
17-
border: '1px solid #9F9F9F',
18-
'& .MuiInputBase-input': {
19-
border: 'none',
20-
height: '100%',
18+
background: '#fff',
19+
padding: '0.85rem 0',
20+
'& :focus': {
21+
background: '#f3f3f3',
2122
},
22-
'&:hover': {
23-
border: '1px solid #9F9F9F',
24-
},
25-
'&:active': {
26-
borderRadius: '10px',
27-
border: '1px solid #9F9F9F',
23+
'& .MuiInputBase-input': {
24+
padding: '1rem',
2825
},
2926
},
3027
};
@@ -33,17 +30,21 @@ export const FormInputText = ({ name, control, label }: FormInputProps) => {
3330
name={name}
3431
control={control}
3532
render={({ field: { onChange, value }, fieldState: { error }, formState }) => (
36-
<TextField
37-
helperText={error ? error.message : null}
38-
size='small'
39-
error={!!error}
40-
onChange={onChange}
41-
value={value}
42-
fullWidth
43-
label={label}
44-
variant='outlined'
45-
sx={classes.textField}
46-
/>
33+
<FormGroup>
34+
<InputLabel htmlFor={name} sx={{ textTransform: 'capitalize', letterSpacing: '1.2px' }}>
35+
{name}
36+
</InputLabel>
37+
<TextField
38+
helperText={error ? error.message : null}
39+
size='small'
40+
error={!!error}
41+
onChange={onChange}
42+
value={value}
43+
fullWidth
44+
variant='outlined'
45+
sx={classes.textField}
46+
/>
47+
</FormGroup>
4748
)}
4849
/>
4950
);

src/scenes/Cart/index.tsx

+68-40
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,73 @@
11
import { Box, Button, Container, Grid, Typography, useTheme } from '@mui/material';
2-
import { DataGrid, GridColDef, GridValueGetterParams } from '@mui/x-data-grid';
2+
import { DataGrid, GridColDef, GridColTypeDef, GridValueGetterParams } from '@mui/x-data-grid';
33
import Header from '../../components/Header';
44
import FlexBetween from '../../components/FlexBetween';
5+
import { useMemo } from 'react';
6+
7+
const classes = {
8+
cartContainer: {
9+
background: '#F9F1E7',
10+
width: '393px',
11+
height: '390px',
12+
display: 'flex',
13+
flexDirection: 'column',
14+
justifyContent: 'space-around',
15+
p: '1.5rem 2.5rem',
16+
},
17+
title: {
18+
color: '#000',
19+
fontSize: '32px',
20+
fontStyle: 'normal',
21+
fontWeight: '600',
22+
lineHeight: 'normal',
23+
},
24+
subtitle: {
25+
color: '#9F9F9F',
26+
fontSize: '16px',
27+
fontStyle: 'normal',
28+
fontWeight: '400',
29+
lineHeight: 'normal',
30+
},
31+
highlight: {
32+
color: 'var(--primary, #B88E2F)',
33+
fontSize: '20px',
34+
fontStyle: 'normal',
35+
fontWeight: '500',
36+
lineHeight: 'normal',
37+
},
38+
orderBtn: {
39+
border: '1px solid #000',
40+
padding: '0.5rem 1.5rem',
41+
color: '#000',
42+
letterSpacing: '1.25px',
43+
},
44+
root: {
45+
display: 'flex',
46+
height: '100%',
47+
},
48+
dataGrid: {
49+
flexGrow: 1,
50+
},
51+
};
552

653
const Cart = () => {
7-
const classes = {
8-
cartContainer: {
9-
background: '#F9F1E7',
10-
width: '393px',
11-
height: '390px',
12-
display: 'flex',
13-
flexDirection: 'column',
14-
justifyContent: 'space-around',
15-
p: '1.5rem 2.5rem',
16-
},
17-
title: {
18-
color: '#000',
19-
fontSize: '32px',
20-
fontStyle: 'normal',
21-
fontWeight: '600',
22-
lineHeight: 'normal',
23-
},
24-
subtitle: {
25-
color: '#9F9F9F',
26-
fontSize: '16px',
27-
fontStyle: 'normal',
28-
fontWeight: '400',
29-
lineHeight: 'normal',
30-
},
31-
highlight: {
32-
color: 'var(--primary, #B88E2F)',
33-
fontSize: '20px',
34-
fontStyle: 'normal',
35-
fontWeight: '500',
36-
lineHeight: 'normal',
37-
},
38-
orderBtn: {
39-
border: '1px solid #000',
40-
padding: '0.5rem 1.5rem',
41-
color: '#000',
42-
letterSpacing: '1.25px',
43-
},
44-
};
54+
const columns: GridColDef[] = useMemo(
55+
() => [
56+
{ field: 'product', headerName: 'Product', editable: false, sortable: false, width: 170 },
57+
{ field: 'price', headerName: 'Price', width: 120 },
58+
{ field: 'quantity', headerName: 'Quantity', width: 120 },
59+
{ field: 'subtotal', headerName: 'Subtotal', width: 140 },
60+
],
61+
[]
62+
);
63+
64+
const rows = [
65+
{ id: 1, product: 'super test', price: 32, quantity: 1, subtotal: 32 },
66+
{ id: 1, product: 'super test', price: 32, quantity: 1, subtotal: 32 },
67+
{ id: 1, product: 'super test', price: 32, quantity: 1, subtotal: 32 },
68+
{ id: 1, product: 'super test', price: 32, quantity: 1, subtotal: 32 },
69+
];
70+
4571
return (
4672
<>
4773
<Header title='Cart' location='Home' location1='Cart' />
@@ -51,7 +77,9 @@ const Cart = () => {
5177
>
5278
<Grid container>
5379
{/* LEFT */}
54-
<Grid item xs={12} md={6} lg={8}></Grid>
80+
<Grid item xs={12} md={6} lg={8}>
81+
<DataGrid rows={rows} columns={columns} className={classes.dataGrid} />
82+
</Grid>
5583
<Grid item xs={12} md={6} lg={4}>
5684
{/* RIGHT */}
5785
<Box sx={classes.cartContainer}>

src/scenes/Contact/fragments/ContactForm.tsx

+19-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const ContactForm = () => {
1717
return (
1818
<>
1919
<Grid container>
20-
<Grid item md={6} lg={4}>
20+
{/* LEFT SIDE */}
21+
<Grid item md={6} lg={4} sx={{ p: '1.25rem' }}>
2122
<Box display='flex' flexWrap='wrap' justifyContent='space-around' gap='2.8rem'>
2223
<FlexBetween>
2324
<Box component='img' alt='location' src='/assets/location.svg' />
@@ -67,9 +68,10 @@ const ContactForm = () => {
6768
</Box>
6869
</Grid>
6970

71+
{/* RIGHT SIDE */}
7072
<Grid item xs={12} md={6} lg={8}>
71-
{' '}
72-
<form
73+
<Box
74+
component='form'
7375
onSubmit={handleSubmit(onSubmit)}
7476
style={{
7577
display: 'flex',
@@ -79,11 +81,20 @@ const ContactForm = () => {
7981
gap: '3.5rem',
8082
}}
8183
>
82-
<FormInputText name='name' control={control} label='Your name' />
83-
<FormInputText name='email' control={control} label='Email Address' />
84-
<FormInputText name='subject' control={control} label='Subject' />
85-
<FormInputText name='message' control={control} label='Message' />
86-
</form>
84+
<Box minWidth='529px'>
85+
<FormInputText name='name' control={control} label='Your name' />
86+
</Box>
87+
88+
<Box minWidth='529px'>
89+
<FormInputText name='email' control={control} label='Email Address' />
90+
</Box>
91+
<Box minWidth='529px'>
92+
<FormInputText name='subject' control={control} label='Subject' />
93+
</Box>
94+
<Box minWidth='529px'>
95+
<FormInputText name='message' control={control} label='Message' />
96+
</Box>
97+
</Box>
8798
<Box mt='2.5rem' mb='0.5rem' textAlign={'center'}>
8899
<Button
89100
type='submit'

0 commit comments

Comments
 (0)