about summary refs log tree commit diff
path: root/src/screens/Onboarding/StepProfile/AvatarCreatorCircle.tsx
blob: 1cd68eb61bedf50a19e7033d1def44886d66506c (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
import React from 'react'
import {View} from 'react-native'

import {Avatar} from '#/screens/Onboarding/StepProfile/index'
import {atoms as a, useTheme} from '#/alf'

export function AvatarCreatorCircle({
  avatar,
  size = 125,
}: {
  avatar: Avatar
  size?: number
}) {
  const t = useTheme()
  const Icon = avatar.placeholder.component

  const styles = React.useMemo(
    () => ({
      imageContainer: [
        a.rounded_full,
        a.overflow_hidden,
        a.align_center,
        a.justify_center,
        a.border,
        t.atoms.border_contrast_high,
        {
          height: size,
          width: size,
          backgroundColor: avatar.backgroundColor,
        },
      ],
    }),
    [avatar.backgroundColor, size, t.atoms.border_contrast_high],
  )

  return (
    <View>
      <View style={styles.imageContainer}>
        <Icon height={85} width={85} style={{color: t.palette.white}} />
      </View>
    </View>
  )
}