Skip to content

Commit c72eae2

Browse files
committed
docs: improved examples with new approach
1 parent 9478d0d commit c72eae2

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

packages/app-typescript/components/Button.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TouchableOpacity } from 'react-native';
22
import { type VariantProps } from 'jacaranda';
33
import { Typography } from './Typography';
4-
import { styles } from '../jacaranda.config';
4+
import { sva } from '../jacaranda.config';
55

66
type ButtonProps = VariantProps<typeof buttonStyles> & {
77
children?: React.ReactNode;
@@ -15,11 +15,11 @@ export const Button = (props: ButtonProps) => {
1515
);
1616
};
1717

18-
const buttonStyles = styles({
18+
const buttonStyles = sva({
1919
base: {
20-
paddingHorizontal: '$spacing.8',
21-
paddingVertical: '$spacing.3',
22-
borderRadius: '$spacing.2',
20+
paddingHorizontal: '$space.8',
21+
paddingVertical: '$space.3',
22+
borderRadius: '$space.2',
2323
},
2424
variants: {
2525
color: {

packages/app-typescript/components/Typography.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Text } from 'react-native';
22
import { VariantProps } from 'jacaranda';
3-
import { styles } from '../jacaranda.config';
3+
import { sva } from '../jacaranda.config';
44

55
type TypographyProps = VariantProps<typeof typographyStyles> & {
66
children?: React.ReactNode;
@@ -10,7 +10,7 @@ export const Typography = (props: TypographyProps) => {
1010
return <Text style={typographyStyles(props)}>{props.children}</Text>;
1111
};
1212

13-
const typographyStyles = styles({
13+
const typographyStyles = sva({
1414
base: {},
1515
variants: {
1616
color: {

packages/app-typescript/jacaranda.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createTokens } from 'jacaranda';
1+
import { defineTokens } from 'jacaranda';
22

3-
export const { styles } = createTokens({
3+
export const { sva, tokens } = defineTokens({
44
colors: {
55
white: '#ffffff',
66
black: '#000000',
@@ -22,7 +22,7 @@ export const { styles } = createTokens({
2222
secondary600: '#016464',
2323
secondary700: '#014747',
2424
},
25-
spacing: {
25+
space: {
2626
1: 4,
2727
2: 8,
2828
3: 12,

packages/app/App.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
2-
import { styles } from './jacaranda.config';
2+
import { sva } from './jacaranda.config';
33

44
export const Button = (props) => {
55
return (
@@ -9,8 +9,8 @@ export const Button = (props) => {
99
);
1010
};
1111

12-
const buttonStyles = styles({
13-
base: { borderRadius: '$spacing.md' },
12+
const buttonStyles = sva({
13+
base: { borderRadius: '$space.md' },
1414
variants: {
1515
intent: {
1616
primary: {
@@ -22,8 +22,8 @@ const buttonStyles = styles({
2222
},
2323
size: {
2424
md: {
25-
paddingHorizontal: '$spacing.md',
26-
paddingVertical: '$spacing.sm',
25+
paddingHorizontal: '$space.md',
26+
paddingVertical: '$space.sm',
2727
},
2828
},
2929
},

packages/app/jacaranda.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const { styles } = defineTokens({
2020
secondary600: '#016464',
2121
secondary700: '#014747',
2222
},
23-
spacing: {
23+
space: {
2424
xs: 4,
2525
sm: 8,
2626
md: 16,

0 commit comments

Comments
 (0)