diff --git a/index.html b/index.html index 14de67c..2637967 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,8 @@ - + - + 音乐解锁 - Unlock Music @@ -10,6 +10,7 @@ +
diff --git a/src/components/AppRoot.tsx b/src/components/AppRoot.tsx index 7382a2f..f293b43 100644 --- a/src/components/AppRoot.tsx +++ b/src/components/AppRoot.tsx @@ -12,11 +12,12 @@ import { Footer } from '~/components/Footer'; import { FaqTab } from '~/tabs/FaqTab'; import { SETTINGS_TABS } from '~/features/settings/settingsTabs'; import { Bounce, ToastContainer } from 'react-toastify'; +import { SettingsHome } from '~/features/settings/SettingsHome'; // Private to this file only. const store = setupStore(); -const tabClassNames = ({ isActive }: { isActive: boolean }) => `tab ${isActive ? 'tab-active' : ''}`; +const tabClassNames = ({ isActive }: { isActive: boolean }) => `mb-[-2px] tab ${isActive ? 'tab-active' : ''}`; export function AppRoot() { useEffect(() => persistSettings(store), []); @@ -24,7 +25,7 @@ export function AppRoot() { return ( -
+
应用 @@ -39,10 +40,11 @@ export function AppRoot() {
-
+
+ {Object.entries(SETTINGS_TABS).map(([key, { Tab }]) => ( ))} diff --git a/src/components/KeyListContainer.tsx b/src/components/KeyListContainer.tsx index 098618e..ed92338 100644 --- a/src/components/KeyListContainer.tsx +++ b/src/components/KeyListContainer.tsx @@ -9,9 +9,9 @@ export interface KeyListContainerProps { export function KeyListContainer({ keys, children, ref }: KeyListContainerProps) { const count = keys.length; return ( -
+
{count > 0 && ( -
    +
      {children}
    )} diff --git a/src/features/nav/ResponsiveNav.tsx b/src/features/nav/ResponsiveNav.tsx new file mode 100644 index 0000000..ddd196d --- /dev/null +++ b/src/features/nav/ResponsiveNav.tsx @@ -0,0 +1,29 @@ +export interface ResponsiveNavProps { + navigationClassName?: string; + navigation?: React.ReactNode; + + className?: string; + + contentClassName?: string; + children?: React.ReactNode; +} + +export function ResponsiveNav({ + className = '', + navigationClassName = '', + contentClassName = '', + children, + navigation, +}: ResponsiveNavProps) { + return ( +
    + {/* Sidebar */} + + + {/* Main content */} +
    {children}
    +
    + ); +} diff --git a/src/features/settings/Settings.tsx b/src/features/settings/Settings.tsx index ef19496..a1cff80 100644 --- a/src/features/settings/Settings.tsx +++ b/src/features/settings/Settings.tsx @@ -5,6 +5,8 @@ import { NavLink, Outlet } from 'react-router'; import { SETTINGS_TABS } from '~/features/settings/settingsTabs.tsx'; import { MdOutlineSettingsBackupRestore } from 'react-icons/md'; import { toast } from 'react-toastify'; +import { ResponsiveNav } from '../nav/ResponsiveNav'; +import classNames from 'classnames'; export function Settings() { const dispatch = useAppDispatch(); @@ -25,23 +27,37 @@ export function Settings() { }; const isSettingsNotSaved = useAppSelector(selectIsSettingsNotSaved); + const tabClassNames = ({ isActive }: { isActive: boolean }) => + classNames( + 'link inline-flex text-nowrap mb-[-2px] no-underline w-full', + 'border-b-2 md:border-b-0 md:border-r-2', + 'tab md:grow', + { + 'tab-active bg-accent/10 border-accent': isActive, + }, + ); + return (
    -
    - {Object.entries(SETTINGS_TABS).map(([id, { name }]) => ( - - {name} - - ))} -
    - - {/* TODO: ensure this flex div does not overflow */} -
    + + {Object.entries(SETTINGS_TABS).map(([id, { name }]) => ( + + {name} + + ))} +
    + } + > -
    + -