Skip to content

Commit 877c2ef

Browse files
committed
improving responsivity on different devices
1 parent 7ad1145 commit 877c2ef

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/Configuration.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ const Configuration = ({ previewBox, activeLightSource = 1 }) => {
1919
const [maxSize, setMaxSize] = useState(410)
2020
const [maxRadius, setMaxRadius] = useState(150)
2121
const [gradient, setGradient] = useState(false)
22-
const [codeString, setCodeString] = useState(`background: linear-gradient(145deg);
23-
box-shadow: 30px 30px var(--blur) var(--lightColor),
24-
-30px -30px var(--blur) var(--darkColor);`)
22+
const [codeString, setCodeString] = useState('')
2523
const codeContainer = useRef()
2624
const code = useRef()
2725
const colorInput = useRef()
@@ -32,10 +30,12 @@ const Configuration = ({ previewBox, activeLightSource = 1 }) => {
3230
setColor(value)
3331
}
3432
}
33+
3534
const handleColor = e => {
3635
window.history.replaceState('homepage', 'Title', '/' + e.target.value)
3736
setColor(e.target.value)
3837
}
38+
3939
const copyToClipboard = e => {
4040
const el = codeContainer.current
4141
el.select()
@@ -73,12 +73,14 @@ const Configuration = ({ previewBox, activeLightSource = 1 }) => {
7373
setGradient(false)
7474
}
7575
}
76+
7677
useEffect(() => {
7778
window.history.replaceState('homepage', 'Title', '/' + color)
7879
const { maxSize, size } = getSizes()
7980
setMaxSize(maxSize)
8081
setSize(size)
8182
}, [])
83+
8284
useEffect(() => {
8385
if (!isValidColor(color)) {
8486
return

src/index.scss

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
body {
2525
background: var(--baseColor);
2626
color: var(--textColor);
27-
font-family: 'Muli', sans-serif;
27+
font-family: "Muli", sans-serif;
2828
height: 100vh;
2929
display: flex;
3030
flex-direction: column;
@@ -78,7 +78,7 @@ body {
7878
}
7979
}
8080

81-
@media only screen and (min-width: 1700px) {
81+
@media only screen and (min-width: 1700px) and (min-height: 870px) {
8282
margin-bottom: 70px;
8383
h1 {
8484
font-size: 38px;
@@ -129,13 +129,15 @@ body {
129129
.container {
130130
width: 100%;
131131
text-align: center;
132+
margin-bottom: 20px;
132133

133-
@media only screen and (min-height: 740px) {
134+
@media only screen and (min-height: 800px) {
134135
margin-bottom: 70px;
135136
}
136137

137138
.flex {
138139
display: flex;
140+
align-items: flex-start;
139141

140142
@media only screen and (max-width: 680px) {
141143
flex-direction: column;
@@ -151,7 +153,7 @@ body {
151153
height: 500px;
152154
margin-right: 50px;
153155

154-
@media only screen and (min-width: 1500px) {
156+
@media only screen and (min-width: 1500px) and (min-height: 860px) {
155157
width: 600px;
156158
height: 600px;
157159
}
@@ -217,15 +219,15 @@ body {
217219
margin-bottom: 10px;
218220
}
219221

220-
@media only screen and (max-width: 680px) and (max-height: 715px) {
222+
@media only screen and (max-width: 680px) and (max-height: 715px), screen and (max-height: 720px) {
221223
margin-bottom: 10px;
222224

223225
&.row--checkbox {
224226
margin-bottom: 7px;
225227
}
226228
}
227229

228-
@media only screen and (max-width: 680px) and (max-height: 650px) {
230+
@media only screen and (max-width: 680px) and (max-height: 650px), screen and (max-height: 600px) {
229231
margin-bottom: 5px;
230232

231233
&.row--checkbox {
@@ -281,7 +283,7 @@ body {
281283
}
282284

283285
&:before {
284-
content: 'Copied to clipboard!';
286+
content: "Copied to clipboard!";
285287
position: absolute;
286288
width: 100%;
287289
height: 100%;
@@ -364,5 +366,5 @@ body {
364366
}
365367
}
366368

367-
@import './inputs.scss';
368-
@import './footer.scss';
369+
@import "./inputs.scss";
370+
@import "./footer.scss";

src/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export const getColorFromRoute = () => {
3939

4040
export const getSizes = () => {
4141
const windowWidth = window.innerWidth
42-
if (windowWidth < 1000 && window.navigator.userAgent !== 'ReactSnap') {
42+
const windowHeight = window.innerHeight
43+
if ((windowWidth < 1000 || windowHeight < 860) && window.navigator.userAgent !== 'ReactSnap') {
4344
if (windowWidth < 800) {
4445
if (windowWidth < 680) {
4546
return { maxSize: 180, size: 150 }

0 commit comments

Comments
 (0)