Skip to content

Commit ad66677

Browse files
committed
chore(example): added a new expo app with a button example
1 parent 8034c22 commit ad66677

File tree

12 files changed

+179
-0
lines changed

12 files changed

+179
-0
lines changed

packages/app/.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
expo-env.d.ts
11+
12+
# Native
13+
*.orig.*
14+
*.jks
15+
*.p8
16+
*.p12
17+
*.key
18+
*.mobileprovision
19+
20+
# Metro
21+
.metro-health-check*
22+
23+
# debug
24+
npm-debug.*
25+
yarn-debug.*
26+
yarn-error.*
27+
28+
# macOS
29+
.DS_Store
30+
*.pem
31+
32+
# local env files
33+
.env*.local
34+
35+
# typescript
36+
*.tsbuildinfo

packages/app/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node-linker=hoisted

packages/app/App.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
2+
import { styles } from './lib/tokens';
3+
4+
export const Button = (props) => {
5+
return (<TouchableOpacity style={buttonStyles({ intent: props.intent, size: props.size })}>
6+
<Text>Button</Text>
7+
</TouchableOpacity>)
8+
}
9+
10+
const buttonStyles = styles({
11+
base: { borderRadius: '$spacing.md' },
12+
variants: {
13+
intent: {
14+
primary: {
15+
backgroundColor: '$colors.primary50',
16+
},
17+
secondary: {
18+
backgroundColor: '$colors.secondary50',
19+
}
20+
},
21+
size: {
22+
md: {
23+
paddingHorizontal: '$spacing.md',
24+
paddingVertical: '$spacing.sm',
25+
}
26+
}
27+
},
28+
defaultVariants: {
29+
intent: 'primary',
30+
size: 'md'
31+
}
32+
})
33+
34+
export default function App() {
35+
return (
36+
<View style={sty.container}>
37+
<Button intent="primary" />
38+
</View>
39+
);
40+
}
41+
42+
const sty = StyleSheet.create({
43+
container: {
44+
flex: 1,
45+
backgroundColor: '#fff',
46+
alignItems: 'center',
47+
justifyContent: 'center',
48+
},
49+
});

packages/app/app.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"expo": {
3+
"name": "app",
4+
"slug": "app",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
10+
"splash": {
11+
"image": "./assets/splash-icon.png",
12+
"resizeMode": "contain",
13+
"backgroundColor": "#ffffff"
14+
},
15+
"ios": {
16+
"supportsTablet": true
17+
},
18+
"android": {
19+
"adaptiveIcon": {
20+
"foregroundImage": "./assets/adaptive-icon.png",
21+
"backgroundColor": "#ffffff"
22+
}
23+
},
24+
"web": {
25+
"favicon": "./assets/favicon.png"
26+
}
27+
}
28+
}
17.1 KB
Loading

packages/app/assets/favicon.png

1.43 KB
Loading

packages/app/assets/icon.png

21.9 KB
Loading
17.1 KB
Loading

packages/app/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { registerRootComponent } from 'expo';
2+
3+
import App from './App';
4+
5+
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
6+
// It also ensures that whether you load the app in Expo Go or in a native build,
7+
// the environment is set up appropriately
8+
registerRootComponent(App);

packages/app/lib/tokens.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { createTokens } from "jacaranda";
2+
3+
export const { styles } = createTokens({
4+
colors: {
5+
primary50: '#ecfeff',
6+
primary100: '#cffafe',
7+
primary200: '#a5f3fc',
8+
primary300: '#67e8f9',
9+
primary400: '#22d3ee',
10+
primary500: '#06b6d4',
11+
primary600: '#0e93d1',
12+
primary700: '#1570ad',
13+
// Secondary
14+
secondary50: '#ecfdf5',
15+
secondary100: '#d9f9eb',
16+
secondary200: '#bbfde8',
17+
secondary300: '#86f9d9',
18+
secondary400: '#0d9488',
19+
secondary500: '#027a7b',
20+
secondary600: '#016464',
21+
secondary700: '#014747',
22+
},
23+
spacing: {
24+
xs: 4,
25+
sm: 8,
26+
md: 16,
27+
lg: 24,
28+
xl: 32,
29+
xxl: 40,
30+
},
31+
})

0 commit comments

Comments
 (0)