diff --git a/src/pages/reader/Header/Right.tsx b/src/pages/reader/Header/Right.tsx index 3ffb4f6..165ac2e 100644 --- a/src/pages/reader/Header/Right.tsx +++ b/src/pages/reader/Header/Right.tsx @@ -49,6 +49,7 @@ import { useAsideOpen } from "lib/hooks"; import { sortBy } from "lodash"; import IconFont from "component/IconFont"; import { useDrawCtrl, useUpdateDrawCtrl } from "lib/draw/DrawCtrl"; +import { OptionButton } from "../Options"; export const HeaderRight: FC<{ instantSave: () => Promise | undefined; @@ -58,6 +59,7 @@ export const HeaderRight: FC<{
{teamOn ? : } +
); }; diff --git a/src/pages/reader/Header/header.sass b/src/pages/reader/Header/header.sass index a011e29..508b709 100644 --- a/src/pages/reader/Header/header.sass +++ b/src/pages/reader/Header/header.sass @@ -32,8 +32,10 @@ grid-column: span 3 @include for-desktop height: $header-low-height - > .left, > .right + > .left grid-template-columns: repeat(2, 1fr) + > .right + grid-template-columns: repeat(3, 1fr) > .middle grid-template-columns: repeat(7, 1fr) .redo-btn @@ -73,6 +75,9 @@ max-width: 200px &[data-show=false] display: none + > .right .reader-option-btn + @include for-phone + display: none .team-title display: flex diff --git a/src/pages/reader/Options/index.tsx b/src/pages/reader/Options/index.tsx new file mode 100644 index 0000000..87210bb --- /dev/null +++ b/src/pages/reader/Options/index.tsx @@ -0,0 +1,54 @@ +import { FC } from "react"; +import { Button, Popover, Switch } from "antd"; +import { TooltipPlacement } from "antd/lib/tooltip"; +import { useForceLight } from "lib/Dark"; +import { useDrawCtrl, useUpdateDrawCtrl } from "lib/draw/DrawCtrl"; +import { useMediaQuery } from "react-responsive"; +import { MoreOutlined } from "@ant-design/icons"; +import "./options.sass"; + +export const OptionButton: FC<{ + placement?: TooltipPlacement; +}> = ({ placement }) => { + const { finger } = useDrawCtrl(); + const updateDrawCtrl = useUpdateDrawCtrl(); + const [forceLight, setForceLight] = useForceLight(); + const isLight = useMediaQuery({ query: "(prefers-color-scheme: light)" }); + + const options = ( +
+
+ Pencil only + updateDrawCtrl({ finger: !v })} + /> +
+
+ Light mode + +
+
+ ); + + return ( + e.parentElement!} + trigger="click" + content={options} + placement={placement} + > + -