about summary refs log tree commit diff
path: root/src/view/com/modals/AltImageRead.tsx
blob: 4dde8f58b41eab7755b02e0932401b9845dbbb68 (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
import React, {useCallback} from 'react'
import {StyleSheet, View} from 'react-native'
import {usePalette} from 'lib/hooks/usePalette'
import {gradients, s} from 'lib/styles'
import {Text} from '../util/text/Text'
import {TouchableOpacity} from 'react-native-gesture-handler'
import LinearGradient from 'react-native-linear-gradient'
import {useStores} from 'state/index'
import {isDesktopWeb} from 'platform/detection'

export const snapPoints = ['70%']

interface Props {
  altText: string
}

export function Component({altText}: Props) {
  const pal = usePalette('default')
  const store = useStores()

  const onPress = useCallback(() => {
    store.shell.closeModal()
  }, [store])

  return (
    <View
      testID="altTextImageModal"
      style={[pal.view, styles.container, s.flex1]}>
      <Text style={[styles.title, pal.text]}>Image description</Text>
      <View style={[styles.text, pal.viewLight]}>
        <Text style={pal.text}>{altText}</Text>
      </View>
      <TouchableOpacity
        testID="altTextImageSaveBtn"
        onPress={onPress}
        accessibilityRole="button"
        accessibilityLabel="Save"
        accessibilityHint="Save alt text">
        <LinearGradient
          colors={[gradients.blueLight.start, gradients.blueLight.end]}
          start={{x: 0, y: 0}}
          end={{x: 1, y: 1}}
          style={[styles.button]}>
          <Text type="button-lg" style={[s.white, s.bold]}>
            Done
          </Text>
        </LinearGradient>
      </TouchableOpacity>
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    gap: 18,
    paddingVertical: isDesktopWeb ? 0 : 18,
    paddingHorizontal: isDesktopWeb ? 0 : 12,
    height: '100%',
    width: '100%',
  },
  title: {
    textAlign: 'center',
    fontWeight: 'bold',
    fontSize: 24,
  },
  text: {
    borderRadius: 5,
    marginVertical: 18,
    paddingHorizontal: 18,
    paddingVertical: 16,
  },
  button: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'center',
    width: '100%',
    borderRadius: 32,
    padding: 10,
  },
})