Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

refactor(article-viewer): extract common drawer viewers#1112

Merged
mydearxym merged 13 commits intodevfromcommon-drawer-viewers
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
a9354d2
fix(drawer): close ux & model blur issue
mydearxymJul 14, 2021
b058b19
refactor(Drawer): add on enhance
mydearxymJul 14, 2021
d003dc5
refactor(Drawer): adjust styles
mydearxymJul 14, 2021
84e7642
refactor(drawer): wip
mydearxymJul 15, 2021
f073885
refactor(drawer): add fixedHeader for article
mydearxymJul 16, 2021
2226b5b
refactor(drawer): improve fixedHeader function
mydearxymJul 16, 2021
9a31c3a
refactor(comment): use common IconButton
mydearxymJul 16, 2021
f7402eb
refactor(postItem): use common IconButton
mydearxymJul 16, 2021
028147a
style(avatar): adjust color
mydearxymJul 16, 2021
13cb800
refactor(upvote): PromoteList naming & upvote comment style
mydearxymJul 16, 2021
117026d
refactor(comment): remove old Upvote
mydearxymJul 16, 2021
84be17f
refactor(ArticleViewer): seperate PostViewer
mydearxymJul 16, 2021
b0b8a64
refactor(ArticleViewer): a works demo viewer
mydearxymJul 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionspublic/icons/static/article/share-solid.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletionpublic/icons/static/article/share.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/close-circle.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/close.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/link-outside.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/more-l.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/next-article-solid.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/next-article.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/previous-article-solid.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/shape/previous-article.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/social/global.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletionpublic/icons/static/social/twitter.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/social/wechat-solid.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletionspublic/icons/static/social/wechat.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletionpublic/icons/static/social/zhihu.svg
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletionpublic/icons/static/social/zhihu.svg.1
View file
Open in desktop

This file was deleted.

1 change: 1 addition & 0 deletionssrc/components/AvatarsRow/styles/more_item.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ export const Wrapper = styled(BaseAvatarItem)`

type TNumbersMore = { size: string; total: number }
export const NumbersMore = styled(AvatarsMore)<TNumbersMore>`
color: ${theme('thread.articleTitle')};
height: ${({ size }) => getAvatarSize(size)};
width: ${({ total }) => getMoreTextWidth(total)};
font-weight: 400;
Expand Down
72 changes: 72 additions & 0 deletionssrc/components/Buttons/IconButton.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
import { FC, memo, ReactNode } from 'react'

import { ICON } from '@/config'

import Tooltip from '@/components/Tooltip'
import { Wrapper, Icon, Hint } from './styles/icon_button'

export type TProps = {
path: string
size?: number
mRight?: number
mLeft?: number
mTop?: number
mBottom?: number
dimWhenIdle?: boolean
active?: boolean
hint?: ReactNode | null
hintDelay?: number
hintPlacement?: 'top' | 'bottom'
onClick?: () => void
}

const IconButton: FC<TProps> = ({
path,
size = 16,
mLeft = 0,
mRight = 10,
mTop = 0,
mBottom = 0,
active = false,
dimWhenIdle = false,
hint = null,
hintDelay = 1000,
hintPlacement = 'top',
onClick = console.log,
}) => {
return (
<Wrapper
size={size}
mRight={mRight}
mLeft={mLeft}
mTop={mTop}
mBottom={mBottom}
onClick={onClick}
>
{hint ? (
<Tooltip
placement={hintPlacement}
content={<Hint>{hint}</Hint>}
noPadding
delay={hintDelay}
>
<Icon
src={`${ICON}/${path}`}
size={size}
$active={active}
dimWhenIdle={dimWhenIdle}
/>
</Tooltip>
) : (
<Icon
src={`${ICON}/${path}`}
size={size}
$active={active}
dimWhenIdle={dimWhenIdle}
/>
)}
</Wrapper>
)
}

export default memo(IconButton)
1 change: 1 addition & 0 deletionssrc/components/Buttons/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,3 +8,4 @@ export { default as DropdownButton } from './DropdownButton'
export { default as NotifyButton } from './NotifyButton'
export { default as FollowButton } from './FollowButton'
export { default as YesOrNoButtons } from './YesOrNoButtons'
export { default as IconButton } from './IconButton'
47 changes: 47 additions & 0 deletionssrc/components/Buttons/styles/icon_button.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
import styled from 'styled-components'

import type { TActive, TSpace } from '@/spec'

import Img from '@/Img'
import { css, theme } from '@/utils'

import type { TProps as TIconButtonProps } from '../IconButton'

type TWrapper = Omit<TIconButtonProps, 'path'>
export const Wrapper = styled.div<TWrapper>`
position: relative;
${css.flex('align-both')};
width: ${({ size }) => `${size}px`};
height: ${({ size }) => `${size}px`};

margin-left: ${({ mLeft }) => `${mLeft}px`};
margin-right: ${({ mRight }) => `${mRight}px`};
margin-top: ${({ mTop }) => `${mTop}px`};
margin-bottom: ${({ mBottom }) => `${mBottom}px`};
`

type TIcon = { size: number; dimWhenIdle: boolean } & TSpace & TActive
export const Icon = styled(Img)<TIcon>`
fill: ${({ $active }) =>
$active ? '#00a59b' : theme('thread.articleDigest')};
display: block;
width: ${({ size }) => `${size}px`};
height: ${({ size }) => `${size}px`};

opacity: ${({ dimWhenIdle }) => (dimWhenIdle ? 0.7 : 1)};

&:hover {
fill: #00a59b;
opacity: 1;
cursor: pointer;
}

transition: fill 0.2s;
`

export const Hint = styled.div`
color: ${theme('thread.articleDigest')};
text-align: center;
min-width: 80px;
padding: 5px;
`
4 changes: 2 additions & 2 deletionssrc/components/Buttons/styles/metircs/arrow_button.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,8 @@ const SMALL_SIZE = 14
const MEDIUM_SIZE = 16
const LARGE_SIZE = 18

const TINY_MARGIN =6
const TINY_MARGIN_HOVER =10
const TINY_MARGIN =4
const TINY_MARGIN_HOVER =7

const SMALL_MARGIN = 6
const SMALL_MARGIN_HOVER = 10
Expand Down
32 changes: 0 additions & 32 deletionssrc/components/GotoTop/index.js
View file
Open in desktop

This file was deleted.

31 changes: 31 additions & 0 deletionssrc/components/GotoTop/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
/*
*
* GotoTop
*
*/

import { FC, memo } from 'react'

import { scrollToHeader } from '@/utils'

import { IconButton } from '@/components/Buttons'
import { Wrapper } from './styles'

type TProps = {
testid?: string
}

const GotoTop: FC<TProps> = ({ testid }) => {
return (
<Wrapper testid={testid} onClick={scrollToHeader}>
<IconButton
path="shape/air-balloon.svg"
hint="回到顶部"
size={20}
mLeft={5}
/>
</Wrapper>
)
}

export default memo(GotoTop)
29 changes: 3 additions & 26 deletionssrc/components/GotoTop/styles/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
import styled from 'styled-components'

import type { TTestable } from '@/spec'
import Img from '@/Img'
import { css, theme } from '@/utils'
import { css } from '@/utils'

export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
'data-test-id': testid,
}))<TTestable>`
${css.flex('align-both')};
${css.size(30)};
position: relative;
`
export const Icon = styled(Img)`
fill: #1e687f;
${css.size(20)};
display: block;
&:hover {
fill: #25807d;
cursor: pointer;
}
`
export const Hint = styled.div`
color: ${theme('thread.articleDigest')};
position: absolute;
right: -55px;
font-size: 12px;
opacity: 0;

${Wrapper}:hover & {
opacity: 1;
}
transition: opacity 0.25s;
transition-delay: 0.5s;
${css.flex('align-both')};
`
export const holder = 1
Loading

[8]ページ先頭

©2009-2025 Movatter.jp