about summary refs log tree commit diff
path: root/src/components
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-03-19 15:28:06 +0000
committerSamuel Newman <mozzius@protonmail.com>2024-03-19 15:28:06 +0000
commit08d12d9a3df1fa062ecc4c67a0a2f686eba4c7c3 (patch)
tree067aa8296b8c5e8844d9d74020ac0e239cb2861e /src/components
parentf491bd89cc28cba46a92b443e1f07ff73e8f7128 (diff)
downloadvoidsky-08d12d9a3df1fa062ecc4c67a0a2f686eba4c7c3.tar.zst
move FormError to components/forms
Diffstat (limited to 'src/components')
-rw-r--r--src/components/forms/FormError.tsx34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/components/forms/FormError.tsx b/src/components/forms/FormError.tsx
new file mode 100644
index 000000000..3c6a8649d
--- /dev/null
+++ b/src/components/forms/FormError.tsx
@@ -0,0 +1,34 @@
+import React from 'react'
+import {StyleSheet, View} from 'react-native'
+
+import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/Warning'
+import {Text} from '#/components/Typography'
+import {atoms as a, useTheme} from '#/alf'
+import {colors} from '#/lib/styles'
+
+export function FormError({error}: {error?: string}) {
+  const t = useTheme()
+
+  if (!error) return null
+
+  return (
+    <View style={styles.error}>
+      <Warning fill={t.palette.white} size="sm" />
+      <View style={(a.flex_1, a.ml_sm)}>
+        <Text style={[{color: t.palette.white}, a.font_bold]}>{error}</Text>
+      </View>
+    </View>
+  )
+}
+
+const styles = StyleSheet.create({
+  error: {
+    backgroundColor: colors.red4,
+    flexDirection: 'row',
+    alignItems: 'center',
+    marginBottom: 15,
+    borderRadius: 8,
+    paddingHorizontal: 8,
+    paddingVertical: 8,
+  },
+})