Skip to content

Commit f11f41b

Browse files
committed
chore: update styled-system theme
1 parent b4b65f9 commit f11f41b

File tree

18 files changed

+181
-230
lines changed

18 files changed

+181
-230
lines changed

.DS_Store

0 Bytes
Binary file not shown.

template/src/components/CustomScreen.tsx

Lines changed: 0 additions & 62 deletions
This file was deleted.

template/src/components/CustomText.tsx

Lines changed: 0 additions & 47 deletions
This file was deleted.

template/src/components/molecules/Box/Box.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ import {
1818
position,
1919
PositionProps,
2020
} from 'styled-system';
21+
import { theme } from 'theme';
2122
type VariantTypes = 'primary' | 'secondary';
2223
interface BoxProps
2324
extends LayoutProps,
24-
ColorProps,
25-
SpaceProps,
26-
BordersProps,
25+
ColorProps<typeof theme>,
26+
SpaceProps<typeof theme>,
27+
BordersProps<typeof theme>,
2728
FlexProps,
2829
PositionProps,
2930
FlexboxProps {
@@ -37,10 +38,10 @@ const variantStyle = (theme: DefaultTheme) => {
3738
prop: 'bgVariant',
3839
variants: {
3940
primary: {
40-
backgroundColor: theme.colors.primary,
41+
backgroundColor: 'primary',
4142
},
4243
secondary: {
43-
backgroundColor: theme.colors.secondary,
44+
backgroundColor: 'secondary',
4445
},
4546
},
4647
});

template/src/components/molecules/Box/stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ storiesOf('Box', module)
1212
<Box
1313
bgVariant="secondary"
1414
size={100}
15-
borderRadius={16}
15+
borderRadius="ls"
1616
justifyContent="center"
1717
alignItems="center"
1818
alignSelf="center">
19-
<Box bg="blue" size={50} />
19+
<Box bg={'grayLight'} size={50} />
2020
</Box>
2121
</Box>
2222
);

template/src/components/molecules/Button/Button.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ import {
2424
PaddingProps,
2525
padding,
2626
} from 'styled-system';
27+
import { theme } from 'theme';
2728

2829
type VariantTypes = 'outlined' | 'rounded' | 'box' | 'disabled';
2930

3031
interface ButtonProps
3132
extends LayoutProps,
32-
ColorProps,
33+
ColorProps<typeof theme>,
3334
SpaceProps,
3435
BordersProps,
3536
FlexProps,
3637
PositionProps,
3738
FlexboxProps,
38-
ButtonStyleProps,
39+
ButtonStyleProps<typeof theme>,
3940
PaddingProps {
4041
children?: React.ReactNode;
4142
variant?: VariantTypes;
@@ -51,16 +52,15 @@ const variantStyle = (theme: DefaultTheme, disabled: boolean) => {
5152
height: '100%',
5253
},
5354
outlined: {
54-
borderColor: theme.colors.primary,
55-
borderWidth: theme.spacing.border,
55+
borderColor: 'primary',
56+
borderWidth: 1,
5657
borderStyle: 'solid',
5758
},
5859
rounded: {
59-
borderRadius: theme.spacing.borderRadius,
60+
borderRadius: 8,
6061
},
6162
disabled: {
62-
borderRadius: theme.spacing.borderRadius,
63-
backgroundColor: theme.colors.black,
63+
backgroundColor: 'black',
6464
},
6565
},
6666
});

template/src/components/molecules/Button/stories.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import { storiesOf } from '@storybook/react-native';
33
import Button from './Button';
44
import { Typography } from 'components/molecules/Typography';
5-
import { myTheme } from 'theme';
65

76
storiesOf('Button', module)
87
.add('Button Box', () => (
@@ -14,23 +13,17 @@ storiesOf('Button', module)
1413
))
1514
.add('Button Outlined', () => {
1615
return (
17-
<Button variant="outlined" bg={myTheme.colors.secondary}>
18-
<Typography
19-
variant="regular"
20-
fontSize={16}
21-
color={myTheme.colors.primary}>
16+
<Button variant="outlined" bg={'secondary'}>
17+
<Typography variant="regular" fontSize={16} color={'primary'}>
2218
Button outlined
2319
</Typography>
2420
</Button>
2521
);
2622
})
2723
.add('Button Rounded', () => {
2824
return (
29-
<Button variant="rounded" bg={myTheme.colors.primary}>
30-
<Typography
31-
variant="regular"
32-
fontSize={16}
33-
color={myTheme.colors.secondary}>
25+
<Button variant="rounded" bg={'primary'}>
26+
<Typography variant="regular" fontSize={16} color={'secondary'}>
3427
Button rounded
3528
</Typography>
3629
</Button>
@@ -39,10 +32,7 @@ storiesOf('Button', module)
3932
.add('Button Disable', () => {
4033
return (
4134
<Button variant="disabled" marginX={10} disabled>
42-
<Typography
43-
variant="regular"
44-
fontSize={16}
45-
color={myTheme.colors.secondary}>
35+
<Typography variant="regular" fontSize={16} color={'secondary'}>
4636
Button disabled
4737
</Typography>
4838
</Button>

template/src/components/molecules/Typography/Typography.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ import {
1515
typography,
1616
color,
1717
ColorProps,
18+
FontFamilyProps,
19+
fontFamily,
1820
} from 'styled-system';
19-
import { myTheme } from 'theme';
21+
import { theme } from 'theme';
2022

2123
interface TypographyProps
22-
extends TextStyleProps,
23-
LayoutProps,
24-
SpaceProps,
25-
TextProps,
26-
ColorProps {
24+
extends TextStyleProps<typeof theme>,
25+
LayoutProps<typeof theme>,
26+
SpaceProps<typeof theme>,
27+
TextProps<typeof theme>,
28+
ColorProps<typeof theme> {
2729
variant?: VariantTypes;
30+
fontFamily?: keyof typeof theme.fonts;
2831
}
2932

3033
type VariantTypes = 'regular' | 'bold';
@@ -34,10 +37,10 @@ const variantStyle = (theme: DefaultTheme) => {
3437
prop: 'variant',
3538
variants: {
3639
regular: {
37-
fontFamily: theme.typography.FONT_REGULAR,
40+
fontFamily: 'heading',
3841
},
3942
bold: {
40-
fontFamily: theme.typography.FONT_BOLD,
43+
fontFamily: 'body',
4144
},
4245
},
4346
});
@@ -49,7 +52,7 @@ const Typography = styled(Text)<TypographyProps>`
4952
`;
5053

5154
Typography.defaultProps = {
52-
color: myTheme.colors.primary,
53-
fontFamily: myTheme.typography.FONT_REGULAR,
55+
color: 'secondary',
56+
fontFamily: 'heading',
5457
};
5558
export default Typography;

template/src/components/molecules/Typography/stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ storiesOf('Typography', module)
1212
height={'100%'}
1313
justifyContent="center"
1414
alignItems="center">
15-
<Typography variant="regular" fontSize={40}>
15+
<Typography variant="regular" fontSize="xl">
1616
Typography Regular
1717
</Typography>
1818
</Box>
@@ -28,7 +28,7 @@ storiesOf('Typography', module)
2828
height={'100%'}
2929
justifyContent="center"
3030
alignItems="center">
31-
<Typography variant="bold" fontSize={40}>
31+
<Typography variant="bold" fontSize="xl" fontFamily="body">
3232
Typography Bold
3333
</Typography>
3434
</Box>

template/src/components/organisms/CardPeoples.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Button } from 'components/molecules/Button';
55
import { Typography } from 'components/molecules/Typography';
66
import React, { useEffect } from 'react';
77
import { IPeople } from 'src/interfaces/IPeople';
8-
import { myTheme } from 'theme';
8+
import { theme } from 'theme';
99
interface CardPeopleProps extends IPeople {
1010
onPress: () => void;
1111
}
@@ -20,9 +20,9 @@ const CardPeoples = ({ name, homeworld, onPress }: CardPeopleProps) => {
2020
variant="rounded"
2121
height={80}
2222
onPress={onPress}
23-
bg={myTheme.colors.primary}>
24-
<Typography color={myTheme.colors.white}>{name}</Typography>
25-
<Typography color={myTheme.colors.white}>{homeworld}</Typography>
23+
bg={theme.colors.primary}>
24+
<Typography color={theme.colors.white}>{name}</Typography>
25+
<Typography color={theme.colors.white}>{homeworld}</Typography>
2626
</Button>
2727
</Box>
2828
);

0 commit comments

Comments
 (0)