Skip to content

Commit 3a500e7

Browse files
committed
chore(docs): updated example of usage
1 parent 0cbf803 commit 3a500e7

File tree

4 files changed

+27
-29
lines changed

4 files changed

+27
-29
lines changed

packages/app-typescript/App.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1+
import { View } from 'react-native';
12
import { StatusBar } from 'expo-status-bar';
2-
import { StyleSheet, View } from 'react-native';
3+
import { styled } from './jacaranda.config';
34
import { Typography } from './components/Typography';
45
import { Button } from './components/Button';
56

7+
const StyledView = styled(View)({
8+
flex: 1,
9+
backgroundColor: '$colors.white',
10+
alignItems: 'center',
11+
justifyContent: 'center',
12+
gap: '$space.3',
13+
});
14+
615
export default function App() {
716
return (
8-
<View style={sty.container}>
17+
<StyledView>
918
<StatusBar style="auto" />
1019
<Button color="secondary">
1120
<Typography color="white">Hello</Typography>
1221
</Button>
1322
<Button color="primary">
1423
<Typography color="black">Hello</Typography>
1524
</Button>
16-
</View>
25+
</StyledView>
1726
);
1827
}
19-
20-
const sty = StyleSheet.create({
21-
container: {
22-
flex: 1,
23-
backgroundColor: '#fff',
24-
alignItems: 'center',
25-
justifyContent: 'center',
26-
gap: 12,
27-
},
28-
});

packages/app-typescript/components/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { TouchableOpacity } from 'react-native';
1+
import { TouchableOpacity, View } from 'react-native';
22
import { type VariantProps } from 'jacaranda';
33
import { Typography } from './Typography';
4-
import { sva } from '../jacaranda.config';
4+
import { sva, styled } from '../jacaranda.config';
55

66
type ButtonProps = VariantProps<typeof buttonStyles> & {
77
children?: React.ReactNode;

packages/app-typescript/jacaranda.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineTokens } from 'jacaranda';
22

3-
export const { sva, tokens } = defineTokens({
3+
export const { sva, tokens, styled } = defineTokens({
44
colors: {
55
white: '#ffffff',
66
black: '#000000',

packages/app/App.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
2-
import { sva } from './jacaranda.config';
1+
import { Text, TouchableOpacity, View } from 'react-native';
2+
import { sva, styled } from './jacaranda.config';
33

44
export const Button = (props) => {
55
return (
@@ -33,19 +33,18 @@ const buttonStyles = sva({
3333
},
3434
});
3535

36+
const StyledView = styled(View)({
37+
flex: 1,
38+
backgroundColor: '$colors.white',
39+
alignItems: 'center',
40+
justifyContent: 'center',
41+
gap: '$space.3',
42+
});
43+
3644
export default function App() {
3745
return (
38-
<View style={sty.container}>
46+
<StyledView>
3947
<Button intent="primary" />
40-
</View>
48+
</StyledView>
4149
);
4250
}
43-
44-
const sty = StyleSheet.create({
45-
container: {
46-
flex: 1,
47-
backgroundColor: '#fff',
48-
alignItems: 'center',
49-
justifyContent: 'center',
50-
},
51-
});

0 commit comments

Comments
 (0)