From bd80c460a4b41d4aa2826e502da9e0746ebfbacd Mon Sep 17 00:00:00 2001 From: creep Date: Mon, 13 Nov 2023 00:15:08 +0800 Subject: [PATCH] feat(reader): add increase font and decrease font function --- src/i18n/en-US.json | 4 +++- src/i18n/zh-CN.json | 4 +++- src/router/settings/electron-main/settings.ts | 2 +- .../Article/Toolbar/font-decrease-button.tsx | 17 ++++++++++++++ .../Article/Toolbar/font-increase-button.tsx | 17 ++++++++++++++ .../MainPanel/Article/Toolbar/index.tsx | 4 ++++ .../apps/reader/MainPanel/Article/content.tsx | 22 ++++++++++++++++--- src/ui/store/reader.ts | 20 +++++++++++++++++ 8 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 src/ui/apps/reader/MainPanel/Article/Toolbar/font-decrease-button.tsx create mode 100644 src/ui/apps/reader/MainPanel/Article/Toolbar/font-increase-button.tsx diff --git a/src/i18n/en-US.json b/src/i18n/en-US.json index bb44aae..5dfd59d 100644 --- a/src/i18n/en-US.json +++ b/src/i18n/en-US.json @@ -15,7 +15,9 @@ "copy": { "title": "Copy url", "success": "Copied" - } + }, + "fontIncrease": "Larger", + "fontDecrease": "Smaller" }, "form": { diff --git a/src/i18n/zh-CN.json b/src/i18n/zh-CN.json index 7f5af7d..41966df 100644 --- a/src/i18n/zh-CN.json +++ b/src/i18n/zh-CN.json @@ -15,7 +15,9 @@ "copy": { "title": "复制链接", "success": "已复制到剪贴板" - } + }, + "fontIncrease": "更大", + "fontDecrease": "更小" }, "form": { diff --git a/src/router/settings/electron-main/settings.ts b/src/router/settings/electron-main/settings.ts index 2c9aa06..a16dfa9 100644 --- a/src/router/settings/electron-main/settings.ts +++ b/src/router/settings/electron-main/settings.ts @@ -5,6 +5,6 @@ export const router = new Router({ prefix: '/settings' }) // const getTheme = () => settings.appearance === 'auto' ? 'system' : settings.appearance -router.use('get', () => settingService.get()) +router.use('get', (_, path) => settingService.get(path)) router.use('set', (_, { path, value }: { path: string, value: any }) => settingService.set(path, value)) diff --git a/src/ui/apps/reader/MainPanel/Article/Toolbar/font-decrease-button.tsx b/src/ui/apps/reader/MainPanel/Article/Toolbar/font-decrease-button.tsx new file mode 100644 index 0000000..bac5eaf --- /dev/null +++ b/src/ui/apps/reader/MainPanel/Article/Toolbar/font-decrease-button.tsx @@ -0,0 +1,17 @@ +import intl from 'react-intl-universal' +import { FontDecreaseRegular } from '@fluentui/react-icons' +import { Button } from '@/ui/apps/reader/components/toolbar' +import { store } from '@/ui/store' + +const { readerStore } = store + +export default function FontDecreaseButton() { + return ( +