fix fixed cols

This commit is contained in:
pompurin404 2024-08-26 12:33:26 +08:00
parent 73f39f8760
commit 356e058a8a
No known key found for this signature in database

View File

@ -29,7 +29,7 @@ const Proxies: React.FC = () => {
autoCloseConnection = true, autoCloseConnection = true,
proxyCols = 'auto' proxyCols = 'auto'
} = appConfig || {} } = appConfig || {}
const [cols, setCols] = useState(3) const [cols, setCols] = useState(1)
const [isOpen, setIsOpen] = useState(Array(groups.length).fill(false)) const [isOpen, setIsOpen] = useState(Array(groups.length).fill(false))
const virtuosoRef = useRef<GroupedVirtuosoHandle>(null) const virtuosoRef = useRef<GroupedVirtuosoHandle>(null)
const { groupCounts, allProxies } = useMemo(() => { const { groupCounts, allProxies } = useMemo(() => {
@ -259,7 +259,12 @@ const Proxies: React.FC = () => {
}) })
return allProxies[groupIndex] ? ( return allProxies[groupIndex] ? (
<div <div
className={`grid ${proxyCols === 'auto' ? 'sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5' : `grid-cols-${cols}`} gap-2 pt-2 mx-2`} style={
proxyCols !== 'auto'
? { gridTemplateColumns: `repeat(${proxyCols}, minmax(0, 1fr))` }
: {}
}
className={`grid ${proxyCols === 'auto' ? 'sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5' : ''} gap-2 pt-2 mx-2`}
> >
{Array.from({ length: cols }).map((_, i) => { {Array.from({ length: cols }).map((_, i) => {
if (!allProxies[groupIndex][innerIndex * cols + i]) return null if (!allProxies[groupIndex][innerIndex * cols + i]) return null