diff --git a/src/containers/tool/C11NSettingPanel/GeneralSettings.tsx b/src/containers/tool/C11NSettingPanel/GeneralSettings.tsx index 145b8c634..9b31cd0c0 100644 --- a/src/containers/tool/C11NSettingPanel/GeneralSettings.tsx +++ b/src/containers/tool/C11NSettingPanel/GeneralSettings.tsx @@ -5,10 +5,10 @@ import { isMobile } from 'react-device-detect' import type { TThread, TC11N } from '@/spec' import { THREAD, C11N } from '@/constant' -import { Br } from '@/widgets/Common' +import { Br, Divider } from '@/widgets/Common' import { Radio } from '@/widgets/Switcher' -import { Wrapper, Title, Desc, Divider } from './styles/gerneral_settings' +import { Wrapper, Title, Desc } from './styles/gerneral_settings' import { onC11NChange } from './logic' type TProps = { @@ -45,7 +45,7 @@ const GeneralSettings: FC = ({ curThread, customization }) => { }) } /> - + 阅读辅助
@@ -95,10 +95,10 @@ const GeneralSettings: FC = ({ curThread, customization }) => { }) } /> - + ) : ( - + )} 显示密度 diff --git a/src/containers/tool/C11NSettingPanel/index.tsx b/src/containers/tool/C11NSettingPanel/index.tsx index 66318b3be..83bafe524 100644 --- a/src/containers/tool/C11NSettingPanel/index.tsx +++ b/src/containers/tool/C11NSettingPanel/index.tsx @@ -86,4 +86,4 @@ const C11NSettingPanelContainer: FC = ({ c11NSettingPanel: store }) => { ) } -export default bond(C11NSettingPanelContainer, 'c11nSettingPanel') as FC +export default bond(C11NSettingPanelContainer, 'c11NSettingPanel') as FC diff --git a/src/containers/tool/C11NSettingPanel/styles/gerneral_settings.ts b/src/containers/tool/C11NSettingPanel/styles/gerneral_settings.ts index 241738bdd..e7bf48724 100644 --- a/src/containers/tool/C11NSettingPanel/styles/gerneral_settings.ts +++ b/src/containers/tool/C11NSettingPanel/styles/gerneral_settings.ts @@ -24,9 +24,3 @@ export const Desc = styled.div` margin-bottom: 10px; opacity: 0.5; ` -export const Divider = styled.div` - margin: 30px 0; - width: 100%; - height: 1px; - background: #003541; -` diff --git a/src/containers/tool/Drawer/AddOn/index.tsx b/src/containers/tool/Drawer/AddOn/index.tsx index e4df37f30..438df4b33 100755 --- a/src/containers/tool/Drawer/AddOn/index.tsx +++ b/src/containers/tool/Drawer/AddOn/index.tsx @@ -6,9 +6,13 @@ import ArticleNavi from './ArticleNavi' import type { TArticleNavi } from '../spec' import { ARTICLE_VIEWER_TYPES } from '../constant' +import IconButton from '@/widgets/Buttons/IconButton' + import Share from '@/containers/tool/Share' import CloseButton from './CloseButton' -import { Wrapper, TopArea } from '../styles/add_on' +import { Wrapper, ViewerWrapper, TopArea } from '../styles/add_on' +import { isViewerMode } from '../styles/metrics' +import { closeDrawer } from '../logic' type TProps = { type: string @@ -19,15 +23,23 @@ const AddOn: FC = ({ type, articleNavi }) => { const showArticleNavi = includes(type, ARTICLE_VIEWER_TYPES) const showShare = includes(type, ARTICLE_VIEWER_TYPES) + if (!isViewerMode(type)) { + return ( + + + + ) + } + return ( - + {showShare && } {showArticleNavi && } - + ) } diff --git a/src/containers/tool/Drawer/Viewer/DesktopView.tsx b/src/containers/tool/Drawer/Viewer/DesktopView.tsx index 02171df10..175933a6d 100644 --- a/src/containers/tool/Drawer/Viewer/DesktopView.tsx +++ b/src/containers/tool/Drawer/Viewer/DesktopView.tsx @@ -46,7 +46,7 @@ const DesktopView: FC = ({ options={options} > - {children} + {children} ) diff --git a/src/containers/tool/Drawer/logic.ts b/src/containers/tool/Drawer/logic.ts index 1fae77666..6c7b8a295 100755 --- a/src/containers/tool/Drawer/logic.ts +++ b/src/containers/tool/Drawer/logic.ts @@ -161,6 +161,7 @@ const DataResolver = [ match: asyncRes(EVENT.DRAWER.OPEN), action: (res) => { const payload = res[EVENT.DRAWER.OPEN] + console.log(' >>> payload >>> ', payload) /* log('should open payload thread: ', payload.thread) log('should open payload id: ', payload.data.id) diff --git a/src/containers/tool/Drawer/styles/add_on/index.ts b/src/containers/tool/Drawer/styles/add_on/index.ts index 0ca70d507..8ad8f9bfc 100755 --- a/src/containers/tool/Drawer/styles/add_on/index.ts +++ b/src/containers/tool/Drawer/styles/add_on/index.ts @@ -3,6 +3,12 @@ import styled from 'styled-components' import css, { theme } from '@/utils/css' export const Wrapper = styled.div` + position: absolute; + right: 82px; + top: 18px; + z-index: 1; +` +export const ViewerWrapper = styled.div` /* border: 1px solid tomato; */ width: 60px; ${css.flexColumn('align-end')}; diff --git a/src/containers/tool/Drawer/styles/index.ts b/src/containers/tool/Drawer/styles/index.ts index 968edef45..c7fb6bf43 100755 --- a/src/containers/tool/Drawer/styles/index.ts +++ b/src/containers/tool/Drawer/styles/index.ts @@ -1,18 +1,18 @@ import styled from 'styled-components' -import { contains } from 'ramda' import type { TActive } from '@/spec' import css, { theme, zIndex } from '@/utils/css' +import { pixelAdd } from '@/utils/dom' import type { TDrawer, TSwipe } from '../spec' import { - WIDE_CASE, - WIDE_WIDTH, - NARROW_WIDTH, getTransform, getMobileContentHeight, getContentLinearGradient, getDim, + isViewerMode, + getDrawerWidth, + getDrawerMinWidth, } from './metrics' export const DrawerOverlay = styled.div` @@ -61,27 +61,23 @@ export const DrawerWrapper = styled.div.attrs( )` ${css.flex()}; position: fixed; - right: ${({ rightOffset }) => rightOffset}; - top: 0px; + right: ${({ rightOffset, type }) => + isViewerMode(type) ? rightOffset : pixelAdd(rightOffset, -25)}; + top: ${({ type }) => (isViewerMode(type) ? 0 : '25px')}; color: ${theme('drawer.font')}; box-sizing: border-box; font-family: Roboto, sans-serif; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - border-radius: 0px; height: 100%; - width: ${({ type }) => - contains(type, WIDE_CASE) ? WIDE_WIDTH : NARROW_WIDTH}; - - min-width: ${({ type }) => (contains(type, WIDE_CASE) ? '700px' : '450px')}; + width: ${({ type }) => getDrawerWidth(type)}; + min-width: ${({ type }) => getDrawerMinWidth(type)}; z-index: ${({ visible }) => (visible ? zIndex.drawer : -1)}; visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')}; opacity: ${({ visible, fromContentEdge }) => !visible && !fromContentEdge ? 0 : 1}; - /* max-width: ${({ visible, fromContentEdge }) => - !visible && !fromContentEdge ? '60%' : '985px'}; */ max-width: 985px; ${({ fromContentEdge }) => @@ -102,12 +98,16 @@ export const DrawerWrapper = styled.div.attrs( `}; ` -export const DrawerContent = styled.div` +export const DrawerContent = styled.div<{ type: string }>` + position: relative; /* 60 is the width of addon */ width: calc(100% - 60px); background-color: ${theme('drawer.bg')}; - height: 100vh; - box-shadow: ${theme('drawer.shadow')}; + height: ${({ type }) => + isViewerMode(type) ? '100vh' : 'calc(100vh - 50px)'}; + border-radius: ${({ type }) => (isViewerMode(type) ? 0 : '10px')}; + box-shadow: ${({ type }) => + isViewerMode(type) ? theme('drawer.shadow') : theme('drawer.shadowLite')}; ` type TDrawerMobile = { options: Record; bgColor: string } export const DrawerMobileContent = styled.div` diff --git a/src/containers/tool/Drawer/styles/metrics.ts b/src/containers/tool/Drawer/styles/metrics.ts index 2b4214190..b735a2ecc 100644 --- a/src/containers/tool/Drawer/styles/metrics.ts +++ b/src/containers/tool/Drawer/styles/metrics.ts @@ -1,4 +1,4 @@ -import { concat, keys, reduce } from 'ramda' +import { concat, keys, reduce, contains } from 'ramda' import { TYPE, ARTICLE_THREAD } from '@/constant' type Options = { @@ -6,8 +6,8 @@ type Options = { direction?: 'bottom' | 'top' } -export const WIDE_WIDTH = '70%' -export const NARROW_WIDTH = '40%' +const VIEWER_WIDTH = '70%' +const NORMAL_WIDTH = '475px' export const SWIPE_THRESHOLD = { top: { @@ -22,7 +22,7 @@ export const SWIPE_THRESHOLD = { }, } -export const WIDE_CASE = reduce( +const VIEWER_TYPES = reduce( concat, // @ts-ignore [TYPE.DRAWER.MAILS_VIEW], @@ -33,6 +33,22 @@ export const WIDE_CASE = reduce( ]), ) +/** + * viewer-mode is wider, for aritlce viewer, editor staff + * normal-mode is for settings, user preview staff + */ +export const isViewerMode = (type: string): boolean => { + return contains(type, VIEWER_TYPES) +} + +export const getDrawerWidth = (type: string): string => { + return isViewerMode(type) ? VIEWER_WIDTH : NORMAL_WIDTH +} + +export const getDrawerMinWidth = (type: string): string => { + return isViewerMode(type) ? '700px' : '450px' +} + // export for modeline usage export const L_HEIGHT = '25vh' const L_TRANSLATE = '300%' diff --git a/src/widgets/Header/AddOns.tsx b/src/widgets/Header/AddOns.tsx index 114f15c08..d47a4539b 100755 --- a/src/widgets/Header/AddOns.tsx +++ b/src/widgets/Header/AddOns.tsx @@ -3,7 +3,7 @@ import { FC, memo } from 'react' import type { TAccount } from '@/spec' import { EVENT } from '@/constant' -import { send, c11nSettins } from '@/utils/helper' +import { send, c11nSettings } from '@/utils/helper' import UserAccount from './UserAccount' @@ -33,7 +33,7 @@ const AddOns: FC = ({ accountInfo }) => { return ( -
c11nSettins()}> +
c11nSettings()}>
  diff --git a/src/widgets/NoticeBar/styles/index.ts b/src/widgets/NoticeBar/styles/index.ts index fddcf2b46..8daa0cd81 100755 --- a/src/widgets/NoticeBar/styles/index.ts +++ b/src/widgets/NoticeBar/styles/index.ts @@ -22,7 +22,7 @@ export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({ padding-bottom: 8px; /* width: 100%; */ min-height: 40px; - background: ${({ noBg }) => (noBg ? 'transparent' : '#00333f')}; + background: ${({ noBg }) => (noBg ? 'transparent' : '#FDF6E8')}; border-radius: 8px; margin-top: ${({ top }) => `${top || 0}px`}; diff --git a/src/widgets/PostItem/DesktopView/Header.tsx b/src/widgets/PostItem/DesktopView/Header.tsx index e2788beaf..30de8fdcd 100644 --- a/src/widgets/PostItem/DesktopView/Header.tsx +++ b/src/widgets/PostItem/DesktopView/Header.tsx @@ -4,7 +4,7 @@ import dynamic from 'next/dynamic' import type { TPost } from '@/spec' import { EVENT } from '@/constant' -import { send } from '@/utils/helper' +import { send, c11nSettings } from '@/utils/helper' import AvatarsGroup from '@/widgets/AvatarsGroup' // import TagsList from '@/widgets/TagsList' @@ -32,9 +32,8 @@ const Header: FC = ({ item }) => { return ( - send(EVENT.PREVIEW_ARTICLE, { article: item })}> - {item.title} - + {/* send(EVENT.PREVIEW_ARTICLE, { article: item })}> */} + <Title onClick={() => c11nSettings()}>{item.title} {/* @ts-ignore */} diff --git a/src/widgets/PostItem/styles/desktop_view/viewing_sign.ts b/src/widgets/PostItem/styles/desktop_view/viewing_sign.ts index 85fd38060..45df8d080 100644 --- a/src/widgets/PostItem/styles/desktop_view/viewing_sign.ts +++ b/src/widgets/PostItem/styles/desktop_view/viewing_sign.ts @@ -6,12 +6,11 @@ import ViewSVG from '@/icons/View' export const Wrapper = styled.div` ${css.flex()}; position: absolute; - left: -28px; - top: 11px; + left: -30px; + top: 18px; animation: ${animate.fadeInRight} 0.25s linear; ` export const ViewIcon = styled(ViewSVG)` ${css.size(10)}; - fill: ${theme('thread.articleTitle')}; + fill: ${theme('thread.articleDigest')}; ` -export const Title = styled.div`` diff --git a/src/widgets/Switcher/styles/metric/radio.ts b/src/widgets/Switcher/styles/metric/radio.ts index 3179e9eb8..2f9a2212f 100644 --- a/src/widgets/Switcher/styles/metric/radio.ts +++ b/src/widgets/Switcher/styles/metric/radio.ts @@ -4,7 +4,7 @@ import { SIZE } from '@/constant' import { TTheme } from '@/spec' export const getActiveBackground = (dimOnActive: boolean): TTheme => { - return dimOnActive ? '#00414F' : theme('button.primary') + return dimOnActive ? theme('border') : theme('button.primary') } export const getLabelColor = ( diff --git a/src/widgets/Switcher/styles/radio.ts b/src/widgets/Switcher/styles/radio.ts index 34638ab90..4c555d5f1 100644 --- a/src/widgets/Switcher/styles/radio.ts +++ b/src/widgets/Switcher/styles/radio.ts @@ -29,6 +29,7 @@ export const Label = styled.label` font-size: ${({ size }) => getLabelFontsize(size)}; margin-right: ${({ checked }) => (checked ? '16px' : '8px')}; padding-left: ${({ checked }) => (checked ? '14px' : '24px')}; + font-weight: ${({ checked }) => (checked ? 'bold' : 'normal')}; padding-right: 14px; padding-top: 1px; padding-bottom: 1px; diff --git a/src/widgets/Switcher/styles/tabs/drawer_view.ts b/src/widgets/Switcher/styles/tabs/drawer_view.ts index 48804e943..ba410cdf0 100644 --- a/src/widgets/Switcher/styles/tabs/drawer_view.ts +++ b/src/widgets/Switcher/styles/tabs/drawer_view.ts @@ -18,19 +18,19 @@ export const TabItem = styled.div` padding-bottom: 4px; color: ${({ active }) => active ? theme('thread.articleTitle') : theme('thread.articleDigest')}; - background: ${({ active }) => (active ? '#0f4150' : '#093542')}; + background: ${({ active }) => (active ? theme('border') : theme('hoverBg'))}; font-weight: ${({ active }) => (active ? 'bold' : 'normal')}; font-size: 12px; flex-grow: 1; cursor: pointer; :first-child { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; + border-top-left-radius: 8px; + border-bottom-left-radius: 8px; } :last-child { - border-top-right-radius: 6px; - border-bottom-right-radius: 6px; + border-top-right-radius: 8px; + border-bottom-right-radius: 8px; } ` diff --git a/utils/helper.ts b/utils/helper.ts index 1cb0becfc..6ab4466b2 100755 --- a/utils/helper.ts +++ b/utils/helper.ts @@ -258,7 +258,7 @@ export const listUsers = (data): void => { send(EVENT.DRAWER.OPEN, { type, data }) } -export const c11nSettins = (): void => { +export const c11nSettings = (): void => { send(EVENT.DRAWER.OPEN, { type: TYPE.DRAWER.C11N_SETTINGS }) } diff --git a/utils/themes/skins/github.ts b/utils/themes/skins/github.ts index 66086f42b..f14086d35 100755 --- a/utils/themes/skins/github.ts +++ b/utils/themes/skins/github.ts @@ -168,6 +168,7 @@ const github = { font: primaryColor, bg: contentBg, shadow: '-5px -1px 20px 0px rgb(143 143 143 / 27%)', + shadowLite: '-1px 3px 20px 0px rgb(143 143 143 / 27%)', closerShadow: '-7px 4px 20px 0px rgb(143 143 143 / 27%)', markdownHelperBg: '#F9FCFC', accountBg: '#FFFFFF',