Skip to content

Commit a36dc76

Browse files
authored
Fanclub breakpoints (#14081)
This branch doesnt include all your changes @dylanjeffers, but I wanted to take a swing at fixing the breakpoints on this page. I like the behavior I landed on here, that said, if the code is rubbish feel free to reject and reimplement lol. ![CleanShot 2026-04-08 at 11 30 49](https://github.com/user-attachments/assets/545570f3-e26f-4357-ac7d-13c7cc99a55e)
1 parent da151c1 commit a36dc76

1 file changed

Lines changed: 57 additions & 42 deletions

File tree

packages/web/src/pages/fan-club-detail-page/FanClubDetailContent.tsx

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,71 @@ import { FanClubInsights } from './components/FanClubInsights'
77
import { FanClubLeaderboardCard } from './components/FanClubLeaderboardCard'
88
import { PostUpdateCard } from './components/PostUpdateCard'
99

10-
const MAIN_SECTION_WIDTH = '704px'
11-
const SIDEBAR_SECTION_WIDTH = '360px'
10+
const MAIN_SECTION_MAX_WIDTH = 704
11+
const SIDEBAR_SECTION_WIDTH = 360
12+
const DESKTOP_NAV_WIDTH = 240
1213

13-
const useStyles = makeResponsiveStyles(({ media, theme }) => {
14-
const hasEnoughSpaceForTwoColumns = media.matchesQuery(`(min-width: 1440px)`)
15-
const isSingleColumn = !hasEnoughSpaceForTwoColumns
14+
const useStyles = makeResponsiveStyles(({ theme }) => {
15+
// Keep sidebar fixed; allow the main column to shrink until both columns
16+
// are equal width, then collapse to single-column.
17+
const pageInsetHorizontalPadding = theme.spacing.unit15 * 2
18+
const twoColumnMinViewportWidth =
19+
SIDEBAR_SECTION_WIDTH +
20+
SIDEBAR_SECTION_WIDTH +
21+
theme.spacing.l +
22+
pageInsetHorizontalPadding +
23+
DESKTOP_NAV_WIDTH
24+
const twoColumnMediaQuery = `@media (min-width: ${twoColumnMinViewportWidth}px)`
1625

1726
return {
1827
container: {
1928
base: {
2029
display: 'flex',
21-
gap: isSingleColumn ? theme.spacing.xl : theme.spacing.l,
30+
gap: theme.spacing.xl,
2231
width: '100%',
23-
maxWidth: hasEnoughSpaceForTwoColumns
24-
? `calc(${MAIN_SECTION_WIDTH} + ${SIDEBAR_SECTION_WIDTH} + ${theme.spacing.l})`
25-
: '100%',
32+
maxWidth: '100%',
2633
margin: '0 auto',
27-
flexDirection: hasEnoughSpaceForTwoColumns ? 'row' : 'column',
28-
paddingBottom: hasEnoughSpaceForTwoColumns ? 0 : theme.spacing.m
34+
flexDirection: 'column',
35+
paddingBottom: theme.spacing.m,
36+
[twoColumnMediaQuery]: {
37+
gap: theme.spacing.l,
38+
maxWidth: `calc(${MAIN_SECTION_MAX_WIDTH}px + ${SIDEBAR_SECTION_WIDTH}px + ${theme.spacing.l}px)`,
39+
flexDirection: 'row',
40+
paddingBottom: 0
41+
}
2942
}
3043
},
3144
/** Primary column: fan club story + fan club feed (desktop left). */
3245
mainColumn: {
33-
base: isSingleColumn
34-
? { display: 'contents' as const }
35-
: {
36-
order: 1,
37-
width: MAIN_SECTION_WIDTH,
38-
maxWidth: MAIN_SECTION_WIDTH,
39-
minWidth: 0,
40-
flex: '0 0 auto',
41-
display: 'flex',
42-
flexDirection: 'column' as const,
43-
gap: theme.spacing.xl
44-
}
46+
base: {
47+
display: 'contents' as const,
48+
[twoColumnMediaQuery]: {
49+
order: 1,
50+
width: 'auto',
51+
maxWidth: `${MAIN_SECTION_MAX_WIDTH}px`,
52+
minWidth: `${SIDEBAR_SECTION_WIDTH}px`,
53+
flex: '1 1 auto',
54+
display: 'flex',
55+
flexDirection: 'column' as const,
56+
gap: theme.spacing.xl
57+
}
58+
}
4559
},
4660
/** Sidebar: balance, leaderboard, insights, on-chain details (desktop right). */
4761
sidebarColumn: {
48-
base: isSingleColumn
49-
? { display: 'contents' as const }
50-
: {
51-
order: 2,
52-
width: SIDEBAR_SECTION_WIDTH,
53-
maxWidth: SIDEBAR_SECTION_WIDTH,
54-
minWidth: 0,
55-
flex: '0 0 auto',
56-
display: 'flex',
57-
flexDirection: 'column' as const,
58-
gap: theme.spacing.xl
59-
}
62+
base: {
63+
display: 'contents' as const,
64+
[twoColumnMediaQuery]: {
65+
order: 2,
66+
width: `${SIDEBAR_SECTION_WIDTH}px`,
67+
maxWidth: `${SIDEBAR_SECTION_WIDTH}px`,
68+
minWidth: 0,
69+
flex: '0 0 auto',
70+
display: 'flex',
71+
flexDirection: 'column' as const,
72+
gap: theme.spacing.xl
73+
}
74+
}
6075
},
6176
/** Item wrappers – collapse when the child component renders null. */
6277
itemWrapper: {
@@ -66,25 +81,25 @@ const useStyles = makeResponsiveStyles(({ media, theme }) => {
6681
},
6782
/** Single-column ordering for interleaved layout */
6883
heroSection: {
69-
base: isSingleColumn ? { order: 1 } : {}
84+
base: { order: 1 }
7085
},
7186
postUpdateCard: {
72-
base: isSingleColumn ? { order: 2 } : {}
87+
base: { order: 2 }
7388
},
7489
balanceSection: {
75-
base: isSingleColumn ? { order: 3 } : {}
90+
base: { order: 3 }
7691
},
7792
leaderboard: {
78-
base: isSingleColumn ? { order: 4 } : {}
93+
base: { order: 4 }
7994
},
8095
feedSection: {
81-
base: isSingleColumn ? { order: 5 } : {}
96+
base: { order: 5 }
8297
},
8398
insights: {
84-
base: isSingleColumn ? { order: 6 } : {}
99+
base: { order: 6 }
85100
},
86101
onchainDetails: {
87-
base: isSingleColumn ? { order: 7 } : {}
102+
base: { order: 7 }
88103
}
89104
}
90105
})

0 commit comments

Comments
 (0)