cpk-ui 0.0.3 → 0.0.5
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.
- package/components/uis/Hr/Hr.js +12 -0
- package/components/uis/Hr/Hr.test.tsx +26 -0
- package/components/uis/Hr/Hr.tsx +14 -0
- package/components/uis/Typography/Typography.js +3 -4
- package/components/uis/Typography/Typography.tsx +6 -5
- package/index.js +1 -0
- package/index.tsx +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { isEmptyObject } from '../../../utils/theme';
|
|
3
|
+
export const Hr = styled.View `
|
|
4
|
+
height: 0.5px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
background-color: ${({ theme }) => {
|
|
7
|
+
if (isEmptyObject(theme)) {
|
|
8
|
+
return theme.role.border;
|
|
9
|
+
}
|
|
10
|
+
return theme.role.border;
|
|
11
|
+
}};
|
|
12
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import type {RenderAPI} from '@testing-library/react-native';
|
|
4
|
+
import {render} from '@testing-library/react-native';
|
|
5
|
+
|
|
6
|
+
import {createComponent} from '../../../../test/testUtils';
|
|
7
|
+
import {Hr} from './Hr';
|
|
8
|
+
|
|
9
|
+
let testingLib: RenderAPI;
|
|
10
|
+
|
|
11
|
+
const Component = (): JSX.Element =>
|
|
12
|
+
createComponent(
|
|
13
|
+
<View>
|
|
14
|
+
<Hr />
|
|
15
|
+
</View>,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
describe('[Hr]', () => {
|
|
19
|
+
it('should render without crashing', () => {
|
|
20
|
+
testingLib = render(Component());
|
|
21
|
+
|
|
22
|
+
const json = testingLib.toJSON();
|
|
23
|
+
|
|
24
|
+
expect(json).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import {isEmptyObject} from '../../../utils/theme';
|
|
3
|
+
|
|
4
|
+
export const Hr = styled.View`
|
|
5
|
+
height: 0.5px;
|
|
6
|
+
width: 100%;
|
|
7
|
+
background-color: ${({theme}) => {
|
|
8
|
+
if (isEmptyObject(theme)) {
|
|
9
|
+
return theme.role.border;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return theme.role.border;
|
|
13
|
+
}};
|
|
14
|
+
`;
|
|
@@ -15,11 +15,10 @@ const createBaseText = (colorResolver, fallbackColor) => styled.Text `
|
|
|
15
15
|
return colorResolver(theme);
|
|
16
16
|
}};
|
|
17
17
|
`;
|
|
18
|
-
|
|
19
|
-
const createTextComponent = (BaseText, fontSize, lineHeight) => withTheme(({ style, children, theme, ...props }) => (_jsx(BaseText, { ...props, theme: theme, style: [
|
|
18
|
+
const createTextComponent = (BaseText, fontSize, lineHeight) => withTheme(({ style, children, theme, ...props }) => (_jsx(BaseText, { ...props, style: [
|
|
20
19
|
css `
|
|
21
|
-
font-size: ${fontSize
|
|
22
|
-
line-height: ${lineHeight
|
|
20
|
+
font-size: ${fontSize}px;
|
|
21
|
+
line-height: ${lineHeight}px;
|
|
23
22
|
`,
|
|
24
23
|
{ includeFontPadding: false },
|
|
25
24
|
style,
|
|
@@ -22,8 +22,10 @@ const createBaseText = (
|
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
24
|
// Common Text Component Factory
|
|
25
|
+
type TextComponentType = ReturnType<typeof styled.Text>;
|
|
26
|
+
|
|
25
27
|
const createTextComponent = (
|
|
26
|
-
BaseText:
|
|
28
|
+
BaseText: TextComponentType,
|
|
27
29
|
fontSize: number,
|
|
28
30
|
lineHeight: number,
|
|
29
31
|
) =>
|
|
@@ -40,11 +42,10 @@ const createTextComponent = (
|
|
|
40
42
|
}) => (
|
|
41
43
|
<BaseText
|
|
42
44
|
{...props}
|
|
43
|
-
theme={theme}
|
|
44
45
|
style={[
|
|
45
46
|
css`
|
|
46
|
-
font-size: ${fontSize
|
|
47
|
-
line-height: ${lineHeight
|
|
47
|
+
font-size: ${fontSize}px;
|
|
48
|
+
line-height: ${lineHeight}px;
|
|
48
49
|
`,
|
|
49
50
|
{includeFontPadding: false},
|
|
50
51
|
style,
|
|
@@ -53,7 +54,7 @@ const createTextComponent = (
|
|
|
53
54
|
{children}
|
|
54
55
|
</BaseText>
|
|
55
56
|
),
|
|
56
|
-
);
|
|
57
|
+
) as unknown as TextComponentType;
|
|
57
58
|
|
|
58
59
|
// Standard and Inverted Base Components
|
|
59
60
|
const StandardBaseText = createBaseText((theme) => theme.text.basic, 'gray');
|
package/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './components/uis/Accordion/Accordion';
|
|
|
8
8
|
export * from './components/uis/Button/Button';
|
|
9
9
|
export * from './components/uis/Checkbox/Checkbox';
|
|
10
10
|
export * from './components/uis/EditText/EditText';
|
|
11
|
+
export * from './components/uis/Hr/Hr';
|
|
11
12
|
export * from './components/uis/Icon/Icon';
|
|
12
13
|
export * from './components/uis/IconButton/IconButton';
|
|
13
14
|
export * from './components/uis/LoadingIndicator/LoadingIndicator';
|
package/index.tsx
CHANGED
|
@@ -10,6 +10,7 @@ export * from './components/uis/Accordion/Accordion';
|
|
|
10
10
|
export * from './components/uis/Button/Button';
|
|
11
11
|
export * from './components/uis/Checkbox/Checkbox';
|
|
12
12
|
export * from './components/uis/EditText/EditText';
|
|
13
|
+
export * from './components/uis/Hr/Hr';
|
|
13
14
|
export * from './components/uis/Icon/Icon';
|
|
14
15
|
export * from './components/uis/IconButton/IconButton';
|
|
15
16
|
export * from './components/uis/LoadingIndicator/LoadingIndicator';
|