From 6d242a44579522c65e086a5c5c89824329643c0b Mon Sep 17 00:00:00 2001 From: kunish Date: Sat, 16 Sep 2023 01:28:58 +0800 Subject: [PATCH] fix: proxy providers grid layout --- src/components/Collapse.tsx | 7 +++---- src/pages/Proxies.tsx | 24 +++++++++++------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/components/Collapse.tsx b/src/components/Collapse.tsx index 6cd5bd4..3d149b5 100644 --- a/src/components/Collapse.tsx +++ b/src/components/Collapse.tsx @@ -1,15 +1,14 @@ -import { JSX, ParentComponent, Show } from 'solid-js' +import { children, JSX, ParentComponent, Show } from 'solid-js' import { twMerge } from 'tailwind-merge' type Props = { title: JSX.Element - content: JSX.Element isOpen?: boolean onCollapse: (collapsed: boolean) => void } export const Collapse: ParentComponent = (props) => { - const { title, content, onCollapse } = props + const { title, onCollapse } = props const getCollapseClassName = () => { const openedClassName = 'collapse-open' @@ -44,7 +43,7 @@ export const Collapse: ParentComponent = (props) => { 'collapse-content grid grid-cols-2 gap-2 transition-opacity duration-1000', )} > - {content} + {children(() => props.children)()} ) diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx index 6f669b6..446897d 100644 --- a/src/pages/Proxies.tsx +++ b/src/pages/Proxies.tsx @@ -203,17 +203,14 @@ export default () => { { - void onProxyNodeClick(proxy, name) - }} - /> - } onCollapse={(val) => setCollapsedMap(proxy.name, val)} - /> + > + void onProxyNodeClick(proxy, name)} + /> + ) }} @@ -221,7 +218,7 @@ export default () => { -
+
{(proxyProvider) => { const sortedProxyNames = filterProxiesByAvailability( @@ -296,11 +293,12 @@ export default () => { } onCollapse={(val) => setCollapsedMap(proxyProvider.name, val) } - /> + > + + ) }}