-
Notifications
You must be signed in to change notification settings - Fork 2
feat: update a8m layout for v2 design #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c71fd16
refactor: move Header into Home, add A8M logo, replace headlessui menus
wendyyuchensun d0e2d6b
refactor: update left panel edit area styling and CodeMirror theme
wendyyuchensun ceae1b6
refactor: update right panel preview area styling and controls
wendyyuchensun 54f2cb2
refactor: update modal styles, icons, and sizing
wendyyuchensun c9f4243
refactor: narrow header props to title/onTitleChange and add propTypes
wendyyuchensun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 ( | ||
| <header className="px-8 md:px-20 fixed h-20 flex justify-between items-center bg-white text-md md:text-2xl font-bold inset-x-0 z-10"> | ||
| <div className="flex"> | ||
| <h1 className="m-0">Access8Math</h1> | ||
| <button | ||
| className="hover:scale-110 transition-scale ml-2" | ||
| <header className="px-6 fixed h-[72px] flex items-center gap-2 bg-white inset-x-0 z-10 shadow-shadow2"> | ||
| <div className="flex items-center gap-3 grow"> | ||
| <h1 className="sr-only">Access8Math</h1> | ||
| <A8mLogo aria-hidden="true" /> | ||
| <input | ||
| value={title} | ||
| type="text" | ||
| style={{ outline: 'none' }} | ||
| className="grow max-w-[280px] text-text-primary placeholder-text-placeholder text-xl font-medium leading-[1.4] pb-2 border-b-2 border-primary" | ||
| placeholder={t('pleaseInputTitle')} | ||
| aria-label={t('pleaseInputTitle')} | ||
| onChange={(e) => onTitleChange(e.target.value)} | ||
| /> | ||
| </div> | ||
| <div className="flex items-center gap-3"> | ||
| <Button | ||
| variant="tertiary" | ||
| className="min-w-[88px] flex items-center gap-1" | ||
| onClick={() => setShowTipModal(true)} | ||
| aria-label={t('descript')} | ||
| > | ||
| <QuestionCircleComponent className="w-5 h-5" /> | ||
| </button> | ||
| </div> | ||
| <div className="flex items-center"> | ||
| <div className="md:mr-12 mr-8"> | ||
| <LanguageMenu /> | ||
| </div> | ||
| <IconBulb size={16} aria-hidden="true" /> | ||
| <span>{t('instructions')}</span> | ||
| </Button> | ||
| <Menu /> | ||
| <LanguageMenu /> | ||
| <Button variant="secondary" className="min-w-[88px]" onClick={onImportClick}> | ||
| {t('import')} | ||
| </Button> | ||
| <Button variant="primary" className="min-w-[88px]" onClick={onExportClick}> | ||
| {t('export')} | ||
| </Button> | ||
| </div> | ||
| <TipModal isOpen={showTipModal} onClose={() => setShowTipModal(false)} /> | ||
| </header> | ||
| ); | ||
| }; | ||
|
|
||
| Header.propTypes = { | ||
| onImportClick: PropTypes.func.isRequired, | ||
| onExportClick: PropTypes.func.isRequired, | ||
| title: PropTypes.string.isRequired, | ||
| onTitleChange: PropTypes.func.isRequired, | ||
| }; | ||
|
|
||
| export default Header; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這個檔案 change 比較多,但大部分是因為調整、移除一些應該不需要重複的 DOM node,類似這行,所以造成更往下的 code indent 改變了。