@hero-design/rn 7.1.3-alpha5 → 7.1.3-alpha8

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 (165) hide show
  1. package/.eslintrc.json +0 -6
  2. package/.expo/packager-info.json +1 -1
  3. package/babel.config.js +0 -14
  4. package/es/index.js +2787 -8941
  5. package/jest-setup.ts +0 -1
  6. package/jest.config.js +2 -4
  7. package/lib/index.js +2822 -8956
  8. package/package.json +5 -7
  9. package/playground/components/BottomNavigation.tsx +14 -11
  10. package/playground/components/Button.tsx +67 -0
  11. package/playground/components/Card.tsx +141 -107
  12. package/playground/components/Tabs.tsx +44 -0
  13. package/playground/index.tsx +13 -7
  14. package/src/components/Badge/StyledBadge.tsx +19 -21
  15. package/src/components/Badge/__tests__/Badge.spec.tsx +9 -18
  16. package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +76 -96
  17. package/src/components/Badge/index.tsx +1 -1
  18. package/src/components/BottomNavigation/StyledBottomNavigation.tsx +44 -42
  19. package/src/components/BottomNavigation/__tests__/__snapshots__/{BottomNavigation.spec.tsx.snap → index.spec.tsx.snap} +130 -96
  20. package/src/components/BottomNavigation/__tests__/{BottomNavigation.spec.tsx → index.spec.tsx} +4 -4
  21. package/src/components/BottomNavigation/index.tsx +28 -32
  22. package/src/components/Button/IconButton.tsx +62 -0
  23. package/src/components/Button/__tests__/__snapshots__/index.spec.tsx.snap +46 -0
  24. package/src/components/Button/__tests__/index.spec.tsx +23 -0
  25. package/src/components/Button/index.tsx +5 -0
  26. package/src/components/Card/StyledCard.tsx +6 -6
  27. package/src/components/Card/__tests__/StyledCard.spec.tsx +2 -7
  28. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +8 -11
  29. package/src/components/Card/__tests__/__snapshots__/{Card.spec.tsx.snap → index.spec.tsx.snap} +2 -8
  30. package/src/components/Card/__tests__/index.spec.tsx +35 -0
  31. package/src/components/Divider/StyledDivider.tsx +18 -60
  32. package/src/components/Divider/__tests__/StyledDivider.spec.tsx +5 -10
  33. package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +106 -70
  34. package/src/components/Divider/index.tsx +1 -1
  35. package/src/components/FAB/ActionGroup/ActionItem.tsx +2 -4
  36. package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +36 -37
  37. package/src/components/FAB/ActionGroup/StyledActionItem.tsx +26 -24
  38. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +271 -245
  39. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +29 -33
  40. package/src/components/FAB/ActionGroup/index.tsx +1 -5
  41. package/src/components/FAB/AnimatedFABIcon.tsx +1 -1
  42. package/src/components/FAB/FAB.tsx +5 -9
  43. package/src/components/FAB/StyledFAB.tsx +22 -0
  44. package/src/components/FAB/__tests__/AnimatedFABIcon.spec.tsx +3 -6
  45. package/src/components/FAB/__tests__/StyledFAB.spec.tsx +24 -0
  46. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +14 -10
  47. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +72 -0
  48. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +16 -17
  49. package/src/components/FAB/__tests__/index.spec.tsx +21 -26
  50. package/src/components/Icon/HeroIcon/index.tsx +5 -7
  51. package/src/components/Icon/__tests__/__snapshots__/{Icon.spec.tsx.snap → index.spec.tsx.snap} +21 -12
  52. package/src/components/Icon/__tests__/index.spec.tsx +25 -0
  53. package/src/components/Icon/index.tsx +1 -1
  54. package/src/components/Tabs/StyledTabs.tsx +70 -0
  55. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +321 -0
  56. package/src/components/Tabs/__tests__/index.spec.tsx +79 -0
  57. package/src/components/Tabs/index.tsx +185 -0
  58. package/src/components/Typography/Text/StyledText.tsx +19 -64
  59. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +90 -63
  60. package/src/emotion.d.ts +6 -0
  61. package/src/index.ts +9 -3
  62. package/src/testHelpers/renderWithTheme.tsx +2 -1
  63. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +70 -48
  64. package/src/theme/components/badge.ts +10 -9
  65. package/src/theme/components/bottomNavigation.ts +7 -3
  66. package/src/theme/components/card.ts +2 -2
  67. package/src/theme/components/divider.ts +6 -6
  68. package/src/theme/components/fab.ts +19 -17
  69. package/src/theme/components/tabs.ts +20 -0
  70. package/src/theme/components/typography.ts +4 -4
  71. package/src/theme/global/borders.ts +8 -2
  72. package/src/theme/global/colors.ts +3 -1
  73. package/src/theme/global/index.ts +31 -17
  74. package/src/theme/global/scale.ts +18 -0
  75. package/src/theme/global/space.ts +23 -13
  76. package/src/theme/global/typography.ts +71 -27
  77. package/src/theme/index.ts +29 -13
  78. package/src/types.ts +7 -0
  79. package/src/utils/__tests__/scale.spec.ts +3 -3
  80. package/testUtils/setup.ts +11 -0
  81. package/tsconfig.json +1 -5
  82. package/types/playground/components/BottomNavigation.d.ts +2 -2
  83. package/types/playground/components/Button.d.ts +2 -0
  84. package/types/playground/components/Tabs.d.ts +2 -0
  85. package/types/src/components/Badge/StyledBadge.d.ts +16 -5
  86. package/types/src/components/Badge/index.d.ts +1 -1
  87. package/types/src/components/BottomNavigation/StyledBottomNavigation.d.ts +44 -9
  88. package/types/src/components/{Typography/Text/__test__ → BottomNavigation/__tests__}/index.spec.d.ts +0 -0
  89. package/types/src/components/BottomNavigation/index.d.ts +19 -14
  90. package/types/src/components/Button/IconButton.d.ts +34 -0
  91. package/types/{theme → src/components/Button}/__tests__/index.spec.d.ts +0 -0
  92. package/types/src/components/Button/index.d.ts +4 -0
  93. package/types/src/components/Card/StyledCard.d.ts +7 -1
  94. package/types/{components/Card/__tests__/Card.spec.d.ts → src/components/Card/__tests__/index.spec.d.ts} +0 -0
  95. package/types/src/components/Divider/StyledDivider.d.ts +8 -2
  96. package/types/src/components/Divider/index.d.ts +1 -1
  97. package/types/src/components/FAB/ActionGroup/StyledActionGroup.d.ts +25 -7
  98. package/types/src/components/FAB/ActionGroup/StyledActionItem.d.ts +11 -2
  99. package/types/src/components/FAB/ActionGroup/index.d.ts +1 -1
  100. package/types/src/components/FAB/FAB.d.ts +4 -4
  101. package/types/src/components/FAB/StyledFAB.d.ts +14 -0
  102. package/types/{components/Card/__tests__/StyledCard.spec.d.ts → src/components/FAB/__tests__/StyledFAB.spec.d.ts} +0 -0
  103. package/types/src/components/Icon/HeroIcon/index.d.ts +8 -2
  104. package/types/{components/Divider/__tests__/StyledDivider.spec.d.ts → src/components/Icon/__tests__/index.spec.d.ts} +0 -0
  105. package/types/src/components/Icon/index.d.ts +1 -1
  106. package/types/src/components/Icon/utils.d.ts +1 -1
  107. package/types/src/components/Tabs/StyledTabs.d.ts +55 -0
  108. package/types/{components/ExampleComponent/__tests__/StyledView.spec.d.ts → src/components/Tabs/__tests__/index.spec.d.ts} +0 -0
  109. package/types/src/components/Tabs/index.d.ts +45 -0
  110. package/types/src/components/Typography/Text/StyledText.d.ts +8 -2
  111. package/types/src/index.d.ts +6 -3
  112. package/types/src/theme/components/badge.d.ts +8 -7
  113. package/types/src/theme/components/bottomNavigation.d.ts +8 -2
  114. package/types/src/theme/components/card.d.ts +2 -2
  115. package/types/src/theme/components/divider.d.ts +6 -6
  116. package/types/src/theme/components/fab.d.ts +19 -17
  117. package/types/src/theme/components/tabs.d.ts +15 -0
  118. package/types/src/theme/components/typography.d.ts +4 -4
  119. package/types/src/theme/global/borders.d.ts +4 -3
  120. package/types/src/theme/global/colors.d.ts +2 -2
  121. package/types/src/theme/global/index.d.ts +10 -45
  122. package/types/src/theme/global/scale.d.ts +8 -0
  123. package/types/src/theme/global/space.d.ts +8 -7
  124. package/types/src/theme/global/typography.d.ts +9 -16
  125. package/types/src/theme/index.d.ts +4 -2
  126. package/types/src/types.d.ts +5 -0
  127. package/lib/assets/fonts/be-vietnam-pro-light.ttf +0 -0
  128. package/lib/assets/fonts/be-vietnam-pro-regular.ttf +0 -0
  129. package/lib/assets/fonts/be-vietnam-pro-semibold.ttf +0 -0
  130. package/src/components/Card/__tests__/Card.spec.tsx +0 -36
  131. package/src/components/FAB/StyledFABContainer.tsx +0 -14
  132. package/src/components/FAB/StyledFABIcon.tsx +0 -9
  133. package/src/components/FAB/__tests__/StyledFABContainer.spec.tsx +0 -18
  134. package/src/components/FAB/__tests__/StyledFABIcon.spec.tsx +0 -16
  135. package/src/components/FAB/__tests__/__snapshots__/StyledFABContainer.spec.tsx.snap +0 -46
  136. package/src/components/FAB/__tests__/__snapshots__/StyledFABIcon.spec.tsx.snap +0 -21
  137. package/src/components/Icon/__tests__/Icon.spec.tsx +0 -36
  138. package/src/styled-components.ts +0 -14
  139. package/src/styled.d.ts +0 -7
  140. package/types/components/Card/StyledCard.d.ts +0 -3
  141. package/types/components/Card/index.d.ts +0 -5
  142. package/types/components/Divider/StyledDivider.d.ts +0 -7
  143. package/types/components/Divider/index.d.ts +0 -12
  144. package/types/components/ExampleComponent/StyledView.d.ts +0 -7
  145. package/types/components/ExampleComponent/index.d.ts +0 -16
  146. package/types/index.d.ts +0 -5
  147. package/types/src/components/BottomNavigation/__tests__/BottomNavigation.spec.d.ts +0 -1
  148. package/types/src/components/Card/__tests__/Card.spec.d.ts +0 -1
  149. package/types/src/components/FAB/StyledFABContainer.d.ts +0 -3
  150. package/types/src/components/FAB/StyledFABIcon.d.ts +0 -3
  151. package/types/src/components/FAB/__tests__/StyledFABContainer.spec.d.ts +0 -1
  152. package/types/src/components/FAB/__tests__/StyledFABIcon.spec.d.ts +0 -1
  153. package/types/src/components/Icon/__tests__/Icon.spec.d.ts +0 -1
  154. package/types/src/components/Typography/Text/__test__/StyledText.spec.d.ts +0 -1
  155. package/types/src/styled-components.d.ts +0 -6
  156. package/types/styled-components.d.ts +0 -6
  157. package/types/theme/components/card.d.ts +0 -10
  158. package/types/theme/components/divider.d.ts +0 -17
  159. package/types/theme/components/exampleComponent.d.ts +0 -14
  160. package/types/theme/global/borders.d.ts +0 -4
  161. package/types/theme/global/colors.d.ts +0 -26
  162. package/types/theme/global/index.d.ts +0 -63
  163. package/types/theme/global/space.d.ts +0 -12
  164. package/types/theme/global/typography.d.ts +0 -21
  165. package/types/theme/index.d.ts +0 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "7.1.3-alpha5",
3
+ "version": "7.1.3-alpha8",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -18,8 +18,9 @@
18
18
  "publish:npm": "yarn publish --access public"
19
19
  },
20
20
  "dependencies": {
21
- "@hero-design/colors": "7.1.2",
22
- "styled-components": "6.0.0-alpha.5"
21
+ "@emotion/native": "^11.9.3",
22
+ "@emotion/react": "^11.9.3",
23
+ "@hero-design/colors": "7.1.2"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "react": "17.0.2",
@@ -32,6 +33,7 @@
32
33
  "@babel/preset-env": "^7.16.11",
33
34
  "@babel/preset-react": "^7.16.7",
34
35
  "@babel/preset-typescript": "^7.17.12",
36
+ "@emotion/jest": "^11.9.3",
35
37
  "@react-navigation/native": "^6.0.10",
36
38
  "@react-navigation/native-stack": "^6.6.2",
37
39
  "@rollup/plugin-babel": "^5.3.1",
@@ -46,11 +48,8 @@
46
48
  "@types/react": "^17.0.39",
47
49
  "@types/react-native": "^0.66.16",
48
50
  "@types/react-native-vector-icons": "^6.4.10",
49
- "@types/styled-components": "^5.1.24",
50
- "@types/styled-components-react-native": "^5.1.3",
51
51
  "@typescript-eslint/eslint-plugin": "^5.12.1",
52
52
  "@typescript-eslint/parser": "^5.12.1",
53
- "babel-plugin-module-resolver": "^4.1.0",
54
53
  "eslint": "^8.9.0",
55
54
  "eslint-config-airbnb": "^19.0.4",
56
55
  "eslint-config-prettier": "^8.5.0",
@@ -60,7 +59,6 @@
60
59
  "eslint-plugin-react-hooks": "^4.3.0",
61
60
  "expo": "^44.0.6",
62
61
  "jest": "^27.3.1",
63
- "jest-styled-components": "^7.0.6",
64
62
  "prettier": "^2.5.1",
65
63
  "react": "17.0.2",
66
64
  "react-native": "0.65.1",
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  import { View } from 'react-native';
3
- import { Tab } from '../../src/components/BottomNavigation';
4
- import { BottomNavigation, Typography } from '../../src/index';
3
+ import {
4
+ BottomNavigation,
5
+ Typography,
6
+ BottomNavigationTabType,
7
+ } from '../../src/index';
5
8
 
6
9
  const HomeScreen = () => (
7
10
  <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
@@ -27,43 +30,43 @@ const ProfileScreen = () => (
27
30
  </View>
28
31
  );
29
32
 
30
- const tabs: Tab<number>[] = [
33
+ const tabs: BottomNavigationTabType[] = [
31
34
  {
32
- key: 0,
35
+ key: 'home',
33
36
  title: 'Home',
34
37
  icon: 'home',
35
38
  component: <HomeScreen />,
36
39
  },
37
40
  {
38
- key: 1,
41
+ key: 'feed',
39
42
  title: 'Feed',
40
43
  icon: 'speaker',
41
44
  component: <FeedScreen />,
42
45
  },
43
46
  {
44
- key: 2,
47
+ key: 'alerts',
45
48
  title: 'Alerts',
46
49
  icon: 'bell',
47
50
  component: <AlertsScreen />,
48
51
  },
49
52
  {
50
- key: 3,
53
+ key: 'profile',
51
54
  title: 'Profile',
52
55
  icon: 'user',
53
56
  component: <ProfileScreen />,
54
57
  },
55
58
  ];
56
59
 
57
- const MyComponent = () => {
58
- const [selectedTabKey, setSelectedTabKey] = React.useState(0);
60
+ const BottomNavigationPlayground = () => {
61
+ const [selectedTabKey, setSelectedTabKey] = React.useState('home');
59
62
 
60
63
  return (
61
64
  <BottomNavigation
62
- onChange={newTabKey => setSelectedTabKey(newTabKey)}
65
+ onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
63
66
  selectedTabKey={selectedTabKey}
64
67
  tabs={tabs}
65
68
  />
66
69
  );
67
70
  };
68
71
 
69
- export default MyComponent;
72
+ export default BottomNavigationPlayground;
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+
4
+ import { Button, Typography, useTheme } from '../../src/index';
5
+
6
+ const ButtonPlayground = (): JSX.Element => {
7
+ const theme = useTheme();
8
+ return (
9
+ <View style={{ padding: theme.space.small }}>
10
+ <Typography.Text style={{ marginBottom: theme.space.xsmall }}>
11
+ Different Intents and Sizes from Icon
12
+ </Typography.Text>
13
+ <View
14
+ style={{
15
+ flexDirection: 'row',
16
+ alignItems: 'center',
17
+ marginBottom: theme.space.large,
18
+ }}
19
+ >
20
+ <Button.Icon
21
+ icon="circle-add-outlined"
22
+ intent="text"
23
+ size="xsmall"
24
+ onPress={() => {}}
25
+ style={{ marginEnd: theme.space.medium }}
26
+ />
27
+ <Button.Icon
28
+ icon="circle-add-outlined"
29
+ intent="primary"
30
+ size="xsmall"
31
+ onPress={() => {}}
32
+ style={{ marginEnd: theme.space.medium }}
33
+ />
34
+ <Button.Icon
35
+ icon="circle-add-outlined"
36
+ intent="success"
37
+ size="small"
38
+ onPress={() => {}}
39
+ style={{ marginEnd: theme.space.medium }}
40
+ />
41
+ <Button.Icon
42
+ icon="circle-add-outlined"
43
+ intent="info"
44
+ size="medium"
45
+ onPress={() => {}}
46
+ style={{ marginEnd: theme.space.medium }}
47
+ />
48
+ <Button.Icon
49
+ icon="circle-add-outlined"
50
+ intent="warning"
51
+ size="large"
52
+ onPress={() => {}}
53
+ style={{ marginEnd: theme.space.medium }}
54
+ />
55
+ <Button.Icon
56
+ icon="circle-add-outlined"
57
+ intent="danger"
58
+ size="xlarge"
59
+ onPress={() => {}}
60
+ style={{ marginEnd: theme.space.medium }}
61
+ />
62
+ </View>
63
+ </View>
64
+ );
65
+ };
66
+
67
+ export default ButtonPlayground;
@@ -7,7 +7,14 @@ import {
7
7
  ScrollView,
8
8
  } from 'react-native';
9
9
  import { palette } from '@hero-design/colors';
10
- import { scale, Card, Typography, Icon, Divider, theme } from '../../src/index';
10
+ import {
11
+ scale,
12
+ Card,
13
+ Typography,
14
+ Icon,
15
+ Divider,
16
+ useTheme,
17
+ } from '../../src/index';
11
18
 
12
19
  type DashboardCardProps = ViewProps & {
13
20
  icon: ComponentProps<typeof Icon>['icon'];
@@ -28,88 +35,107 @@ const PendingItem = ({
28
35
  onPress,
29
36
  wrapperTestID,
30
37
  countTestID,
31
- }: Omit<PendingItemProps, 'isLoading'>) => (
32
- <TouchableOpacity
33
- onPress={onPress}
34
- style={{ flex: 1, padding: theme.space.small }}
35
- testID={wrapperTestID}
36
- >
37
- <Typography.Text
38
- fontSize="xlarge"
39
- fontWeight="semi-bold"
40
- style={{
41
- textAlign: 'center',
42
- paddingBottom: theme.space.small,
43
- color: palette.redLight15,
44
- }}
45
- testID={countTestID}
46
- >
47
- {count}
48
- </Typography.Text>
49
- <Typography.Text style={{ textAlign: 'center', color: palette.greyDark75 }}>
50
- {title}
51
- </Typography.Text>
52
- </TouchableOpacity>
53
- );
38
+ }: Omit<PendingItemProps, 'isLoading'>) => {
39
+ const theme = useTheme();
54
40
 
55
- const ApprovalCard = ({ style }: ViewProps) => (
56
- <Card
57
- style={StyleSheet.flatten([
58
- {
59
- backgroundColor: palette.greyLight90,
60
- paddingTop: 0,
61
- paddingRight: 0,
62
- paddingBottom: 0,
63
- paddingLeft: 0,
64
- },
65
- style,
66
- ])}
67
- >
68
- <View
69
- style={{
70
- backgroundColor: palette.redLight60,
71
- display: 'flex',
72
- flexDirection: 'row',
73
- padding: theme.space.medium,
74
- }}
41
+ return (
42
+ <TouchableOpacity
43
+ onPress={onPress}
44
+ style={{ flex: 1, padding: theme.space.small }}
45
+ testID={wrapperTestID}
75
46
  >
76
- <Icon icon="multiple-users" style={{ marginRight: theme.space.small }} />
77
- <Typography.Text fontWeight="semi-bold" fontSize="large">
78
- Awaiting your approval
47
+ <Typography.Text
48
+ fontSize="xlarge"
49
+ fontWeight="semi-bold"
50
+ style={{
51
+ textAlign: 'center',
52
+ paddingBottom: theme.space.small,
53
+ color: palette.redLight15,
54
+ }}
55
+ testID={countTestID}
56
+ >
57
+ {count}
79
58
  </Typography.Text>
80
- </View>
81
- <View style={{ flex: 1, flexDirection: 'row', padding: theme.space.small }}>
82
- <PendingItem count={1} title="Timesheets" />
83
- <PendingItem count={2} title="Leave Requests" />
84
- <PendingItem count={7} title="Expense Claims" />
85
- </View>
86
- </Card>
87
- );
59
+ <Typography.Text
60
+ style={{ textAlign: 'center', color: palette.greyDark75 }}
61
+ >
62
+ {title}
63
+ </Typography.Text>
64
+ </TouchableOpacity>
65
+ );
66
+ };
67
+
68
+ const ApprovalCard = ({ style }: ViewProps) => {
69
+ const theme = useTheme();
70
+
71
+ return (
72
+ <Card
73
+ style={StyleSheet.flatten([
74
+ {
75
+ backgroundColor: palette.greyLight90,
76
+ paddingTop: 0,
77
+ paddingRight: 0,
78
+ paddingBottom: 0,
79
+ paddingLeft: 0,
80
+ },
81
+ style,
82
+ ])}
83
+ >
84
+ <View
85
+ style={{
86
+ backgroundColor: palette.redLight60,
87
+ display: 'flex',
88
+ flexDirection: 'row',
89
+ padding: theme.space.medium,
90
+ }}
91
+ >
92
+ <Icon
93
+ icon="multiple-users"
94
+ style={{ marginRight: theme.space.small }}
95
+ />
96
+ <Typography.Text fontWeight="semi-bold" fontSize="large">
97
+ Awaiting your approval
98
+ </Typography.Text>
99
+ </View>
100
+ <View
101
+ style={{ flex: 1, flexDirection: 'row', padding: theme.space.small }}
102
+ >
103
+ <PendingItem count={1} title="Timesheets" />
104
+ <PendingItem count={2} title="Leave Requests" />
105
+ <PendingItem count={7} title="Expense Claims" />
106
+ </View>
107
+ </Card>
108
+ );
109
+ };
88
110
 
89
111
  const DashboardCard = ({
90
112
  style,
91
113
  icon,
92
114
  title,
93
115
  subtitle,
94
- }: DashboardCardProps) => (
95
- <Card style={style}>
96
- <View style={{ flex: 1, alignItems: 'flex-end' }}>
97
- <Icon icon={icon} />
98
- </View>
99
- <View
100
- style={{
101
- flex: 1,
102
- justifyContent: 'flex-end',
103
- margin: theme.space.small,
104
- }}
105
- >
106
- <Typography.Text fontSize="xlarge" fontWeight="semi-bold">
107
- {title}
108
- </Typography.Text>
109
- <Typography.Text fontSize="medium">{subtitle}</Typography.Text>
110
- </View>
111
- </Card>
112
- );
116
+ }: DashboardCardProps) => {
117
+ const theme = useTheme();
118
+
119
+ return (
120
+ <Card style={style}>
121
+ <View style={{ flex: 1, alignItems: 'flex-end' }}>
122
+ <Icon icon={icon} />
123
+ </View>
124
+ <View
125
+ style={{
126
+ flex: 1,
127
+ justifyContent: 'flex-end',
128
+ margin: theme.space.small,
129
+ }}
130
+ >
131
+ <Typography.Text fontSize="xlarge" fontWeight="semi-bold">
132
+ {title}
133
+ </Typography.Text>
134
+ <Typography.Text fontSize="medium">{subtitle}</Typography.Text>
135
+ </View>
136
+ </Card>
137
+ );
138
+ };
113
139
 
114
140
  const InductionCard = (props: ViewProps) => (
115
141
  <DashboardCard
@@ -138,7 +164,9 @@ const CertificationsCard = (props: ViewProps) => (
138
164
  );
139
165
 
140
166
  const RostersCard = (props: ViewProps) => {
167
+ const theme = useTheme();
141
168
  const { style, ...otherProps } = props;
169
+
142
170
  return (
143
171
  <Card
144
172
  {...otherProps}
@@ -174,7 +202,9 @@ const RostersCard = (props: ViewProps) => {
174
202
  };
175
203
 
176
204
  const MyLeaveCard = (props: ViewProps) => {
205
+ const theme = useTheme();
177
206
  const { style, ...otherProps } = props;
207
+
178
208
  return (
179
209
  <Card
180
210
  {...otherProps}
@@ -244,39 +274,43 @@ const MyLeaveCard = (props: ViewProps) => {
244
274
  );
245
275
  };
246
276
 
247
- const CardPlayground = () => (
248
- <ScrollView contentContainerStyle={{ padding: theme.space.medium }}>
249
- <View style={{ flexDirection: 'row', height: scale(216) }}>
250
- <View style={{ flex: 1, marginRight: theme.space.medium }}>
251
- <InductionCard
252
- style={{
253
- flex: 1,
254
- backgroundColor: theme.colors.primaryLight,
255
- }}
256
- />
257
- </View>
258
- <View style={{ flex: 1 }}>
259
- <PoliciesCard
260
- style={{
261
- flex: 1,
262
- backgroundColor: theme.colors.infoLight,
263
- marginBottom: theme.space.medium,
264
- }}
265
- testID="policies"
266
- />
267
- <CertificationsCard
268
- style={{
269
- flex: 1,
270
- backgroundColor: theme.colors.infoLight,
271
- }}
272
- testID="certifications"
273
- />
277
+ const CardPlayground = () => {
278
+ const theme = useTheme();
279
+
280
+ return (
281
+ <ScrollView contentContainerStyle={{ padding: theme.space.medium }}>
282
+ <View style={{ flexDirection: 'row', height: scale(216) }}>
283
+ <View style={{ flex: 1, marginRight: theme.space.medium }}>
284
+ <InductionCard
285
+ style={{
286
+ flex: 1,
287
+ backgroundColor: theme.colors.primaryLight,
288
+ }}
289
+ />
290
+ </View>
291
+ <View style={{ flex: 1 }}>
292
+ <PoliciesCard
293
+ style={{
294
+ flex: 1,
295
+ backgroundColor: theme.colors.infoLight,
296
+ marginBottom: theme.space.medium,
297
+ }}
298
+ testID="policies"
299
+ />
300
+ <CertificationsCard
301
+ style={{
302
+ flex: 1,
303
+ backgroundColor: theme.colors.infoLight,
304
+ }}
305
+ testID="certifications"
306
+ />
307
+ </View>
274
308
  </View>
275
- </View>
276
- <RostersCard style={{ marginTop: theme.space.medium }} />
277
- <MyLeaveCard style={{ marginTop: theme.space.medium }} />
278
- <ApprovalCard style={{ marginTop: theme.space.medium }} />
279
- </ScrollView>
280
- );
309
+ <RostersCard style={{ marginTop: theme.space.medium }} />
310
+ <MyLeaveCard style={{ marginTop: theme.space.medium }} />
311
+ <ApprovalCard style={{ marginTop: theme.space.medium }} />
312
+ </ScrollView>
313
+ );
314
+ };
281
315
 
282
316
  export default CardPlayground;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { Tabs, Typography, TabType } from '../../src/index';
4
+
5
+ const WorkScreen = () => (
6
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
7
+ <Typography.Text>Work Screen</Typography.Text>
8
+ </View>
9
+ );
10
+
11
+ const PersonalScreen = () => (
12
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
13
+ <Typography.Text>Personal Screen</Typography.Text>
14
+ </View>
15
+ );
16
+
17
+ const tabs: TabType[] = [
18
+ {
19
+ key: 'work',
20
+ title: 'Work',
21
+ icon: 'suitcase',
22
+ component: <WorkScreen />,
23
+ },
24
+ {
25
+ key: 'personal',
26
+ title: 'Personal',
27
+ icon: 'face-smiley',
28
+ component: <PersonalScreen />,
29
+ },
30
+ ];
31
+
32
+ const TabsPlayground = () => {
33
+ const [selectedTabKey, setSelectedTabKey] = React.useState('work');
34
+
35
+ return (
36
+ <Tabs
37
+ onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
38
+ selectedTabKey={selectedTabKey}
39
+ tabs={tabs}
40
+ />
41
+ );
42
+ };
43
+
44
+ export default TabsPlayground;
@@ -10,11 +10,13 @@ import { SafeAreaView, FlatList } from 'react-native';
10
10
  import { ThemeProvider, theme, useTheme, Typography } from '../src/index';
11
11
  import BadgePlayground from './components/Badge';
12
12
  import BottomNavigation from './components/BottomNavigation';
13
+ import Button from './components/Button';
13
14
  import CardPlayground from './components/Card';
14
15
  import DividerPlayground from './components/Divider';
16
+ import FABPlayground from './components/FAB';
15
17
  import IconPlayground from './components/Icon';
18
+ import TabsPlayground from './components/Tabs';
16
19
  import TypographyPlayground from './components/Typography';
17
- import FABPlayground from './components/FAB';
18
20
 
19
21
  const heroIconFontPath = require('../assets/fonts/hero-icons.ttf');
20
22
  const beVietnamProLightFont = require('../assets/fonts/be-vietnam-pro-light.ttf');
@@ -22,14 +24,16 @@ const beVietnamProRegularFont = require('../assets/fonts/be-vietnam-pro-regular.
22
24
  const beVietnamProSemiBoldFont = require('../assets/fonts/be-vietnam-pro-semibold.ttf');
23
25
 
24
26
  type RootStackParamList = {
25
- Home: undefined;
26
27
  Badge: undefined;
27
28
  BottomNavigation: undefined;
29
+ Button: undefined;
28
30
  Card: undefined;
29
31
  Divider: undefined;
32
+ FAB: undefined;
33
+ Home: undefined;
30
34
  Icon: undefined;
35
+ Tabs: undefined;
31
36
  Typography: undefined;
32
- FAB: undefined;
33
37
  };
34
38
 
35
39
  type Navigation = NativeStackScreenProps<RootStackParamList>;
@@ -39,11 +43,13 @@ const Stack = createNativeStackNavigator<RootStackParamList>();
39
43
  const components = [
40
44
  { name: 'Badge', component: BadgePlayground },
41
45
  { name: 'BottomNavigation', component: BottomNavigation },
46
+ { name: 'Button', component: Button },
42
47
  { name: 'Card', component: CardPlayground },
43
48
  { name: 'Divider', component: DividerPlayground },
49
+ { name: 'FAB', component: FABPlayground },
44
50
  { name: 'Icon', component: IconPlayground },
51
+ { name: 'Tabs', component: TabsPlayground },
45
52
  { name: 'Typography', component: TypographyPlayground },
46
- { name: 'FAB', component: FABPlayground },
47
53
  ] as const;
48
54
 
49
55
  const ComponentItem = ({
@@ -96,9 +102,9 @@ const App = () => {
96
102
 
97
103
  const [fontsLoaded] = useFonts({
98
104
  'hero-icons': heroIconFontPath,
99
- 'Be Vietnam Pro Light': beVietnamProLightFont,
100
- 'Be Vietnam Pro Regular': beVietnamProRegularFont,
101
- 'Be Vietnam Pro SemiBold': beVietnamProSemiBoldFont,
105
+ 'BeVietnamPro-Light': beVietnamProLightFont,
106
+ 'BeVietnamPro-Regular': beVietnamProRegularFont,
107
+ 'BeVietnamPro-SemiBold': beVietnamProSemiBoldFont,
102
108
  });
103
109
 
104
110
  if (!fontsLoaded) {
@@ -1,5 +1,5 @@
1
- import { Text, View } from 'react-native';
2
- import styled, { css } from 'styled-components-native';
1
+ import { View, Text } from 'react-native';
2
+ import styled from '@emotion/native';
3
3
 
4
4
  const BACKGROUND_INTENTS = {
5
5
  success: 'successBackground',
@@ -10,25 +10,23 @@ const BACKGROUND_INTENTS = {
10
10
 
11
11
  type ThemeIntent = 'success' | 'warning' | 'danger' | 'info';
12
12
 
13
- const StyledView = styled(View)<{ themeIntent: ThemeIntent }>`
14
- border-width: ${({ theme }) => theme.__hd__.badge.borderWidths.default};
15
- border-radius: ${({ theme }) => theme.__hd__.badge.radii.default};
16
- padding: ${({ theme }) => theme.__hd__.badge.padding.default};
13
+ const StyledView = styled(View)<{ themeIntent: ThemeIntent }>(
14
+ ({ themeIntent, theme }) => ({
15
+ borderWidth: theme.__hd__.badge.borderWidths.default,
16
+ borderRadius: theme.__hd__.badge.radii.default,
17
+ paddingVertical: theme.__hd__.badge.space.verticalPadding,
18
+ paddingHorizontal: theme.__hd__.badge.space.horizontalPadding,
19
+ borderColor: theme.__hd__.badge.colors[themeIntent],
20
+ backgroundColor: theme.__hd__.badge.colors[BACKGROUND_INTENTS[themeIntent]],
21
+ })
22
+ );
17
23
 
18
- ${({ themeIntent }) => css`
19
- border-color: ${({ theme }) => theme.__hd__.badge.colors[themeIntent]};
20
- background-color: ${({ theme }) =>
21
- theme.__hd__.badge.colors[BACKGROUND_INTENTS[themeIntent]]};
22
- `};
23
- `;
24
-
25
- const StyledText = styled(Text)<{ themeIntent: ThemeIntent }>`
26
- font-family: ${({ theme }) => theme.__hd__.badge.fonts.default};
27
- font-size: ${({ theme }) => theme.__hd__.badge.fontSizes.default};
28
-
29
- ${({ themeIntent }) => css`
30
- color: ${({ theme }) => theme.__hd__.badge.colors[themeIntent]};
31
- `};
32
- `;
24
+ const StyledText = styled(Text)<{ themeIntent: ThemeIntent }>(
25
+ ({ themeIntent, theme }) => ({
26
+ fontFamily: theme.__hd__.badge.font.default,
27
+ fontSize: theme.__hd__.badge.fontSize.default,
28
+ color: theme.__hd__.badge.colors[themeIntent],
29
+ })
30
+ );
33
31
 
34
32
  export { StyledView, StyledText };