about summary refs log tree commit diff
path: root/src/screens/PostThread/components/ThreadItemPostTombstone.tsx
blob: 4f1ab450bbb679903637911168ba616ecf60b0cc (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
import {useMemo} from 'react'
import {View} from 'react-native'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'

import {LINEAR_AVI_WIDTH, OUTER_SPACE} from '#/screens/PostThread/const'
import {atoms as a, useTheme} from '#/alf'
import {PersonX_Stroke2_Corner0_Rounded as PersonXIcon} from '#/components/icons/Person'
import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash'
import {Text} from '#/components/Typography'

export type ThreadItemPostTombstoneProps = {
  type: 'not-found' | 'blocked'
}

export function ThreadItemPostTombstone({type}: ThreadItemPostTombstoneProps) {
  const t = useTheme()
  const {_} = useLingui()
  const {copy, Icon} = useMemo(() => {
    switch (type) {
      case 'blocked':
        return {copy: _(msg`Post blocked`), Icon: PersonXIcon}
      case 'not-found':
      default:
        return {copy: _(msg`Post not found`), Icon: TrashIcon}
    }
  }, [_, type])

  return (
    <View
      style={[
        a.mb_xs,
        {
          paddingHorizontal: OUTER_SPACE,
          paddingTop: OUTER_SPACE / 1.2,
        },
      ]}>
      <View
        style={[
          a.flex_row,
          a.align_center,
          a.rounded_sm,
          t.atoms.bg_contrast_25,
          {paddingVertical: OUTER_SPACE / 1.2},
        ]}>
        <View style={[a.flex_row, a.justify_center, {width: LINEAR_AVI_WIDTH}]}>
          <Icon style={[t.atoms.text_contrast_medium]} />
        </View>
        <Text style={[a.text_md, a.font_bold, t.atoms.text_contrast_medium]}>
          {copy}
        </Text>
      </View>
    </View>
  )
}