diff --git a/.gitignore b/.gitignore index a0da93e..d072e8a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist out .DS_Store *.log* +.idea diff --git a/src/renderer/src/components/sider/index.ts b/src/renderer/src/components/sider/index.ts new file mode 100644 index 0000000..8f13d65 --- /dev/null +++ b/src/renderer/src/components/sider/index.ts @@ -0,0 +1 @@ +export { default as SiderSwitch } from './sider-swtich' diff --git a/src/renderer/src/components/sider/override-card.tsx b/src/renderer/src/components/sider/override-card.tsx index 948fd59..8c462bb 100644 --- a/src/renderer/src/components/sider/override-card.tsx +++ b/src/renderer/src/components/sider/override-card.tsx @@ -1,7 +1,8 @@ -import { Button, Card, CardBody, CardFooter, Switch } from '@nextui-org/react' +import { Button, Card, CardBody, CardFooter, cn } from '@nextui-org/react' import React, { useState } from 'react' import { MdFormatOverline } from 'react-icons/md' import { useLocation, useNavigate } from 'react-router-dom' +import { SiderSwitch } from './index' const OverrideCard: React.FC = () => { const navigate = useNavigate() @@ -25,11 +26,8 @@ const OverrideCard: React.FC = () => { > - diff --git a/src/renderer/src/components/sider/sider-swtich.tsx b/src/renderer/src/components/sider/sider-swtich.tsx new file mode 100644 index 0000000..77c28bd --- /dev/null +++ b/src/renderer/src/components/sider/sider-swtich.tsx @@ -0,0 +1,26 @@ +import React from 'react' +import { cn, Switch, SwitchProps } from '@nextui-org/react' + +interface SiderSwitchProps extends SwitchProps { + isShowBorder?: boolean +} + +const SiderSwitch: React.FC = (props) => { + const { isShowBorder = false, isSelected, classNames, ...switchProps } = props + + return ( + + ) +} + +export default SiderSwitch diff --git a/src/renderer/src/components/sider/sysproxy-switcher.tsx b/src/renderer/src/components/sider/sysproxy-switcher.tsx index 7fab62b..a2e4324 100644 --- a/src/renderer/src/components/sider/sysproxy-switcher.tsx +++ b/src/renderer/src/components/sider/sysproxy-switcher.tsx @@ -1,9 +1,10 @@ -import { Button, Card, CardBody, CardFooter, Switch } from '@nextui-org/react' +import { Button, Card, CardBody, CardFooter } from '@nextui-org/react' import { useLocation, useNavigate } from 'react-router-dom' import { useAppConfig } from '@renderer/hooks/use-config' import { AiOutlineGlobal } from 'react-icons/ai' import React from 'react' import { triggerSysProxy } from '@renderer/utils/ipc' +import { SiderSwitch } from './index' const SysproxySwitcher: React.FC = () => { const navigate = useNavigate() @@ -34,11 +35,8 @@ const SysproxySwitcher: React.FC = () => { > - diff --git a/src/renderer/src/components/sider/tun-switcher.tsx b/src/renderer/src/components/sider/tun-switcher.tsx index 94a7c03..68ea031 100644 --- a/src/renderer/src/components/sider/tun-switcher.tsx +++ b/src/renderer/src/components/sider/tun-switcher.tsx @@ -1,9 +1,10 @@ -import { Button, Card, CardBody, CardFooter, Switch } from '@nextui-org/react' +import { Button, Card, CardBody, CardFooter } from '@nextui-org/react' import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config' import { TbDeviceIpadHorizontalBolt } from 'react-icons/tb' import { useLocation, useNavigate } from 'react-router-dom' import { patchMihomoConfig } from '@renderer/utils/ipc' import React from 'react' +import { SiderSwitch } from './index' const TunSwitcher: React.FC = () => { const navigate = useNavigate() @@ -35,11 +36,8 @@ const TunSwitcher: React.FC = () => { > -