forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import React from 'react'
2import {type TextProps} from 'react-native'
3import Svg, {
4 Defs,
5 LinearGradient,
6 Path,
7 type PathProps,
8 Stop,
9 type SvgProps,
10} from 'react-native-svg'
11import {Image} from 'expo-image'
12
13import {useKawaiiMode} from '#/state/preferences/kawaii'
14import {flatten, useTheme} from '#/alf'
15
16const ratio = 57 / 64
17
18type Props = {
19 fill?: PathProps['fill']
20 style?: TextProps['style']
21} & Omit<SvgProps, 'style'>
22
23export const Logo = React.forwardRef(function LogoImpl(props: Props, ref) {
24 const t = useTheme()
25 const {fill, ...rest} = props
26 const gradient = fill === 'sky'
27 const styles = flatten(props.style)
28 const _fill = gradient
29 ? 'url(#sky)'
30 : fill || styles?.color || t.palette.primary_500
31 // @ts-ignore it's fiiiiine
32 const size = parseInt(rest.width || 32, 10)
33
34 const isKawaii = useKawaiiMode()
35
36 if (isKawaii) {
37 return (
38 <Image
39 source={
40 size > 100
41 ? require('../../../assets/kawaii.png')
42 : require('../../../assets/kawaii_smol.png')
43 }
44 accessibilityLabel="Bluesky"
45 accessibilityHint=""
46 accessibilityIgnoresInvertColors
47 style={[{height: size, aspectRatio: 1.4}]}
48 />
49 )
50 }
51
52 return (
53 <Svg
54 fill="none"
55 // @ts-ignore it's fiiiiine
56 ref={ref}
57 viewBox="0 0 64 57"
58 {...rest}
59 style={[{width: size, height: size * ratio}, styles]}>
60 {gradient && (
61 <Defs>
62 <LinearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
63 <Stop offset="0" stopColor="#0A7AFF" stopOpacity="1" />
64 <Stop offset="1" stopColor="#59B9FF" stopOpacity="1" />
65 </LinearGradient>
66 </Defs>
67 )}
68
69 <Path
70 fill={_fill}
71 d="M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805ZM50.127 3.805C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745Z"
72 />
73 </Svg>
74 )
75})