@@ -31,6 +31,14 @@ import TopPosterStatusBar from "./TopPosterStatusBar";
3131
3232const NUM_TOP_POSTERS = 6 ;
3333
34+ const columnClasses : { [ key : number ] : string } = {
35+ 1 : "lg:columns-1" ,
36+ 2 : "lg:columns-2" ,
37+ 3 : "lg:columns-3" ,
38+ 4 : "lg:columns-4" ,
39+ 5 : "lg:columns-5" ,
40+ } ;
41+
3442export interface FeedProps {
3543 subreddit : string ;
3644 initialTime : string ;
@@ -48,6 +56,7 @@ const Feed: React.FC<FeedProps> = memo(({ subreddit, initialTime, initialSort })
4856 const [ hasMore , setHasMore ] = useState ( true ) ;
4957 const [ time , setTime ] = useState < string > ( initialTime ) ;
5058 const [ sort , setSort ] = useState < string > ( params . sort || initialSort ) ;
59+ const [ numColumns , setNumColumns ] = useState ( 3 ) ;
5160 const observer = useRef < IntersectionObserver | null > ( null ) ;
5261 const sentinel = useRef ( null ) ;
5362 const [ isStarred , setIsStarred ] = useState < boolean > (
@@ -215,7 +224,19 @@ const Feed: React.FC<FeedProps> = memo(({ subreddit, initialTime, initialSort })
215224 ) ,
216225 ) }
217226 </ div >
218- < div className = "columns-1 sm:columns-2 lg:columns-3 gap-4" >
227+ < div className = "hidden md:flex items-center gap-2.5 shrink-0 mb-4 w-full justify-start" >
228+ < label htmlFor = "columns" className = "text-[11px] font-medium text-zinc-600 uppercase tracking-wide" > Cols</ label >
229+ < input
230+ id = "columns"
231+ type = "range"
232+ min = "1"
233+ max = "5"
234+ value = { numColumns }
235+ onChange = { ( e ) => setNumColumns ( Number ( e . target . value ) ) }
236+ className = "w-20 h-0.75 bg-zinc-800 rounded-full appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-blue-400 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:shadow-[0_0_6px_rgba(96,165,250,0.5)]"
237+ /> < span className = "text-xs font-mono text-zinc-400 w-4 text-center tabular-nums" > { numColumns } </ span >
238+ </ div >
239+ < div className = { `columns-1 ${ columnClasses [ numColumns ] } gap-4` } >
219240 { posts . map ( ( post ) => (
220241 < div
221242 key = { post . id }
0 commit comments