Skip to content

Commit e586ab9

Browse files
committed
feat: enhance layout handling with dynamic class names and integrate Feed component
1 parent 3319614 commit e586ab9

3 files changed

Lines changed: 36 additions & 13 deletions

File tree

src/App.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import clsx from 'clsx'
12
import { useEffect, useLayoutEffect, useState } from 'react'
23
import { DNDLayout } from 'src/components/Layout'
34
import {
@@ -30,6 +31,7 @@ export const App = () => {
3031
maxVisibleCards,
3132
setAdvStatus,
3233
isDNDModeActive,
34+
layout,
3335
DNDDuration,
3436
setDNDDuration,
3537
} = useUserPreferences()
@@ -80,7 +82,11 @@ export const App = () => {
8082
<OnboardingModal showOnboarding={showOnboarding} setShowOnboarding={setShowOnboarding} />
8183
)}
8284

83-
<div className="layoutLayers hideScrollBar">
85+
<div
86+
className={clsx(
87+
'layoutLayers',
88+
layout === 'cards' ? 'cardsLayout hideScrollBar' : 'gridLayout scrollable'
89+
)}>
8490
{isDNDModeActive() && <DNDLayout />}
8591
<AppContentLayout />
8692
</div>

src/assets/App.css

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,13 @@ a {
411411
}
412412
.rowCover {
413413
border-radius: 4px;
414-
display: block;
414+
display: flex;
415+
align-items: center;
416+
justify-content: center;
415417
width: 100%;
416418
min-height: auto;
417419
object-fit: cover;
420+
418421
aspect-ratio: 16/9;
419422
background-color: var(--placeholder-background-color);
420423
margin-bottom: 12px;
@@ -1235,11 +1238,18 @@ Producthunt item
12351238
justify-content: center;
12361239
}
12371240

1238-
.layoutLayers {
1241+
.layoutLayers.cardsLayout {
12391242
margin-left: 1%;
12401243
margin-right: 1%;
12411244
}
12421245

1246+
.layoutLayers.gridLayout {
1247+
margin-left: 1%;
1248+
padding-right: 1%;
1249+
margin-top: 1%;
1250+
box-shadow: 0px -10px 20px -15px var(--card-border-color);
1251+
}
1252+
12431253
.Cards {
12441254
padding-bottom: 20px;
12451255
}

src/components/Layout/AppContentLayout.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useState } from 'react'
2+
import { Feed } from 'src/features/feed'
23
import { DesktopBreakpoint } from 'src/providers/DesktopBreakpoint'
34
import { MobileBreakpoint } from 'src/providers/MobileBreakpoint'
45
import { useUserPreferences } from 'src/stores/preferences'
@@ -8,21 +9,27 @@ import { MobileCards } from './MobileCards'
89
import { ScrollCardsNavigator } from './ScrollCardsNavigator'
910

1011
export const AppContentLayout = () => {
11-
const { cards, userCustomCards } = useUserPreferences()
12+
const { cards, userCustomCards, layout } = useUserPreferences()
1213
const [selectedCard, setSelectedCard] = useState(cards[0])
1314

1415
return (
1516
<>
1617
<main className="AppContent">
17-
<ScrollCardsNavigator />
18-
<DesktopBreakpoint>
19-
<DesktopCards cards={cards} userCustomCards={userCustomCards} />
20-
</DesktopBreakpoint>
21-
<MobileBreakpoint>
22-
<div className="Cards HorizontalScroll">
23-
<MobileCards selectedCard={selectedCard} />
24-
</div>
25-
</MobileBreakpoint>
18+
{layout === 'grid' ? (
19+
<Feed />
20+
) : (
21+
<>
22+
<ScrollCardsNavigator />
23+
<DesktopBreakpoint>
24+
<DesktopCards cards={cards} userCustomCards={userCustomCards} />
25+
</DesktopBreakpoint>
26+
<MobileBreakpoint>
27+
<div className="Cards HorizontalScroll">
28+
<MobileCards selectedCard={selectedCard} />
29+
</div>
30+
</MobileBreakpoint>
31+
</>
32+
)}
2633
</main>
2734
<BottomNavigation selectedCard={selectedCard} setSelectedCard={setSelectedCard} />
2835
</>

0 commit comments

Comments
 (0)