refactor(feed): read the view spec's column bounds in one place
This commit is contained in:
@@ -80,7 +80,8 @@ export default function VirtualFeed({
|
||||
}: VirtualFeedProps) {
|
||||
const listRef = useRef<HTMLDivElement>(null);
|
||||
const [scrollEl, setScrollEl] = useState<HTMLElement | null>(null);
|
||||
const singleCol = FEED_VIEW_SPEC[view].minCol == null;
|
||||
const { minCol, maxCol } = FEED_VIEW_SPEC[view];
|
||||
const singleCol = minCol == null;
|
||||
const [colCount, setColCount] = useState(singleCol ? 1 : 4);
|
||||
// Distance from the scroll element's content top to where this list starts (the
|
||||
// feed toolbar sits above it inside the same scroll area).
|
||||
@@ -158,7 +159,7 @@ export default function VirtualFeed({
|
||||
className={singleCol ? "mx-auto pb-1" : "grid gap-4"}
|
||||
style={
|
||||
singleCol
|
||||
? { maxWidth: FEED_VIEW_SPEC[view].maxCol ?? undefined }
|
||||
? { maxWidth: maxCol ?? undefined }
|
||||
: { gridTemplateColumns: `repeat(${colCount}, minmax(0, 1fr))` }
|
||||
}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user