atlas-design-system 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.eslintrc.js +33 -0
  2. package/README.md +5 -0
  3. package/example/README.md +50 -0
  4. package/example/app/_layout.tsx +32 -0
  5. package/example/app/buttonGallery.tsx +49 -0
  6. package/example/app/dateTimeInputGallery.tsx +28 -0
  7. package/example/app/index.tsx +58 -0
  8. package/example/app/selectInputGallery.tsx +45 -0
  9. package/example/app/sheetGallery.tsx +36 -0
  10. package/example/app/switchToggleInputGallery.tsx +28 -0
  11. package/example/app/textGallery.tsx +68 -0
  12. package/example/app/textInputGallery.tsx +28 -0
  13. package/example/app.json +37 -0
  14. package/example/assets/fonts/SpaceMono-Regular.ttf +0 -0
  15. package/example/assets/images/adaptive-icon.png +0 -0
  16. package/example/assets/images/favicon.png +0 -0
  17. package/example/assets/images/icon.png +0 -0
  18. package/example/assets/images/partial-react-logo.png +0 -0
  19. package/example/assets/images/react-logo.png +0 -0
  20. package/example/assets/images/react-logo@2x.png +0 -0
  21. package/example/assets/images/react-logo@3x.png +0 -0
  22. package/example/assets/images/splash.png +0 -0
  23. package/example/babel.config.js +6 -0
  24. package/example/components/Collapsible.tsx +41 -0
  25. package/example/components/ExternalLink.tsx +24 -0
  26. package/example/components/ParallaxScrollView.tsx +76 -0
  27. package/example/components/ThemedText.tsx +60 -0
  28. package/example/components/ThemedView.tsx +14 -0
  29. package/example/components/__tests__/ThemedText-test.tsx +10 -0
  30. package/example/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +24 -0
  31. package/example/components/navigation/TabBarIcon.js +24 -0
  32. package/example/components/navigation/TabBarIcon.tsx +9 -0
  33. package/example/constants/Colors.ts +26 -0
  34. package/example/hooks/useColorScheme.ts +1 -0
  35. package/example/hooks/useThemeColor.ts +22 -0
  36. package/example/ios/.xcode.env +11 -0
  37. package/example/ios/Podfile +58 -0
  38. package/example/ios/Podfile.lock +1603 -0
  39. package/example/ios/Podfile.properties.json +4 -0
  40. package/example/ios/example/AppDelegate.h +7 -0
  41. package/example/ios/example/AppDelegate.mm +62 -0
  42. package/example/ios/example/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
  43. package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +14 -0
  44. package/example/ios/example/Images.xcassets/Contents.json +6 -0
  45. package/example/ios/example/Images.xcassets/SplashScreen.imageset/Contents.json +21 -0
  46. package/example/ios/example/Images.xcassets/SplashScreen.imageset/image.png +0 -0
  47. package/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/Contents.json +21 -0
  48. package/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
  49. package/example/ios/example/Info.plist +81 -0
  50. package/example/ios/example/PrivacyInfo.xcprivacy +48 -0
  51. package/example/ios/example/SplashScreen.storyboard +51 -0
  52. package/example/ios/example/Supporting/Expo.plist +12 -0
  53. package/example/ios/example/example-Bridging-Header.h +3 -0
  54. package/example/ios/example/example.entitlements +5 -0
  55. package/example/ios/example/main.m +10 -0
  56. package/example/ios/example/noop-file.swift +4 -0
  57. package/example/ios/example.xcodeproj/project.pbxproj +555 -0
  58. package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -0
  59. package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -0
  60. package/example/metro.config.js +34 -0
  61. package/example/package.json +53 -0
  62. package/example/react-native.config.js +9 -0
  63. package/example/scripts/reset-project.js +73 -0
  64. package/example/tsconfig.json +17 -0
  65. package/example/yarn.lock +8571 -0
  66. package/package.json +49 -0
  67. package/src/components/Button/Button.tsx +110 -0
  68. package/src/components/Button/index.ts +2 -0
  69. package/src/components/Button/styles/ButtonStyle.ts +47 -0
  70. package/src/components/DateTimeInput/index.tsx +172 -0
  71. package/src/components/DragHandle/index.tsx +49 -0
  72. package/src/components/MenuItemDescription/MenuItemDescription.tsx +34 -0
  73. package/src/components/MenuItemDescription/index.ts +1 -0
  74. package/src/components/NavigationListRow/index.tsx +68 -0
  75. package/src/components/SelectInput/SelectInput.tsx +191 -0
  76. package/src/components/SelectInput/index.ts +2 -0
  77. package/src/components/SelectInput/types.ts +5 -0
  78. package/src/components/Sheet/index.tsx +189 -0
  79. package/src/components/SwitchToggle/index.tsx +31 -0
  80. package/src/components/Text/Text.tsx +74 -0
  81. package/src/components/Text/index.tsx +2 -0
  82. package/src/components/TextInput/TextInput.tsx +241 -0
  83. package/src/components/TextInput/index.tsx +2 -0
  84. package/src/components/TitleBar/TitleBar.tsx +150 -0
  85. package/src/components/TitleBar/index.ts +2 -0
  86. package/src/components/index.ts +11 -0
  87. package/src/context/index.ts +6 -0
  88. package/src/hooks/index.ts +2 -0
  89. package/src/hooks/useTheme.ts +7 -0
  90. package/src/hooks/useThemedStyle.ts +18 -0
  91. package/src/index.ts +5 -0
  92. package/src/shared/styles/index.ts +33 -0
  93. package/src/themes/AtlasLightTheme.ts +90 -0
  94. package/src/themes/index.ts +1 -0
  95. package/src/types/index.ts +3 -0
  96. package/src/types/theme.ts +45 -0
  97. package/src/types/typography.ts +14 -0
  98. package/tsconfig.json +111 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,33 @@
1
+ module.exports = {
2
+ env: {
3
+ es6: true,
4
+ node: true,
5
+ },
6
+ parser: "@typescript-eslint/parser", // Use the TypeScript parser
7
+ extends: [
8
+ "eslint:recommended",
9
+ "plugin:react/recommended",
10
+ "plugin:@typescript-eslint/recommended",
11
+ ],
12
+ parserOptions: {
13
+ ecmaVersion: 2021,
14
+ sourceType: "module",
15
+ ecmaFeatures: {
16
+ jsx: true,
17
+ },
18
+ },
19
+ plugins: ["react", "react-native", "@typescript-eslint"],
20
+ rules: {
21
+ "react/jsx-uses-react": "off",
22
+ "react/react-in-jsx-scope": "off",
23
+ "react-native/no-unused-styles": "off",
24
+ "react-native/split-platform-components": "warn",
25
+ "react-native/no-inline-styles": "error",
26
+ "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
27
+ },
28
+ settings: {
29
+ react: {
30
+ version: "detect",
31
+ },
32
+ },
33
+ };
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Atlas Design System
2
+
3
+
4
+ # Running exmple app
5
+
@@ -0,0 +1,50 @@
1
+ # Welcome to your Expo app 👋
2
+
3
+ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
4
+
5
+ ## Get started
6
+
7
+ 1. Install dependencies
8
+
9
+ ```bash
10
+ npm install
11
+ ```
12
+
13
+ 2. Start the app
14
+
15
+ ```bash
16
+ npx expo start
17
+ ```
18
+
19
+ In the output, you'll find options to open the app in a
20
+
21
+ - [development build](https://docs.expo.dev/develop/development-builds/introduction/)
22
+ - [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
23
+ - [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
24
+ - [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
25
+
26
+ You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
27
+
28
+ ## Get a fresh project
29
+
30
+ When you're ready, run:
31
+
32
+ ```bash
33
+ npm run reset-project
34
+ ```
35
+
36
+ This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
37
+
38
+ ## Learn more
39
+
40
+ To learn more about developing your project with Expo, look at the following resources:
41
+
42
+ - [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
43
+ - [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
44
+
45
+ ## Join the community
46
+
47
+ Join our community of developers creating universal apps.
48
+
49
+ - [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
50
+ - [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
@@ -0,0 +1,32 @@
1
+ import { Stack } from "expo-router";
2
+
3
+ import { ThemeContext, ATLAS_LIGHT, TitleBar } from "atlas-design-system";
4
+
5
+ export default function RootLayout() {
6
+ return (
7
+ <ThemeContext.Provider value={ATLAS_LIGHT}>
8
+ <Stack
9
+ screenOptions={{
10
+ header: ({ options, navigation }) => (
11
+ <TitleBar
12
+ title={options.title}
13
+ canGoBack={navigation.canGoBack()}
14
+ onBackPressed={() => {
15
+ navigation.goBack();
16
+ }}
17
+ />
18
+ ),
19
+ }}
20
+ >
21
+ <Stack.Screen name="index" options={{ title: "Components" }} />
22
+ <Stack.Screen name="dateTimeInputGallery" options={{ title: "Date Time Input" }} />
23
+ <Stack.Screen name="textInputGallery" options={{ title: "Text Input" }} />
24
+ <Stack.Screen name="switchToggleInputGallery" options={{ title: "Switch Toggle" }} />
25
+ <Stack.Screen name="textGallery" options={{ title: "Text" }} />
26
+ <Stack.Screen name="buttonGallery" options={{ title: "Button" }} />
27
+ <Stack.Screen name="sheetGallery" options={{ title: "Sheet" }} />
28
+ <Stack.Screen name="selectInputGallery" options={{ title: "Select Input" }} />
29
+ </Stack>
30
+ </ThemeContext.Provider>
31
+ );
32
+ }
@@ -0,0 +1,49 @@
1
+ import React, { useState, useCallback } from "react";
2
+ import { ScrollView, View, StyleSheet, Alert } from "react-native";
3
+
4
+ import { Button, useThemedStyle, TextInput } from "atlas-design-system";
5
+
6
+ export default function ButtonGallery() {
7
+ const styles = useStyles().styles;
8
+
9
+ const [sampleText, setSetsampleText] = useState("The quick brown fox");
10
+
11
+ const onPress = () => {
12
+ Alert.alert('Alert', 'button pressed')
13
+ }
14
+
15
+ return (
16
+ <ScrollView contentContainerStyle={styles.container}>
17
+ <TextInput
18
+ label="Enter button text here"
19
+ value={sampleText}
20
+ onChangeText={setSetsampleText}
21
+ />
22
+ <View style={styles.section}>
23
+ <Button onPress={onPress} text={sampleText}></Button>
24
+ <Button appearance='secondary' onPress={onPress} text={sampleText}></Button>
25
+ <Button loading onPress={onPress} text={sampleText}></Button>
26
+ <Button onPress={onPress} appearance='destructive' text={sampleText}></Button>
27
+ <Button disabled text={sampleText}></Button>
28
+ </View>
29
+ </ScrollView>
30
+ );
31
+ }
32
+
33
+ const useStyles = () =>
34
+ useThemedStyle(
35
+ useCallback(
36
+ (t) =>
37
+ StyleSheet.create({
38
+ section: {
39
+ rowGap: t.size.baseSize * 2,
40
+ },
41
+ container: {
42
+ rowGap: t.size.baseSize * 4,
43
+ paddingVertical: t.size.baseSize * 4,
44
+ paddingHorizontal: t.size.baseSize * 4,
45
+ },
46
+ }),
47
+ []
48
+ )
49
+ );
@@ -0,0 +1,28 @@
1
+ import { useState, useCallback } from "react";
2
+ import { ScrollView, StyleSheet } from "react-native";
3
+
4
+ import { DateTimeInput, useThemedStyle } from "atlas-design-system";
5
+
6
+ export default function DateTimeInputGallery() {
7
+ const styles = useStyles().styles;
8
+ const [date, setDate] = useState(new Date());
9
+ return (
10
+ <ScrollView contentContainerStyle={styles.container}>
11
+ <DateTimeInput value={date} onChange={setDate} label="Date Time Input"/>
12
+ </ScrollView>
13
+ );
14
+ }
15
+
16
+ const useStyles = () =>
17
+ useThemedStyle(
18
+ useCallback(
19
+ (t) =>
20
+ StyleSheet.create({
21
+ container: {
22
+ paddingTop: t.size.baseSize *4,
23
+ paddingHorizontal: t.size.baseSize * 4,
24
+ },
25
+ }),
26
+ []
27
+ )
28
+ );
@@ -0,0 +1,58 @@
1
+ import { ScrollView } from "react-native";
2
+ import { router } from "expo-router";
3
+
4
+ import { NavigationListRow } from "atlas-design-system";
5
+
6
+ export default function Index() {
7
+ return (
8
+ <ScrollView
9
+ contentContainerStyle={{
10
+ flex: 1,
11
+ alignItems: "center",
12
+ }}
13
+ >
14
+ <NavigationListRow
15
+ onPress={() => {
16
+ router.navigate("/dateTimeInputGallery");
17
+ }}
18
+ label="Date Time Input"
19
+ ></NavigationListRow>
20
+ <NavigationListRow
21
+ onPress={() => {
22
+ router.navigate("/textInputGallery");
23
+ }}
24
+ label="Text Input"
25
+ />
26
+ <NavigationListRow
27
+ onPress={() => {
28
+ router.navigate("/selectInputGallery");
29
+ }}
30
+ label="Select Input"
31
+ />
32
+ <NavigationListRow
33
+ onPress={() => {
34
+ router.navigate("/switchToggleInputGallery");
35
+ }}
36
+ label="Switch Toggle"
37
+ ></NavigationListRow>
38
+ <NavigationListRow
39
+ onPress={() => {
40
+ router.navigate("/textGallery");
41
+ }}
42
+ label="Text"
43
+ ></NavigationListRow>
44
+ <NavigationListRow
45
+ onPress={() => {
46
+ router.navigate("/buttonGallery");
47
+ }}
48
+ label="Button"
49
+ ></NavigationListRow>
50
+ <NavigationListRow
51
+ onPress={() => {
52
+ router.navigate("/sheetGallery");
53
+ }}
54
+ label="Sheet"
55
+ ></NavigationListRow>
56
+ </ScrollView>
57
+ );
58
+ }
@@ -0,0 +1,45 @@
1
+ import { useState, useCallback } from "react";
2
+ import { ScrollView, StyleSheet } from "react-native";
3
+
4
+ import { useThemedStyle, SelectInput, Option } from "atlas-design-system";
5
+
6
+ export default function selectInputGallery() {
7
+ const styles = useStyles().styles;
8
+
9
+ const [selectedOption, setSelectedOption] = useState<Option>();
10
+
11
+ return (
12
+ <ScrollView contentContainerStyle={styles.container}>
13
+ <SelectInput
14
+ options={[
15
+ {
16
+ value: "almond",
17
+ label: "Almond",
18
+ selected: selectedOption?.value === "almond",
19
+ },
20
+ {
21
+ value: "honey",
22
+ label: "Honey",
23
+ selected: selectedOption?.value === "honey",
24
+ },
25
+ ]}
26
+ onChange={setSelectedOption}
27
+ label="Select One"
28
+ />
29
+ </ScrollView>
30
+ );
31
+ }
32
+
33
+ const useStyles = () =>
34
+ useThemedStyle(
35
+ useCallback(
36
+ (t) =>
37
+ StyleSheet.create({
38
+ container: {
39
+ paddingTop: t.size.baseSize * 4,
40
+ paddingHorizontal: t.size.baseSize * 4,
41
+ },
42
+ }),
43
+ []
44
+ )
45
+ );
@@ -0,0 +1,36 @@
1
+ import { useState, useCallback } from "react";
2
+ import { ScrollView, StyleSheet } from "react-native";
3
+
4
+ import { Sheet, useThemedStyle, Button, Text } from "atlas-design-system";
5
+
6
+ export default function DateTimeInputGallery() {
7
+ const styles = useStyles().styles;
8
+ const [open, setOpen] = useState(false);
9
+ return (
10
+ <ScrollView contentContainerStyle={styles.container}>
11
+ <Button
12
+ text="Open Sheet"
13
+ onPress={() => {
14
+ setOpen(true);
15
+ }}
16
+ />
17
+ <Sheet open={open} setOpen={setOpen} header='Sheet Header'>
18
+ <Text>Hi</Text>
19
+ </Sheet>
20
+ </ScrollView>
21
+ );
22
+ }
23
+
24
+ const useStyles = () =>
25
+ useThemedStyle(
26
+ useCallback(
27
+ (t) =>
28
+ StyleSheet.create({
29
+ container: {
30
+ paddingTop: t.size.baseSize * 4,
31
+ paddingHorizontal: t.size.baseSize * 4,
32
+ },
33
+ }),
34
+ []
35
+ )
36
+ );
@@ -0,0 +1,28 @@
1
+ import { useState, useCallback } from "react";
2
+ import { ScrollView, StyleSheet } from "react-native";
3
+
4
+ import { SwitchToggle, useThemedStyle } from "atlas-design-system";
5
+
6
+ export default function DateTimeInputGallery() {
7
+ const styles = useStyles().styles;
8
+ const [value, setValue] = useState();
9
+ return (
10
+ <ScrollView contentContainerStyle={styles.container}>
11
+ <SwitchToggle value={value} onChange={setValue} label="Switch Toggle"/>
12
+ </ScrollView>
13
+ );
14
+ }
15
+
16
+ const useStyles = () =>
17
+ useThemedStyle(
18
+ useCallback(
19
+ (t) =>
20
+ StyleSheet.create({
21
+ container: {
22
+ paddingTop: t.size.baseSize *4,
23
+ paddingHorizontal: t.size.baseSize * 4,
24
+ },
25
+ }),
26
+ []
27
+ )
28
+ );
@@ -0,0 +1,68 @@
1
+ import React, { useState, useCallback } from "react";
2
+ import { ScrollView, View, StyleSheet } from "react-native";
3
+
4
+ import { Text, useThemedStyle, TextInput } from "atlas-design-system";
5
+
6
+ export default function textGallery() {
7
+ const styles = useStyles().styles;
8
+
9
+ const [sampleText, setSetsampleText] = useState("The quick brown fox");
10
+
11
+ return (
12
+ <ScrollView contentContainerStyle={styles.container}>
13
+ <TextInput
14
+ label="Enter Your Text Here"
15
+ value={sampleText}
16
+ onChangeText={setSetsampleText}
17
+ />
18
+ <View style={styles.section}>
19
+ <Text category="h1">{sampleText}</Text>
20
+ <Text category="h2">{sampleText}</Text>
21
+ <Text category="h3">{sampleText}</Text>
22
+ <Text category="p1">{sampleText}</Text>
23
+ <Text category="p2">{sampleText}</Text>
24
+ <Text category="p3">{sampleText}</Text>
25
+ </View>
26
+ <View style={styles.section}>
27
+ <Text contrast='medium' category="h1">{sampleText}</Text>
28
+ <Text contrast='medium' category="h2">{sampleText}</Text>
29
+ <Text contrast='medium' category="h3">{sampleText}</Text>
30
+ <Text contrast='medium' category="p1">{sampleText}</Text>
31
+ <Text contrast='medium' category="p2">{sampleText}</Text>
32
+ <Text contrast='medium' category="p3">{sampleText}</Text>
33
+ </View>
34
+ <View style={styles.section}>
35
+ <Text contrast='low' category="h1">{sampleText}</Text>
36
+ <Text contrast='low' category="h2">{sampleText}</Text>
37
+ <Text contrast='low' category="h3">{sampleText}</Text>
38
+ <Text contrast='low' category="p1">{sampleText}</Text>
39
+ <Text contrast='low' category="p2">{sampleText}</Text>
40
+ <Text contrast='low' category="p3">{sampleText}</Text>
41
+ </View>
42
+ <View style={styles.section}>
43
+ <Text status="informative">{sampleText}</Text>
44
+ <Text status="warning">{sampleText}</Text>
45
+ <Text status="success">{sampleText}</Text>
46
+ <Text status="error">{sampleText}</Text>
47
+ </View>
48
+ </ScrollView>
49
+ );
50
+ }
51
+
52
+ const useStyles = () =>
53
+ useThemedStyle(
54
+ useCallback(
55
+ (t) =>
56
+ StyleSheet.create({
57
+ section: {
58
+ rowGap: t.size.baseSize * 2,
59
+ },
60
+ container: {
61
+ rowGap: t.size.baseSize * 4,
62
+ paddingVertical: t.size.baseSize * 4,
63
+ paddingHorizontal: t.size.baseSize * 4,
64
+ },
65
+ }),
66
+ []
67
+ )
68
+ );
@@ -0,0 +1,28 @@
1
+ import { useState, useCallback } from "react";
2
+ import { ScrollView, StyleSheet } from "react-native";
3
+
4
+ import { TextInput, useThemedStyle } from "atlas-design-system";
5
+
6
+ export default function DateTimeInputGallery() {
7
+ const styles = useStyles().styles;
8
+ const [text, setText] = useState();
9
+ return (
10
+ <ScrollView contentContainerStyle={styles.container}>
11
+ <TextInput value={text} onChange={setText} label="Text Input"/>
12
+ </ScrollView>
13
+ );
14
+ }
15
+
16
+ const useStyles = () =>
17
+ useThemedStyle(
18
+ useCallback(
19
+ (t) =>
20
+ StyleSheet.create({
21
+ container: {
22
+ paddingTop: t.size.baseSize *4,
23
+ paddingHorizontal: t.size.baseSize * 4,
24
+ },
25
+ }),
26
+ []
27
+ )
28
+ );
@@ -0,0 +1,37 @@
1
+ {
2
+ "expo": {
3
+ "name": "example",
4
+ "slug": "example",
5
+ "version": "1.0.0",
6
+ "orientation": "portrait",
7
+ "icon": "./assets/images/icon.png",
8
+ "scheme": "myapp",
9
+ "userInterfaceStyle": "automatic",
10
+ "splash": {
11
+ "image": "./assets/images/splash.png",
12
+ "resizeMode": "contain",
13
+ "backgroundColor": "#ffffff"
14
+ },
15
+ "ios": {
16
+ "supportsTablet": true,
17
+ "bundleIdentifier": "com.juancastillom.ads"
18
+ },
19
+ "android": {
20
+ "adaptiveIcon": {
21
+ "foregroundImage": "./assets/images/adaptive-icon.png",
22
+ "backgroundColor": "#ffffff"
23
+ }
24
+ },
25
+ "web": {
26
+ "bundler": "metro",
27
+ "output": "static",
28
+ "favicon": "./assets/images/favicon.png"
29
+ },
30
+ "plugins": [
31
+ "expo-router"
32
+ ],
33
+ "experiments": {
34
+ "typedRoutes": true
35
+ }
36
+ }
37
+ }
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+ module.exports = function (api) {
2
+ api.cache(true);
3
+ return {
4
+ presets: ['babel-preset-expo'],
5
+ };
6
+ };
@@ -0,0 +1,41 @@
1
+ import Ionicons from '@expo/vector-icons/Ionicons';
2
+ import { PropsWithChildren, useState } from 'react';
3
+ import { StyleSheet, TouchableOpacity, useColorScheme } from 'react-native';
4
+
5
+ import { ThemedText } from '@/components/ThemedText';
6
+ import { ThemedView } from '@/components/ThemedView';
7
+ import { Colors } from '@/constants/Colors';
8
+
9
+ export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
10
+ const [isOpen, setIsOpen] = useState(false);
11
+ const theme = useColorScheme() ?? 'light';
12
+
13
+ return (
14
+ <ThemedView>
15
+ <TouchableOpacity
16
+ style={styles.heading}
17
+ onPress={() => setIsOpen((value) => !value)}
18
+ activeOpacity={0.8}>
19
+ <Ionicons
20
+ name={isOpen ? 'chevron-down' : 'chevron-forward-outline'}
21
+ size={18}
22
+ color={theme === 'light' ? Colors.light.icon : Colors.dark.icon}
23
+ />
24
+ <ThemedText type="defaultSemiBold">{title}</ThemedText>
25
+ </TouchableOpacity>
26
+ {isOpen && <ThemedView style={styles.content}>{children}</ThemedView>}
27
+ </ThemedView>
28
+ );
29
+ }
30
+
31
+ const styles = StyleSheet.create({
32
+ heading: {
33
+ flexDirection: 'row',
34
+ alignItems: 'center',
35
+ gap: 6,
36
+ },
37
+ content: {
38
+ marginTop: 6,
39
+ marginLeft: 24,
40
+ },
41
+ });
@@ -0,0 +1,24 @@
1
+ import { Link } from 'expo-router';
2
+ import { openBrowserAsync } from 'expo-web-browser';
3
+ import { type ComponentProps } from 'react';
4
+ import { Platform } from 'react-native';
5
+
6
+ type Props = Omit<ComponentProps<typeof Link>, 'href'> & { href: string };
7
+
8
+ export function ExternalLink({ href, ...rest }: Props) {
9
+ return (
10
+ <Link
11
+ target="_blank"
12
+ {...rest}
13
+ href={href}
14
+ onPress={async (event) => {
15
+ if (Platform.OS !== 'web') {
16
+ // Prevent the default behavior of linking to the default browser on native.
17
+ event.preventDefault();
18
+ // Open the link in an in-app browser.
19
+ await openBrowserAsync(href);
20
+ }
21
+ }}
22
+ />
23
+ );
24
+ }
@@ -0,0 +1,76 @@
1
+ import type { PropsWithChildren, ReactElement } from 'react';
2
+ import { StyleSheet, useColorScheme } from 'react-native';
3
+ import Animated, {
4
+ interpolate,
5
+ useAnimatedRef,
6
+ useAnimatedStyle,
7
+ useScrollViewOffset,
8
+ } from 'react-native-reanimated';
9
+
10
+ import { ThemedView } from '@/components/ThemedView';
11
+
12
+ const HEADER_HEIGHT = 250;
13
+
14
+ type Props = PropsWithChildren<{
15
+ headerImage: ReactElement;
16
+ headerBackgroundColor: { dark: string; light: string };
17
+ }>;
18
+
19
+ export default function ParallaxScrollView({
20
+ children,
21
+ headerImage,
22
+ headerBackgroundColor,
23
+ }: Props) {
24
+ const colorScheme = useColorScheme() ?? 'light';
25
+ const scrollRef = useAnimatedRef<Animated.ScrollView>();
26
+ const scrollOffset = useScrollViewOffset(scrollRef);
27
+
28
+ const headerAnimatedStyle = useAnimatedStyle(() => {
29
+ return {
30
+ transform: [
31
+ {
32
+ translateY: interpolate(
33
+ scrollOffset.value,
34
+ [-HEADER_HEIGHT, 0, HEADER_HEIGHT],
35
+ [-HEADER_HEIGHT / 2, 0, HEADER_HEIGHT * 0.75]
36
+ ),
37
+ },
38
+ {
39
+ scale: interpolate(scrollOffset.value, [-HEADER_HEIGHT, 0, HEADER_HEIGHT], [2, 1, 1]),
40
+ },
41
+ ],
42
+ };
43
+ });
44
+
45
+ return (
46
+ <ThemedView style={styles.container}>
47
+ <Animated.ScrollView ref={scrollRef} scrollEventThrottle={16}>
48
+ <Animated.View
49
+ style={[
50
+ styles.header,
51
+ { backgroundColor: headerBackgroundColor[colorScheme] },
52
+ headerAnimatedStyle,
53
+ ]}>
54
+ {headerImage}
55
+ </Animated.View>
56
+ <ThemedView style={styles.content}>{children}</ThemedView>
57
+ </Animated.ScrollView>
58
+ </ThemedView>
59
+ );
60
+ }
61
+
62
+ const styles = StyleSheet.create({
63
+ container: {
64
+ flex: 1,
65
+ },
66
+ header: {
67
+ height: 250,
68
+ overflow: 'hidden',
69
+ },
70
+ content: {
71
+ flex: 1,
72
+ padding: 32,
73
+ gap: 16,
74
+ overflow: 'hidden',
75
+ },
76
+ });