diff --git a/web/src/components/ButtonsTabbed.jsx b/web/src/components/ButtonsTabbed.jsx new file mode 100644 index 000000000..2a42155e5 --- /dev/null +++ b/web/src/components/ButtonsTabbed.jsx @@ -0,0 +1,29 @@ +import { h } from 'preact'; +import { useCallback } from 'preact/hooks'; + +export default function ButtonsTabbed({ titles = [], viewMode, setViewMode }) { + const className = 'text-gray-600 py-0 px-4 block hover:text-gray-500'; + + const handleClick = useCallback((i) => { + setViewMode(titles[i]); + }, [viewMode]); // eslint-disable-line react-hooks/exhaustive-deps + + return ( + + ); +} diff --git a/web/src/routes/Camera.jsx b/web/src/routes/Camera.jsx index 7f5527df4..133841500 100644 --- a/web/src/routes/Camera.jsx +++ b/web/src/routes/Camera.jsx @@ -7,6 +7,7 @@ import Heading from '../components/Heading'; import Link from '../components/Link'; import SettingsIcon from '../icons/Settings'; import Switch from '../components/Switch'; +import ButtonsTabbed from '../components/ButtonsTabbed'; import { usePersistence } from '../context'; import { useCallback, useMemo, useState } from 'preact/hooks'; import { useApiHost, useConfig } from '../api'; @@ -112,16 +113,7 @@ export default function Camera({ camera }) { return (