Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 56b96a6

Browse files
authored
fix(article): goto top visible logic & position adjust (#1117)
1 parent 3ddea84 commit 56b96a6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/containers/tool/ArticleSticker/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const ArticleStickerContainer: FC<TProps> = ({
4545
viewingData,
4646
activeThread,
4747
isTocMenuOpened,
48+
isArticleDigestInViewport,
4849
showCommentSticker,
4950
} = store
5051

@@ -67,7 +68,7 @@ const ArticleStickerContainer: FC<TProps> = ({
6768
/>
6869
<CommentSticker show={showCommentSticker} data={viewingData} />
6970
</MainWrapper>
70-
<GoTopWrapper>
71+
<GoTopWrapper show={!isArticleDigestInViewport}>
7172
<GotoTop />
7273
</GoTopWrapper>
7374
</InnerWrapper>

src/containers/tool/ArticleSticker/styles/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import type { TTestable, TMetric } from '@/spec'
3+
import type { TTestable, TMetric, TActive } from '@/spec'
44
import Img from '@/Img'
55
import { animate, theme, css } from '@/utils'
66

@@ -10,9 +10,7 @@ export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
1010
}))<TWrapper>`
1111
${css.flexColumn('align-center', 'justify-start')};
1212
${({ metric }) => css.fitStickerWidth(metric)};
13-
/* bottom has a go-to-top button */
14-
height: 85vh;
15-
/* border: 1px solid tomato; */
13+
min-height: 68vh;
1614
`
1715
export const InnerWrapper = styled.div`
1816
${css.flexColumn('justify-between')}
@@ -73,8 +71,10 @@ export const Text = styled.div`
7371
font-size: 11px;
7472
`
7573

76-
export const GoTopWrapper = styled.div`
74+
export const GoTopWrapper = styled.div<TActive>`
7775
${css.flex('align-both')};
78-
position: relative;
76+
opacity: ${({ show }) => (show ? 1 : 0)};
77+
position: absolute;
78+
bottom: -50px;
7979
width: 100%;
8080
`

0 commit comments

Comments
 (0)