This repository was archived by the owner on Nov 8, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork37
refactor(rich-editor): integrate to works & style adjust#1138
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
5 commits Select commitHold shift + click to select a range
5a76f35
refactor(works): adjust editor styles
mydearxym90ea8a3
refactor(works): adjust launch part & clean up
mydearxymc14b165
refactor(rich-editor): adjust header function
mydearxymb30faa5
refactor(rich-editor): header wip
mydearxym54ec307
refactor(header): layout convention naming
mydearxymFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
8 changes: 7 additions & 1 deletionsrc/components/Checker/index.tsx
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
10 changes: 9 additions & 1 deletionsrc/components/Checker/styles/index.ts
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
2 changes: 1 addition & 1 deletion.../Header/DesktopView/ArticleEditorView.tsx → ...eader/DesktopView/ArticleEditorLayout.tsx
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
2 changes: 1 addition & 1 deletion...onents/Header/DesktopView/ArticleView.tsx → ...ents/Header/DesktopView/ArticleLayout.tsx
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
2 changes: 1 addition & 1 deletion...ents/Header/DesktopView/CommunityView.tsx → ...ts/Header/DesktopView/CommunityLayout.tsx
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
2 changes: 1 addition & 1 deletion...mponents/Header/DesktopView/WorksView.tsx → ...onents/Header/DesktopView/WorksLayout.tsx
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
14 changes: 7 additions & 7 deletionssrc/components/Header/DesktopView/index.tsx
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
4 changes: 2 additions & 2 deletions...tyles/desktop_view/article_editor_view.ts → ...les/desktop_view/article_editor_layout.ts
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
2 changes: 1 addition & 1 deletion...eader/styles/desktop_view/article_view.ts → ...der/styles/desktop_view/article_layout.ts
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
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletionssrc/containers/editor/RichEditor/Header/ArticleLayout.tsx
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { FC, memo, useState } from 'react' | ||
import { SpaceGrow } from '@/components/Common' | ||
import Checker from '@/components/Checker' | ||
import Menu from '../Menu' | ||
import { Wrapper, LinkWrapper, LinkInput } from '../styles/header' | ||
const Header: FC = () => { | ||
const [reprint, setReprint] = useState(false) | ||
return ( | ||
<Wrapper> | ||
<Checker checked={reprint} size="small" dimWhenIdle onChange={setReprint}> | ||
转载 / 翻译 | ||
</Checker> | ||
{reprint && ( | ||
<LinkWrapper> | ||
<LinkInput placeholder="原文地址" /> | ||
</LinkWrapper> | ||
)} | ||
<SpaceGrow /> | ||
<Menu /> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(Header) |
24 changes: 24 additions & 0 deletionssrc/containers/editor/RichEditor/Header/WorksLayout.tsx
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { FC, memo } from 'react' | ||
import Checker from '@/components/Checker' | ||
import Menu from '../Menu' | ||
import { Wrapper } from '../styles/header' | ||
const Header: FC = () => { | ||
return ( | ||
<Wrapper> | ||
<Checker | ||
checked | ||
size="small" | ||
dimWhenIdle | ||
// onChange={(checked) => toggleTemplate(checked)} | ||
> | ||
使用模板 | ||
</Checker> | ||
<Menu /> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(Header) |
22 changes: 22 additions & 0 deletionssrc/containers/editor/RichEditor/Header/index.tsx
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { FC, memo } from 'react' | ||
import ArticleLayout from './ArticleLayout' | ||
import WorksLayout from './WorksLayout' | ||
type TProps = { | ||
type?: 'article' | 'works' | 'job' | 'comment' | 'radar' | ||
} | ||
const Header: FC<TProps> = ({ type }) => { | ||
switch (type) { | ||
case 'works': { | ||
return <WorksLayout /> | ||
} | ||
default: { | ||
return <ArticleLayout /> | ||
} | ||
} | ||
} | ||
export default memo(Header) |
46 changes: 46 additions & 0 deletionssrc/containers/editor/RichEditor/Menu.tsx
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FC, memo } from 'react' | ||
import { ICON } from '@/config' | ||
import IconButton from '@/components/Buttons/IconButton' | ||
import MenuButton from '@/components/Buttons/MenuButton' | ||
const menuOptions = [ | ||
{ | ||
key: 'quote', | ||
icon: `${ICON}/article/import.svg`, | ||
title: '导入内容', | ||
}, | ||
{ | ||
key: 'share', | ||
icon: `${ICON}/article/export.svg`, | ||
title: '导出内容', | ||
}, | ||
{ | ||
key: 'edit', | ||
icon: `${ICON}/help.svg`, | ||
title: '使用帮助', | ||
}, | ||
] | ||
const extraOptions = [ | ||
{ | ||
key: 'edit', | ||
icon: `${ICON}/shape/ear.svg`, | ||
title: '建议反馈', | ||
}, | ||
] | ||
const Menu: FC = () => { | ||
return ( | ||
<MenuButton | ||
options={menuOptions} | ||
extraOptions={extraOptions} | ||
placement="bottom-end" | ||
onClick={console.log} | ||
> | ||
<IconButton path="shape/more.svg" mLeft={16} /> | ||
</MenuButton> | ||
) | ||
} | ||
export default memo(Menu) |
18 changes: 13 additions & 5 deletionssrc/containers/editor/RichEditor/RealEditor.tsx
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
13 changes: 7 additions & 6 deletionssrc/containers/editor/RichEditor/logic.ts
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
37 changes: 37 additions & 0 deletionssrc/containers/editor/RichEditor/styles/header.ts
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import styled from 'styled-components' | ||
import Input from '@/components/Input' | ||
import { theme } from '@/utils/themes' | ||
import css from '@/utils/css' | ||
export const Wrapper = styled.div` | ||
${css.flex('align-center', 'justify-between')}; | ||
width: 100%; | ||
/* border: 1px solid tomato; */ | ||
position: absolute; | ||
top: 18px; | ||
padding-left: 46px; | ||
padding-right: 13px; | ||
margin-top: 8px; | ||
` | ||
export const LinkWrapper = styled.div` | ||
width: 260px; | ||
margin-left: 15px; | ||
` | ||
export const LinkInput = styled(Input)` | ||
display: block; | ||
margin-top: -2px; | ||
border-radius: 0; | ||
border-top: none; | ||
border-left: none; | ||
border-right: none; | ||
color: #486368; | ||
padding: 2px 5px; | ||
height: 20px; | ||
font-size: 13px; | ||
&::placeholder { | ||
font-size: 12px; | ||
} | ||
` | ||
export const holder = 1 |
18 changes: 15 additions & 3 deletionssrc/containers/editor/RichEditor/styles/index.ts
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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.