Skip to content

Commit 1b1911e

Browse files
authored
Merge pull request #270 from J-Siu/master
Fix#269
2 parents 37e7f36 + 6f34839 commit 1b1911e

File tree

3 files changed

+51
-55
lines changed

3 files changed

+51
-55
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const App = () => {
3535
} = useUserPreferences()
3636

3737
useLayoutEffect(() => {
38-
document.documentElement.style.setProperty('--max-visible-cards', maxVisibleCards.toString())
38+
document.documentElement.style.setProperty('--user-cards-count', maxVisibleCards.toString())
3939
}, [maxVisibleCards])
4040

4141
useEffect(() => {

src/assets/App.css

Lines changed: 46 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ a {
2929
display: flex;
3030
flex-direction: column;
3131
height: 100vh;
32+
max-width: 3000px;
3233
}
3334

3435
.errorMsg {
@@ -104,13 +105,17 @@ a {
104105
box-sizing: border-box;
105106
display: flex;
106107
flex: 1 1 auto;
107-
gap: 12px;
108+
gap: var(--cards-gap);
108109
height: 100%;
109-
justify-content: space-between;
110110
overflow-y: hidden;
111111
padding-top: 20px;
112112
position: relative;
113113
scroll-snap-type: x mandatory;
114+
flex-wrap: nowrap;
115+
}
116+
117+
.Cards > * {
118+
flex: 0 0 calc((100% - ((var(--visible-cards)) * var(--cards-gap))) / var(--visible-cards));
114119
}
115120

116121
.HorizontalScroll {
@@ -185,23 +190,16 @@ a {
185190
fill: var(--app-name-text-color);
186191
}
187192

188-
.cards {
189-
display: flex;
190-
align-items: flex-start;
191-
flex-direction: row;
192-
flex-wrap: wrap;
193-
}
194-
195193
.block {
196194
background-color: var(--card-background-color);
197195
border: 1px solid var(--card-border-color);
198196
flex-direction: column;
199-
flex: 0 0 auto;
200197
height: calc(100% - 54px);
201198
overflow: hidden;
202199
padding-bottom: 56px;
200+
box-sizing: border-box;
203201
scroll-snap-align: start;
204-
width: 100vw;
202+
width: 100%;
205203
}
206204

207205
.blockContent {
@@ -1345,8 +1343,43 @@ Producthunt item
13451343
}
13461344
}
13471345

1346+
@media (min-width: 768px) {
1347+
html {
1348+
--max-layout-cards-count: 2;
1349+
}
1350+
}
1351+
1352+
@media (min-width: 1200px) {
1353+
html {
1354+
--max-layout-cards-count: 4;
1355+
}
1356+
.App {
1357+
margin: 0 auto;
1358+
}
1359+
}
1360+
1361+
@media (min-width: 1800px) {
1362+
html {
1363+
--max-layout-cards-count: 5;
1364+
}
1365+
.App {
1366+
margin: 0 auto;
1367+
max-width: 1800px;
1368+
}
1369+
}
1370+
1371+
@media (min-width: 2048px) {
1372+
html {
1373+
--max-layout-cards-count: 6;
1374+
}
1375+
.App {
1376+
margin: 0 auto;
1377+
max-width: 3000px;
1378+
}
1379+
}
1380+
13481381
/* Small devices (portrait tablets and large phones, 600px and up) */
1349-
@media only screen and (min-width: 768px) {
1382+
@media (min-width: 768px) {
13501383
.floatingFilter {
13511384
display: none;
13521385
}
@@ -1355,7 +1388,6 @@ Producthunt item
13551388
border-radius: 10px;
13561389
height: 100%;
13571390
padding-bottom: 0;
1358-
width: calc(95vw / min(2, var(--max-visible-cards)));
13591391
}
13601392

13611393
.blockContent {
@@ -1390,7 +1422,7 @@ Producthunt item
13901422
}
13911423

13921424
/* Medium devices (landscape tablets, 768px and up) */
1393-
@media only screen and (min-width: 768px) {
1425+
@media (min-width: 768px) {
13941426
.AppHeader {
13951427
height: auto;
13961428
}
@@ -1400,10 +1432,6 @@ Producthunt item
14001432
width: auto;
14011433
}
14021434

1403-
.block {
1404-
width: calc(96vw / min(3, var(--max-visible-cards)));
1405-
}
1406-
14071435
.searchBar {
14081436
width: auto;
14091437
}
@@ -1416,41 +1444,6 @@ Producthunt item
14161444
}
14171445
}
14181446

1419-
/* Large devices (desktops, 992px and up)*/
1420-
@media only screen and (min-width: 992px) {
1421-
.block {
1422-
width: calc(96vw / min(3, var(--max-visible-cards)));
1423-
}
1424-
}
1425-
1426-
/* X-Large devices (large desktops, 1200px and up)*/
1427-
@media only screen and (min-width: 1200px) {
1428-
.block {
1429-
width: calc(96vw / min(4, var(--max-visible-cards)));
1430-
}
1431-
}
1432-
1433-
/* XX-Large devices (larger desktops, 1400px and up)*/
1434-
@media only screen and (min-width: 1400px) {
1435-
.block {
1436-
width: calc(95vw / min(4, var(--max-visible-cards)));
1437-
}
1438-
}
1439-
1440-
@media (min-width: 1800px) {
1441-
.App {
1442-
width: 1800px;
1443-
margin: 0 auto;
1444-
padding: 0;
1445-
}
1446-
1447-
.block {
1448-
width: calc(
1449-
(1800px - 20px * min(5, var(--max-visible-cards))) / min(5, var(--max-visible-cards))
1450-
);
1451-
}
1452-
}
1453-
14541447
/***** PAGE ****/
14551448
.Page {
14561449
max-width: 1024px;

src/assets/variables.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
}
1212

1313
html {
14-
--max-visible-cards: 4;
14+
--user-cards-count: 4;
15+
--max-layout-cards-count: 1;
16+
--visible-cards: min(var(--max-layout-cards-count), var(--user-cards-count, 1));
17+
--cards-gap: 12px;
1518
}
1619

1720
html.dark {

0 commit comments

Comments
 (0)