Skip to content

Commit fc62bb7

Browse files
committed
fix user profile page grid layout shift on mobile devices
1 parent 5747752 commit fc62bb7

File tree

2 files changed

+50
-47
lines changed

2 files changed

+50
-47
lines changed

src/components/Modal/Modal.css

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.modal {
22
background-color: var(--background-modal, #cacaca);
33
}
4-
.profile {
4+
.grid-rows {
55
display: grid;
66
grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr);
77
column-gap: 20px;
@@ -18,11 +18,6 @@
1818
padding: 0;
1919
min-width: 150px;
2020
}
21-
@media screen and (max-width: 576px) {
22-
.profile {
23-
grid-template-columns: minmax(200px, 1fr);
24-
}
25-
}
2621

2722
.upload-button {
2823
display: inline-block;

src/components/Modal/Modal.js

+49-41
Original file line numberDiff line numberDiff line change
@@ -125,48 +125,56 @@ const Modal = ({ onClose }) => {
125125
{user.name}
126126
</h2>
127127
<div className="profile">
128-
<span>Submitted: </span> <span>{`${user.entries} images`}</span>
129-
<span>Age: </span>{' '}
130-
<div className="flex">
131-
<input
132-
type="number"
133-
value={newAge}
134-
disabled
135-
className="input-profile"
136-
onChange={(e) => setNewAge(+e.target.value)}
137-
onBlur={disableEditing}
138-
onKeyDown={disableEditing}
139-
aria-label="Enter your age"
140-
/>
141-
<button
142-
className="edit-profile"
143-
onClick={enableEditing}
144-
aria-label="Edit your age"
145-
>
146-
&#9998;
147-
</button>
128+
<div className="grid-rows">
129+
<span>Submitted: </span> <span>{`${user.entries} images`}</span>
148130
</div>
149-
<span>Memeber since: </span>
150-
<span>{new Date(user.joined).toLocaleDateString()}</span>
151-
<span>Email: </span>{' '}
152-
<div className="flex">
153-
<input
154-
type="email"
155-
value={newEmail}
156-
disabled
157-
className="input-profile"
158-
onChange={(e) => setNewEmail(e.target.value)}
159-
onBlur={disableEditing}
160-
onKeyDown={disableEditing}
161-
aria-label="Enter your email"
162-
/>
163-
<button
164-
className="edit-profile"
165-
onClick={enableEditing}
166-
aria-label="Edit your email"
167-
>
168-
&#9998;
169-
</button>
131+
<div className="grid-rows">
132+
<span>Age: </span>{' '}
133+
<div className="flex">
134+
<input
135+
type="number"
136+
value={newAge}
137+
disabled
138+
className="input-profile"
139+
onChange={(e) => setNewAge(+e.target.value)}
140+
onBlur={disableEditing}
141+
onKeyDown={disableEditing}
142+
aria-label="Enter your age"
143+
/>
144+
<button
145+
className="edit-profile"
146+
onClick={enableEditing}
147+
aria-label="Edit your age"
148+
>
149+
&#9998;
150+
</button>
151+
</div>
152+
</div>
153+
<div className="grid-rows">
154+
<span>Memeber since: </span>
155+
<span>{new Date(user.joined).toLocaleDateString()}</span>
156+
</div>
157+
<div className="grid-rows">
158+
<span>Email: </span>{' '}
159+
<div className="flex">
160+
<input
161+
type="email"
162+
value={newEmail}
163+
disabled
164+
className="input-profile"
165+
onChange={(e) => setNewEmail(e.target.value)}
166+
onBlur={disableEditing}
167+
onKeyDown={disableEditing}
168+
aria-label="Enter your email"
169+
/>
170+
<button
171+
className="edit-profile"
172+
onClick={enableEditing}
173+
aria-label="Edit your email"
174+
>
175+
&#9998;
176+
</button>
177+
</div>
170178
</div>
171179
</div>
172180
</div>

0 commit comments

Comments
 (0)