about summary refs log tree commit diff
path: root/src/screens/PostThread/components/ThreadItemReadMoreUp.tsx
blob: da18a19e9059f22a5c15bbd0bc77e6d0c8bd0d69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import {memo} from 'react'
import {View} from 'react-native'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'

import {type ThreadItem} from '#/state/queries/usePostThread'
import {
  LINEAR_AVI_WIDTH,
  OUTER_SPACE,
  REPLY_LINE_WIDTH,
} from '#/screens/PostThread/const'
import {atoms as a, useTheme} from '#/alf'
import {ArrowTopCircle_Stroke2_Corner0_Rounded as UpIcon} from '#/components/icons/ArrowTopCircle'
import {Link} from '#/components/Link'
import {Text} from '#/components/Typography'

export const ThreadItemReadMoreUp = memo(function ThreadItemReadMoreUp({
  item,
}: {
  item: Extract<ThreadItem, {type: 'readMoreUp'}>
}) {
  const t = useTheme()
  const {_} = useLingui()

  return (
    <Link
      label={_(msg`Continue thread`)}
      to={item.href}
      style={[
        a.gap_xs,
        {
          paddingTop: OUTER_SPACE,
          paddingHorizontal: OUTER_SPACE,
        },
      ]}>
      {({hovered, pressed}) => {
        const interacted = hovered || pressed
        return (
          <View>
            <View style={[a.flex_row, a.align_center, a.gap_md]}>
              <View
                style={[
                  a.align_center,
                  {
                    width: LINEAR_AVI_WIDTH,
                  },
                ]}>
                <UpIcon
                  fill={
                    interacted
                      ? t.atoms.text_contrast_high.color
                      : t.atoms.text_contrast_low.color
                  }
                  width={24}
                />
              </View>
              <Text
                style={[
                  a.text_sm,
                  t.atoms.text_contrast_medium,
                  interacted && [a.underline],
                ]}>
                <Trans>Continue thread...</Trans>
              </Text>
            </View>
            <View
              style={[
                a.align_center,
                {
                  width: LINEAR_AVI_WIDTH,
                },
              ]}>
              <View
                style={[
                  a.mt_xs,
                  {
                    height: OUTER_SPACE / 2,
                    width: REPLY_LINE_WIDTH,
                    backgroundColor: t.atoms.border_contrast_low.borderColor,
                  },
                ]}
              />
            </View>
          </View>
        )
      }}
    </Link>
  )
})