@pisodev/test-component-library 2.1.4 → 3.0.0
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/dist/components/Typography/H1/H1.web.d.ts +5 -0
- package/dist/components/Typography/H1/index.web.d.ts +2 -0
- package/dist/components/Typography/index.web.d.ts +2 -0
- package/dist/components/Typography/shared/Typography.base.types.d.ts +11 -0
- package/dist/components/index.web.d.ts +1 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.esm.js +53 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +55 -35
- package/dist/index.js.map +1 -1
- package/dist/index.web.d.ts +2 -3
- package/dist/theme/build-colors.d.ts +1 -0
- package/dist/theme/colors.d.ts +2 -2
- package/dist/theme/colors.data.d.ts +28 -0
- package/dist/theme/colors.types.d.ts +14 -38
- package/dist/theme/index.d.ts +3 -5
- package/package.json +7 -6
- package/src/components/Typography/H1/H1.native.tsx +25 -0
- package/src/components/Typography/H1/H1.web.module.scss +10 -0
- package/src/components/Typography/H1/H1.web.tsx +19 -0
- package/src/components/Typography/H1/index.ts +2 -0
- package/src/components/Typography/H1/index.web.ts +2 -0
- package/src/components/Typography/index.ts +2 -0
- package/src/components/Typography/index.web.ts +2 -0
- package/src/components/Typography/shared/Typography.base.types.ts +14 -0
- package/src/components/index.ts +1 -0
- package/src/components/index.web.ts +1 -0
- package/src/index.ts +2 -0
- package/src/index.web.ts +2 -0
- package/src/theme/_colors.scss +41 -0
- package/src/theme/_index.scss +2 -0
- package/src/theme/build-colors.ts +103 -0
- package/src/theme/colors.css +67 -0
- package/src/theme/colors.data.ts +28 -0
- package/src/theme/colors.ts +14 -0
- package/src/theme/colors.types.ts +23 -0
- package/src/theme/index.ts +3 -0
- package/src/types/scss.d.ts +9 -0
- package/components/Anchor/Anchor.native.tsx +0 -44
- package/components/Anchor/Anchor.types.ts +0 -11
- package/components/Anchor/Anchor.web.module.scss +0 -33
- package/components/Anchor/Anchor.web.tsx +0 -35
- package/components/Anchor/README.md +0 -58
- package/components/Anchor/index.ts +0 -2
- package/components/Anchor/index.web.ts +0 -2
- package/components/StatusBar/README.md +0 -56
- package/components/StatusBar/StatusBar.tsx +0 -17
- package/components/StatusBar/StatusBar.types.ts +0 -5
- package/components/StatusBar/index.ts +0 -3
- package/components/StatusBar/index.web.ts +0 -14
- package/components/Tooltip/README.md +0 -45
- package/components/Tooltip/Tooltip.module.scss +0 -44
- package/components/Tooltip/Tooltip.tsx +0 -26
- package/components/Tooltip/Tooltip.types.ts +0 -7
- package/components/Tooltip/index.native.ts +0 -15
- package/components/Tooltip/index.ts +0 -3
- package/components/index.ts +0 -8
- package/components/index.web.ts +0 -8
- package/components/theme/ThemeContext.ts +0 -15
- package/components/theme/ThemeProvider.native.tsx +0 -36
- package/components/theme/ThemeProvider.tsx +0 -6
- package/components/theme/ThemeProvider.web.tsx +0 -67
- package/components/theme/_colors.scss +0 -89
- package/components/theme/colors.ts +0 -81
- package/components/theme/colors.types.ts +0 -48
- package/components/theme/index.ts +0 -5
- package/components/theme/index.web.ts +0 -4
- package/components/theme/useTheme.ts +0 -12
- package/dist/Anchor/Anchor.native.d.ts +0 -3
- package/dist/Anchor/Anchor.native.js +0 -34
- package/dist/Anchor/Anchor.types.d.ts +0 -10
- package/dist/Anchor/Anchor.types.js +0 -2
- package/dist/Anchor/Anchor.web.d.ts +0 -3
- package/dist/Anchor/index.d.ts +0 -2
- package/dist/Anchor/index.web.d.ts +0 -2
- package/dist/StatusBar/StatusBar.d.ts +0 -3
- package/dist/StatusBar/StatusBar.types.d.ts +0 -5
- package/dist/StatusBar/StatusBar.types.js +0 -2
- package/dist/StatusBar/index.d.ts +0 -2
- package/dist/StatusBar/index.web.d.ts +0 -3
- package/dist/Tooltip/Tooltip.d.ts +0 -3
- package/dist/Tooltip/Tooltip.types.d.ts +0 -6
- package/dist/Tooltip/Tooltip.types.js +0 -2
- package/dist/Tooltip/index.d.ts +0 -2
- package/dist/Tooltip/index.native.d.ts +0 -4
- package/dist/Tooltip/index.native.js +0 -12
- package/dist/theme/ThemeContext.d.ts +0 -7
- package/dist/theme/ThemeProvider.d.ts +0 -2
- package/dist/theme/ThemeProvider.native.d.ts +0 -8
- package/dist/theme/ThemeProvider.web.d.ts +0 -7
- package/dist/theme/index.web.d.ts +0 -4
- package/dist/theme/useTheme.d.ts +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as colorScales from './colors.data';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* colors.data.ts에서 읽어서 SCSS와 CSS 파일 자동 생성
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// SCSS 파일 생성
|
|
10
|
+
function generateSCSS(): string {
|
|
11
|
+
let scss = '// 이 파일은 자동 생성됩니다. 직접 수정하지 마세요.\n';
|
|
12
|
+
scss += '// build-colors.ts 스크립트로 생성됨\n\n';
|
|
13
|
+
|
|
14
|
+
// Light 변수
|
|
15
|
+
scss += '// Gray Scale - Light\n';
|
|
16
|
+
Object.entries(colorScales.grayScale.light).forEach(([key, value]) => {
|
|
17
|
+
scss += `$gray-${key}-light: ${value};\n`;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
scss += '\n';
|
|
21
|
+
|
|
22
|
+
// Dark 변수
|
|
23
|
+
scss += '// Gray Scale - Dark\n';
|
|
24
|
+
Object.entries(colorScales.grayScale.dark).forEach(([key, value]) => {
|
|
25
|
+
scss += `$gray-${key}-dark: ${value};\n`;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
scss += '\n';
|
|
29
|
+
|
|
30
|
+
// CSS Variables 참조
|
|
31
|
+
scss += '// Default (CSS Variables 사용 - 테마 자동 전환)\n';
|
|
32
|
+
Object.keys(colorScales.grayScale.light).forEach((key) => {
|
|
33
|
+
scss += `$gray-${key}: var(--gray-${key});\n`;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return scss;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// CSS 파일 생성
|
|
40
|
+
function generateCSS(): string {
|
|
41
|
+
let css = '/* 이 파일은 자동 생성됩니다. 직접 수정하지 마세요. */\n';
|
|
42
|
+
css += '/* build-colors.ts 스크립트로 생성됨 */\n\n';
|
|
43
|
+
|
|
44
|
+
// Root (기본 라이트)
|
|
45
|
+
css += '/* 기본 (라이트 모드) */\n';
|
|
46
|
+
css += ':root {\n';
|
|
47
|
+
css += ' color-scheme: light dark;\n';
|
|
48
|
+
Object.entries(colorScales.grayScale.light).forEach(([key, value]) => {
|
|
49
|
+
css += ` --gray-${key}: ${value};\n`;
|
|
50
|
+
});
|
|
51
|
+
css += '}\n\n';
|
|
52
|
+
|
|
53
|
+
// 다크 모드 자동 감지
|
|
54
|
+
css += '/* 다크 모드 자동 감지 (OS 설정) */\n';
|
|
55
|
+
css += '@media (prefers-color-scheme: dark) {\n';
|
|
56
|
+
css += ' :root:not(.light) {\n';
|
|
57
|
+
Object.entries(colorScales.grayScale.dark).forEach(([key, value]) => {
|
|
58
|
+
css += ` --gray-${key}: ${value};\n`;
|
|
59
|
+
});
|
|
60
|
+
css += ' }\n';
|
|
61
|
+
css += '}\n\n';
|
|
62
|
+
|
|
63
|
+
// 수동 라이트 모드
|
|
64
|
+
css += '/* 수동 라이트 모드 강제 */\n';
|
|
65
|
+
css += '.light {\n';
|
|
66
|
+
css += ' color-scheme: light;\n';
|
|
67
|
+
Object.entries(colorScales.grayScale.light).forEach(([key, value]) => {
|
|
68
|
+
css += ` --gray-${key}: ${value};\n`;
|
|
69
|
+
});
|
|
70
|
+
css += '}\n\n';
|
|
71
|
+
|
|
72
|
+
// 수동 다크 모드
|
|
73
|
+
css += '/* 수동 다크 모드 강제 */\n';
|
|
74
|
+
css += '.dark {\n';
|
|
75
|
+
css += ' color-scheme: dark;\n';
|
|
76
|
+
Object.entries(colorScales.grayScale.dark).forEach(([key, value]) => {
|
|
77
|
+
css += ` --gray-${key}: ${value};\n`;
|
|
78
|
+
});
|
|
79
|
+
css += '}\n';
|
|
80
|
+
|
|
81
|
+
return css;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 파일 저장
|
|
85
|
+
function main() {
|
|
86
|
+
const themeDir = __dirname;
|
|
87
|
+
|
|
88
|
+
// SCSS 파일 생성
|
|
89
|
+
const scssContent = generateSCSS();
|
|
90
|
+
const scssPath = path.join(themeDir, '_colors.scss');
|
|
91
|
+
fs.writeFileSync(scssPath, scssContent, 'utf-8');
|
|
92
|
+
console.log('✅ Generated:', scssPath);
|
|
93
|
+
|
|
94
|
+
// CSS 파일 생성
|
|
95
|
+
const cssContent = generateCSS();
|
|
96
|
+
const cssPath = path.join(themeDir, 'colors.css');
|
|
97
|
+
fs.writeFileSync(cssPath, cssContent, 'utf-8');
|
|
98
|
+
console.log('✅ Generated:', cssPath);
|
|
99
|
+
|
|
100
|
+
console.log('🎉 Color files generated successfully!');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
main();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* 이 파일은 자동 생성됩니다. 직접 수정하지 마세요. */
|
|
2
|
+
/* build-colors.ts 스크립트로 생성됨 */
|
|
3
|
+
|
|
4
|
+
/* 기본 (라이트 모드) */
|
|
5
|
+
:root {
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
--gray-50: #F6F8FA;
|
|
8
|
+
--gray-100: #EEF0F2;
|
|
9
|
+
--gray-200: #E6E8EA;
|
|
10
|
+
--gray-300: #DADCDD;
|
|
11
|
+
--gray-400: #CED0D2;
|
|
12
|
+
--gray-500: #AAACAE;
|
|
13
|
+
--gray-600: #86888A;
|
|
14
|
+
--gray-700: #4C4E50;
|
|
15
|
+
--gray-800: #2C2E30;
|
|
16
|
+
--gray-900: #0C0E10;
|
|
17
|
+
--gray-00: #FFFFFF;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* 다크 모드 자동 감지 (OS 설정) */
|
|
21
|
+
@media (prefers-color-scheme: dark) {
|
|
22
|
+
:root:not(.light) {
|
|
23
|
+
--gray-50: #1A1C1E;
|
|
24
|
+
--gray-100: #282A2C;
|
|
25
|
+
--gray-200: #36383A;
|
|
26
|
+
--gray-300: #444648;
|
|
27
|
+
--gray-400: #525456;
|
|
28
|
+
--gray-500: #66686A;
|
|
29
|
+
--gray-600: #888A8C;
|
|
30
|
+
--gray-700: #AAACAE;
|
|
31
|
+
--gray-800: #CCCED0;
|
|
32
|
+
--gray-900: #FFFFFF;
|
|
33
|
+
--gray-00: #0C0E10;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* 수동 라이트 모드 강제 */
|
|
38
|
+
.light {
|
|
39
|
+
color-scheme: light;
|
|
40
|
+
--gray-50: #F6F8FA;
|
|
41
|
+
--gray-100: #EEF0F2;
|
|
42
|
+
--gray-200: #E6E8EA;
|
|
43
|
+
--gray-300: #DADCDD;
|
|
44
|
+
--gray-400: #CED0D2;
|
|
45
|
+
--gray-500: #AAACAE;
|
|
46
|
+
--gray-600: #86888A;
|
|
47
|
+
--gray-700: #4C4E50;
|
|
48
|
+
--gray-800: #2C2E30;
|
|
49
|
+
--gray-900: #0C0E10;
|
|
50
|
+
--gray-00: #FFFFFF;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* 수동 다크 모드 강제 */
|
|
54
|
+
.dark {
|
|
55
|
+
color-scheme: dark;
|
|
56
|
+
--gray-50: #1A1C1E;
|
|
57
|
+
--gray-100: #282A2C;
|
|
58
|
+
--gray-200: #36383A;
|
|
59
|
+
--gray-300: #444648;
|
|
60
|
+
--gray-400: #525456;
|
|
61
|
+
--gray-500: #66686A;
|
|
62
|
+
--gray-600: #888A8C;
|
|
63
|
+
--gray-700: #AAACAE;
|
|
64
|
+
--gray-800: #CCCED0;
|
|
65
|
+
--gray-900: #FFFFFF;
|
|
66
|
+
--gray-00: #0C0E10;
|
|
67
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const grayScale = {
|
|
2
|
+
light: {
|
|
3
|
+
'00': '#FFFFFF',
|
|
4
|
+
'50': '#F6F8FA',
|
|
5
|
+
'100': '#EEF0F2',
|
|
6
|
+
'200': '#E6E8EA',
|
|
7
|
+
'300': '#DADCDD',
|
|
8
|
+
'400': '#CED0D2',
|
|
9
|
+
'500': '#AAACAE',
|
|
10
|
+
'600': '#86888A',
|
|
11
|
+
'700': '#4C4E50',
|
|
12
|
+
'800': '#2C2E30',
|
|
13
|
+
'900': '#0C0E10',
|
|
14
|
+
},
|
|
15
|
+
dark: {
|
|
16
|
+
'00': '#0C0E10',
|
|
17
|
+
'50': '#1A1C1E',
|
|
18
|
+
'100': '#282A2C',
|
|
19
|
+
'200': '#36383A',
|
|
20
|
+
'300': '#444648',
|
|
21
|
+
'400': '#525456',
|
|
22
|
+
'500': '#66686A',
|
|
23
|
+
'600': '#888A8C',
|
|
24
|
+
'700': '#AAACAE',
|
|
25
|
+
'800': '#CCCED0',
|
|
26
|
+
'900': '#FFFFFF',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Theme } from './colors.types';
|
|
2
|
+
import * as colorScales from './colors.data'
|
|
3
|
+
|
|
4
|
+
export const lightColors: Theme = {
|
|
5
|
+
colors: {
|
|
6
|
+
gray: colorScales.grayScale.light,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const darkColors: Theme = {
|
|
11
|
+
colors: {
|
|
12
|
+
gray: colorScales.grayScale.dark,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// 컬러 스케일 타입 (50, 100, 200 등의 명도)
|
|
2
|
+
export interface ColorScale {
|
|
3
|
+
'00': string;
|
|
4
|
+
'50': string;
|
|
5
|
+
'100': string;
|
|
6
|
+
'200': string;
|
|
7
|
+
'300': string;
|
|
8
|
+
'400': string;
|
|
9
|
+
'500': string;
|
|
10
|
+
'600': string;
|
|
11
|
+
'700': string;
|
|
12
|
+
'800': string;
|
|
13
|
+
'900': string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Theme {
|
|
17
|
+
colors: {
|
|
18
|
+
gray: ColorScale;
|
|
19
|
+
// green: Partial<ColorScale>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ThemeMode = 'light' | 'dark';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, Pressable, Linking, StyleSheet } from 'react-native';
|
|
3
|
-
import { AnchorProps } from './Anchor.types';
|
|
4
|
-
|
|
5
|
-
export const Anchor: React.FC<AnchorProps> = ({
|
|
6
|
-
children,
|
|
7
|
-
href,
|
|
8
|
-
title,
|
|
9
|
-
onPress,
|
|
10
|
-
}) => {
|
|
11
|
-
const handlePress = () => {
|
|
12
|
-
if (onPress) {
|
|
13
|
-
onPress();
|
|
14
|
-
} else if (href) {
|
|
15
|
-
Linking.openURL(href);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Pressable
|
|
21
|
-
onPress={handlePress}
|
|
22
|
-
accessibilityRole="link"
|
|
23
|
-
accessibilityLabel={title}
|
|
24
|
-
accessibilityHint={`Opens ${href}`}
|
|
25
|
-
>
|
|
26
|
-
{({ pressed }: any) => (
|
|
27
|
-
<Text style={[styles.anchor, pressed && styles.anchorPressed]}>
|
|
28
|
-
{children}
|
|
29
|
-
</Text>
|
|
30
|
-
)}
|
|
31
|
-
</Pressable>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
anchor: {
|
|
37
|
-
color: '#2196f3',
|
|
38
|
-
textDecorationLine: 'none',
|
|
39
|
-
},
|
|
40
|
-
anchorPressed: {
|
|
41
|
-
color: '#1976d2',
|
|
42
|
-
textDecorationLine: 'underline',
|
|
43
|
-
},
|
|
44
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
$transition: all 0.2s ease;
|
|
2
|
-
|
|
3
|
-
// CSS Variables fallback
|
|
4
|
-
$primary-color: var(--color-primary-600, #2196f3);
|
|
5
|
-
$primary-hover: var(--color-primary-700, #1976d2);
|
|
6
|
-
$primary-visited: var(--color-primary-800, #1565c0);
|
|
7
|
-
$primary-active: var(--color-primary-900, #0d47a1);
|
|
8
|
-
|
|
9
|
-
.anchor {
|
|
10
|
-
color: $primary-color;
|
|
11
|
-
text-decoration: none;
|
|
12
|
-
transition: $transition;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
position: relative;
|
|
15
|
-
|
|
16
|
-
&:hover {
|
|
17
|
-
color: $primary-hover;
|
|
18
|
-
text-decoration: underline;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&:focus {
|
|
22
|
-
outline: 2px solid $primary-color;
|
|
23
|
-
outline-offset: 2px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:visited {
|
|
27
|
-
color: $primary-visited;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&:active {
|
|
31
|
-
color: $primary-active;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AnchorProps } from './Anchor.types';
|
|
3
|
-
import styles from './Anchor.web.module.scss';
|
|
4
|
-
|
|
5
|
-
export const Anchor: React.FC<AnchorProps> = ({
|
|
6
|
-
children,
|
|
7
|
-
href,
|
|
8
|
-
rel,
|
|
9
|
-
title,
|
|
10
|
-
target = '_self',
|
|
11
|
-
className = '',
|
|
12
|
-
onPress,
|
|
13
|
-
}) => {
|
|
14
|
-
const anchorClasses = [styles.anchor, className].filter(Boolean).join(' ');
|
|
15
|
-
|
|
16
|
-
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
17
|
-
if (onPress) {
|
|
18
|
-
e.preventDefault();
|
|
19
|
-
onPress();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<a
|
|
25
|
-
href={href}
|
|
26
|
-
rel={rel}
|
|
27
|
-
title={title}
|
|
28
|
-
target={target}
|
|
29
|
-
className={anchorClasses}
|
|
30
|
-
onClick={handleClick}
|
|
31
|
-
>
|
|
32
|
-
{children}
|
|
33
|
-
</a>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Anchor
|
|
2
|
-
|
|
3
|
-
링크 컴포넌트 - 웹과 React Native 모두 지원
|
|
4
|
-
|
|
5
|
-
## Props
|
|
6
|
-
|
|
7
|
-
| Prop | Type | Required | Platform | Description |
|
|
8
|
-
|------|------|----------|----------|-------------|
|
|
9
|
-
| children | ReactNode | ✓ | All | 링크 텍스트 |
|
|
10
|
-
| href | string | ✓ | All | URL |
|
|
11
|
-
| rel | string | - | Web only | rel 속성 |
|
|
12
|
-
| title | string | - | All | title 속성 / 접근성 레이블 |
|
|
13
|
-
| target | '_blank' \| '_self' \| '_parent' \| '_top' | - | Web only | target 속성 |
|
|
14
|
-
| className | string | - | Web only | CSS 클래스 |
|
|
15
|
-
| onPress | () => void | - | All | 클릭 핸들러 |
|
|
16
|
-
|
|
17
|
-
## 웹 사용법
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
import { Anchor } from '@pisodev/test-component-library';
|
|
21
|
-
|
|
22
|
-
<Anchor
|
|
23
|
-
href="https://example.com"
|
|
24
|
-
title="Example"
|
|
25
|
-
rel="noopener"
|
|
26
|
-
target="_blank"
|
|
27
|
-
>
|
|
28
|
-
Click me
|
|
29
|
-
</Anchor>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## React Native 사용법
|
|
33
|
-
|
|
34
|
-
```tsx
|
|
35
|
-
import { Anchor } from '@pisodev/test-component-library';
|
|
36
|
-
|
|
37
|
-
<Anchor
|
|
38
|
-
href="https://example.com"
|
|
39
|
-
title="Example"
|
|
40
|
-
>
|
|
41
|
-
Click me
|
|
42
|
-
</Anchor>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## 구현 차이점
|
|
46
|
-
|
|
47
|
-
### 웹 (Anchor.web.tsx)
|
|
48
|
-
- `<a>` 태그 사용
|
|
49
|
-
- SCSS 모듈 스타일링
|
|
50
|
-
- :hover, :focus, :visited, :active 가상 선택자
|
|
51
|
-
- target, rel 속성 지원
|
|
52
|
-
|
|
53
|
-
### React Native (Anchor.native.tsx)
|
|
54
|
-
- Pressable + Text 컴포넌트 사용
|
|
55
|
-
- StyleSheet 기반 스타일링
|
|
56
|
-
- Pressed 상태로 hover 효과 구현
|
|
57
|
-
- Linking API로 URL 열기
|
|
58
|
-
- 접근성 속성 자동 적용
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# StatusBar
|
|
2
|
-
|
|
3
|
-
**플랫폼**: React Native 전용
|
|
4
|
-
|
|
5
|
-
모바일 상단 상태바(시간, 배터리 등)의 스타일을 제어하는 컴포넌트입니다.
|
|
6
|
-
|
|
7
|
-
## 플랫폼 지원
|
|
8
|
-
|
|
9
|
-
- ⚠️ **Web**: 지원 안 함 (null 반환)
|
|
10
|
-
- ✅ **React Native**: 완전 지원
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
|
|
14
|
-
| Prop | Type | Required | Description |
|
|
15
|
-
|------|------|----------|-------------|
|
|
16
|
-
| barStyle | 'default' \| 'light-content' \| 'dark-content' | - | 상태바 텍스트 색상 |
|
|
17
|
-
| backgroundColor | string | - | 상태바 배경색 (Android) |
|
|
18
|
-
| hidden | boolean | - | 상태바 숨김 여부 |
|
|
19
|
-
|
|
20
|
-
## React Native 사용법
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { StatusBar } from '@pisodev/test-component-library';
|
|
24
|
-
|
|
25
|
-
function App() {
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<StatusBar
|
|
29
|
-
barStyle="dark-content"
|
|
30
|
-
backgroundColor="#ffffff"
|
|
31
|
-
/>
|
|
32
|
-
{/* 나머지 앱 내용 */}
|
|
33
|
-
</>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## 웹 대안
|
|
39
|
-
|
|
40
|
-
웹에서는 HTML meta 태그로 브라우저 테마 색상을 제어할 수 있습니다:
|
|
41
|
-
|
|
42
|
-
```html
|
|
43
|
-
<!-- public/index.html -->
|
|
44
|
-
<meta name="theme-color" content="#ffffff">
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
또는 JavaScript로 동적 제어:
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
const metaThemeColor = document.querySelector('meta[name="theme-color"]');
|
|
52
|
-
if (metaThemeColor) {
|
|
53
|
-
metaThemeColor.setAttribute('content', '#ffffff');
|
|
54
|
-
}
|
|
55
|
-
}, []);
|
|
56
|
-
```
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StatusBar as RNStatusBar } from 'react-native';
|
|
3
|
-
import { StatusBarProps } from './StatusBar.types';
|
|
4
|
-
|
|
5
|
-
export const StatusBar: React.FC<StatusBarProps> = ({
|
|
6
|
-
barStyle = 'default',
|
|
7
|
-
backgroundColor,
|
|
8
|
-
hidden = false,
|
|
9
|
-
}) => {
|
|
10
|
-
return (
|
|
11
|
-
<RNStatusBar
|
|
12
|
-
barStyle={barStyle}
|
|
13
|
-
backgroundColor={backgroundColor}
|
|
14
|
-
hidden={hidden}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StatusBarProps } from './StatusBar.types';
|
|
2
|
-
|
|
3
|
-
// 웹에서는 StatusBar 개념이 없음
|
|
4
|
-
export const StatusBar = (_props: StatusBarProps) => {
|
|
5
|
-
if (process.env.NODE_ENV === 'development') {
|
|
6
|
-
console.warn(
|
|
7
|
-
'StatusBar is only available on React Native. ' +
|
|
8
|
-
'For web, you can use <meta name="theme-color"> in your HTML.'
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type { StatusBarProps };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# Tooltip
|
|
2
|
-
|
|
3
|
-
**플랫폼**: 웹 전용
|
|
4
|
-
|
|
5
|
-
마우스 호버 시 툴팁을 표시하는 컴포넌트입니다.
|
|
6
|
-
|
|
7
|
-
## 플랫폼 지원
|
|
8
|
-
|
|
9
|
-
- ✅ **Web**: 완전 지원
|
|
10
|
-
- ⚠️ **React Native**: children만 렌더링 (툴팁 미표시)
|
|
11
|
-
|
|
12
|
-
## Props
|
|
13
|
-
|
|
14
|
-
| Prop | Type | Required | Description |
|
|
15
|
-
|------|------|----------|-------------|
|
|
16
|
-
| children | ReactNode | ✓ | 툴팁을 표시할 요소 |
|
|
17
|
-
| content | string | ✓ | 툴팁 내용 |
|
|
18
|
-
| position | 'top' \| 'bottom' \| 'left' \| 'right' | - | 툴팁 위치 (기본: 'top') |
|
|
19
|
-
|
|
20
|
-
## 웹 사용법
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { Tooltip } from '@pisodev/test-component-library';
|
|
24
|
-
|
|
25
|
-
<Tooltip content="This is a tooltip" position="top">
|
|
26
|
-
<button>Hover me</button>
|
|
27
|
-
</Tooltip>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## React Native 대안
|
|
31
|
-
|
|
32
|
-
React Native에서는 모바일에 hover 개념이 없으므로:
|
|
33
|
-
|
|
34
|
-
1. **react-native-tooltip** 사용
|
|
35
|
-
2. **Modal + Pressable** 조합
|
|
36
|
-
3. **Long press** 제스처로 툴팁 표시
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
// RN 대안 예시
|
|
40
|
-
import { Tooltip } from 'react-native-elements';
|
|
41
|
-
|
|
42
|
-
<Tooltip popover={<Text>Info here</Text>}>
|
|
43
|
-
<Text>Press me</Text>
|
|
44
|
-
</Tooltip>
|
|
45
|
-
```
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
.tooltipWrapper {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.tooltip {
|
|
7
|
-
position: absolute;
|
|
8
|
-
background-color: rgba(0, 0, 0, 0.8);
|
|
9
|
-
color: white;
|
|
10
|
-
padding: 8px 12px;
|
|
11
|
-
border-radius: 4px;
|
|
12
|
-
font-size: 14px;
|
|
13
|
-
white-space: nowrap;
|
|
14
|
-
z-index: 1000;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
|
|
17
|
-
&.top {
|
|
18
|
-
bottom: 100%;
|
|
19
|
-
left: 50%;
|
|
20
|
-
transform: translateX(-50%);
|
|
21
|
-
margin-bottom: 8px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&.bottom {
|
|
25
|
-
top: 100%;
|
|
26
|
-
left: 50%;
|
|
27
|
-
transform: translateX(-50%);
|
|
28
|
-
margin-top: 8px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&.left {
|
|
32
|
-
right: 100%;
|
|
33
|
-
top: 50%;
|
|
34
|
-
transform: translateY(-50%);
|
|
35
|
-
margin-right: 8px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&.right {
|
|
39
|
-
left: 100%;
|
|
40
|
-
top: 50%;
|
|
41
|
-
transform: translateY(-50%);
|
|
42
|
-
margin-left: 8px;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { TooltipProps } from './Tooltip.types';
|
|
3
|
-
import styles from './Tooltip.module.scss';
|
|
4
|
-
|
|
5
|
-
export const Tooltip: React.FC<TooltipProps> = ({
|
|
6
|
-
children,
|
|
7
|
-
content,
|
|
8
|
-
position = 'top',
|
|
9
|
-
}) => {
|
|
10
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div
|
|
14
|
-
className={styles.tooltipWrapper}
|
|
15
|
-
onMouseEnter={() => setIsVisible(true)}
|
|
16
|
-
onMouseLeave={() => setIsVisible(false)}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
{isVisible && (
|
|
20
|
-
<div className={`${styles.tooltip} ${styles[position]}`}>
|
|
21
|
-
{content}
|
|
22
|
-
</div>
|
|
23
|
-
)}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|