diff --git a/package-lock.json b/package-lock.json index afd75e1..095d263 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@coseeing/see-mark": "^1.5.0", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", + "@tabler/icons-react": "^3.40.0", "classnames": "^2.3.2", "codemirror": "^6.0.1", "core-js": "^3.21.1", @@ -6451,6 +6452,30 @@ "node": ">=10" } }, + "node_modules/@tabler/icons": { + "version": "3.40.0", + "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-3.40.0.tgz", + "integrity": "sha512-V/Q4VgNPKubRTiLdmWjV/zscYcj5IIk+euicUtaVVqF6luSC9rDngYWgST5/yh3Mrg/mYUwRv1YVTk71Jp0twQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/codecalm" + } + }, + "node_modules/@tabler/icons-react": { + "version": "3.40.0", + "resolved": "https://registry.npmjs.org/@tabler/icons-react/-/icons-react-3.40.0.tgz", + "integrity": "sha512-oO5+6QCnna4a//mYubx4euZfECtzQZFDGsDMIdzZUhbdyBCT+3bRVFBPueGIcemWld4Vb/0UQ39C/cmGfGylAg==", + "dependencies": { + "@tabler/icons": "3.40.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/codecalm" + }, + "peerDependencies": { + "react": ">= 16" + } + }, "node_modules/@tanstack/react-virtual": { "version": "3.13.12", "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.13.12.tgz", diff --git a/package.json b/package.json index 988c235..5f50924 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@coseeing/see-mark": "^1.5.0", "@headlessui/react": "^1.7.17", "@heroicons/react": "^2.0.18", + "@tabler/icons-react": "^3.40.0", "classnames": "^2.3.2", "codemirror": "^6.0.1", "core-js": "^3.21.1", diff --git a/src/components/edit-icons-tab.js b/src/components/edit-icons-tab.js index 43f51ed..71cb8f7 100644 --- a/src/components/edit-icons-tab.js +++ b/src/components/edit-icons-tab.js @@ -40,136 +40,111 @@ const EditIconsTab = ({ insertLatex, addImageToExport }) => { ); return ( -
+ <> -
- - {mainTabList.map(({ id }, index) => ( - - {t(`main.${id}`)} - - ))} - -
-
- - - -
- - {mathTabList.map((tab, mathTabIndex) => ( - - - - {selectedMathTabIndex === mathTabIndex && ( - // White triangle arrow pointing right to indicate selected tab -
- )} - - - ))} - - - {mathTabList.map((mathTab) => { - return ( - - {(mathTab?.subTabs || []).sort(compare('order', 'asc')).map((subTab) => ( - + {mainTabList.map(({ id }, index) => ( + + {t(`main.${id}`)} + + ))} + + + + +
+ + {mathTabList.map((tab, mathTabIndex) => ( + + + + + + ))} + + + {mathTabList.map((mathTab) => { + return ( + + {(mathTab?.subTabs || []).sort(compare('order', 'asc')).map((subTab) => ( + + - - ))} - - ); - })} - -
-
-
- - {markdowns.map((tab) => ( - - - - ))} - -
-
- - setIsImageModalOpen(false)} - onConfirm={handleImageConfirm} - /> + + +
+ ))} + + ); + })} + +
+
+
+ + {markdowns.map((tab) => ( + + + + ))} + +
-
+ setIsImageModalOpen(false)} + onConfirm={handleImageConfirm} + /> + ); }; diff --git a/src/components/header/index.js b/src/components/header/index.js index bb96878..70b4a3e 100644 --- a/src/components/header/index.js +++ b/src/components/header/index.js @@ -1,36 +1,61 @@ import React, { useState } from 'react'; +import PropTypes from 'prop-types'; +import { ReactComponent as A8mLogo } from '@/components/svg/a8m-logo.svg'; import Menu from './menu'; import LanguageMenu from './language-menu'; import TipModal from '@/components/home/tip-modal'; -import { ReactComponent as QuestionCircleComponent } from '@/components/svg/question-circle.svg'; +import { IconBulb } from '@tabler/icons-react'; import { useTranslation } from '@/lib/i18n'; +import Button from '@/components/core/button'; -const Header = () => { +const Header = ({ onImportClick, onExportClick, title, onTitleChange }) => { const t = useTranslation('home'); const [showTipModal, setShowTipModal] = useState(false); return ( -
-
-

Access8Math

- -
-
-
- -
+
setShowTipModal(false)} />
); }; +Header.propTypes = { + onImportClick: PropTypes.func.isRequired, + onExportClick: PropTypes.func.isRequired, + title: PropTypes.string.isRequired, + onTitleChange: PropTypes.func.isRequired, +}; + export default Header; diff --git a/src/components/header/language-menu.js b/src/components/header/language-menu.js index 9d20bd7..31e075d 100644 --- a/src/components/header/language-menu.js +++ b/src/components/header/language-menu.js @@ -1,9 +1,10 @@ -import React, { Fragment } from 'react'; -import { Menu, Transition } from '@headlessui/react'; -import { LanguageIcon } from '@heroicons/react/20/solid'; +import React from 'react'; +import { IconLanguage } from '@tabler/icons-react'; import i18n, { useTranslation } from '@/lib/i18n'; import { useLocaleContext } from '@/lib/locale-switch'; +import Button from '@/components/core/button'; +import DropdownMenu from '@/components/core/dropdown-menu'; const LANGUAGES = [ { locale: 'zh-TW' }, @@ -16,54 +17,22 @@ const LanguageMenu = () => { const t = useTranslation('common'); const { changeLocale } = useLocaleContext(); - return ( - - {({ open }) => ( - <> - - - {open &&
} + const items = LANGUAGES.map(({ locale }) => ({ + label: t(`locale.${locale}`), + onClick: () => changeLocale(locale), + })); - - -
-
- {LANGUAGES.map(({ locale }) => ( - - {({ active }) => { - return ( - - ); - }} - - ))} -
-
-
-
- - )} -
+ return ( + +