1
+ import React , { useState } from 'react' ;
2
+ import { View , Text , StyleSheet } from 'react-native' ;
3
+ import { Calendar , LocaleConfig } from 'react-native-calendars' ;
4
+ import dayjs from 'dayjs' ;
5
+ import 'dayjs/locale/ko' ;
6
+ import { globalStyles } from '../../styles/global' ;
7
+
8
+ const configureLocalization = ( ) => {
9
+ dayjs . locale ( 'ko' ) ;
10
+
11
+ LocaleConfig . locales . ko = {
12
+ monthNames : [ '1μ' , '2μ' , '3μ' , '4μ' , '5μ' , '6μ' , '7μ' , '8μ' , '9μ' , '10μ' , '11μ' , '12μ' ] ,
13
+ monthNamesShort : [ '1μ' , '2μ' , '3μ' , '4μ' , '5μ' , '6μ' , '7μ' , '8μ' , '9μ' , '10μ' , '11μ' , '12μ' ] ,
14
+ dayNames : [ 'μΌμμΌ' , 'μμμΌ' , 'νμμΌ' , 'μμμΌ' , 'λͺ©μμΌ' , 'κΈμμΌ' , 'ν μμΌ' ] ,
15
+ dayNamesShort : [ 'μΌ' , 'μ' , 'ν' , 'μ' , 'λͺ©' , 'κΈ' , 'ν ' ] ,
16
+ today : 'μ€λ' ,
17
+ } ;
18
+
19
+ LocaleConfig . defaultLocale = 'ko' ;
20
+ } ;
21
+
22
+ const ProgressBar = ( { name, level, progress } ) => {
23
+ return (
24
+ < View style = { styles . progressBarContainer } >
25
+ < Text style = { styles . levelText } >
26
+ < Text style = { styles . nameHighlight } > { name } λ</ Text > { ' ' }
27
+ < Text style = { styles . defaultColor } > λ 벨 </ Text >
28
+ < Text style = { styles . levelHighlight } > { level } </ Text >
29
+ </ Text >
30
+
31
+ < View style = { styles . progressBarWrapper } >
32
+ < Text style = { styles . progressLeftText } > 470/1000</ Text >
33
+ < Text style = { styles . progressRightText } > pt</ Text >
34
+ </ View >
35
+ < View style = { styles . progressBar } >
36
+ < View style = { [ styles . progress , { width : `${ progress * 100 } %` } ] } />
37
+ </ View >
38
+ </ View >
39
+ ) ;
40
+ } ;
41
+
42
+ const App = ( ) => {
43
+ configureLocalization ( ) ;
44
+ const [ progress , setProgress ] = useState ( 0.47 ) ;
45
+
46
+ const calendarTheme = {
47
+ todayTextColor : '#FFFFFF' ,
48
+ todayBackgroundColor : '#5772FF' ,
49
+ selectedDayTextColor : '#FFFFFF' ,
50
+ textDayFontSize : 20 ,
51
+ textDayFontWeight : 'bold' ,
52
+ textMonthFontSize : 20 ,
53
+ textMonthFontWeight : 'bold' ,
54
+ textSectionTitleColor : 'rgba(138, 138, 138, 1)' ,
55
+ selectedDayBackgroundColor : '#5772FF' ,
56
+ arrowColor : '#5772FF' ,
57
+ textDayFontFamily : 'Pretendard' ,
58
+ textMonthFontFamily : 'Pretendard' ,
59
+ textDayHeaderFontFamily : 'Pretendard' ,
60
+ textDayHeaderFontWeight : 'bold' ,
61
+ backgroundColor : '#F3F4F6' ,
62
+ calendarBackground : '#F3F4F6' ,
63
+ dayTextColor : '#000000' ,
64
+ } ;
65
+
66
+ const markedDates = {
67
+ '2025-01-24' : {
68
+ selected : true ,
69
+ selectedColor : '#5772FF' ,
70
+ selectedTextColor : '#' ,
71
+ } ,
72
+ '2025-05-15' : { marked : true , dotColor : '#50cebb' } ,
73
+ '2025-05-16' : { marked : true , dotColor : '#50cebb' } ,
74
+ '2025-05-21' : {
75
+ startingDay : true ,
76
+ color : '#50cebb' ,
77
+ textColor : 'white' ,
78
+ } ,
79
+ '2025-05-22' : { color : '#70d7c7' , textColor : 'white' } ,
80
+ '2025-05-23' : {
81
+ color : '#70d7c7' ,
82
+ textColor : 'white' ,
83
+ marked : true ,
84
+ dotColor : 'white' ,
85
+ } ,
86
+ '2025-05-24' : { color : '#70d7c7' , textColor : 'white' } ,
87
+ '2025-05-25' : {
88
+ endingDay : true ,
89
+ color : '#50cebb' ,
90
+ textColor : 'white' ,
91
+ } ,
92
+ } ;
93
+
94
+ return (
95
+ < View style = { [ globalStyles . container ] } >
96
+ < View style = { globalStyles . header } >
97
+ < Text style = { [ globalStyles . subtitle , styles . text ] } >
98
+ μμ΄ νμ΅ μ§νλ νμΈ
99
+ </ Text >
100
+ < Text style = { [ globalStyles . description ] } >
101
+ μμ΄μ νμ΅ κ²°κ³Όλ₯Ό νμΈνλ©° λμμ£ΌμΈμ.
102
+ </ Text >
103
+ </ View >
104
+
105
+ < ProgressBar
106
+ name = "μ ν¬μ±"
107
+ level = { 46 }
108
+ progress = { progress }
109
+ />
110
+
111
+ < View style = { styles . calendarContainer } >
112
+ < Calendar
113
+ style = { styles . calendar }
114
+ theme = { calendarTheme }
115
+ markingType = { 'period' }
116
+ markedDates = { markedDates }
117
+ monthFormat = { 'yyyyλ
MMμ' }
118
+ firstDay = { 0 }
119
+ />
120
+ </ View >
121
+ </ View >
122
+ ) ;
123
+ } ;
124
+
125
+ const styles = StyleSheet . create ( {
126
+ description : {
127
+ color : '#565656' ,
128
+ fontSize : 18 ,
129
+ textAlign : 'center' ,
130
+ fontWeight : '300' ,
131
+ marginBottom : - 10 ,
132
+ marginTop : 30 ,
133
+ fontFamily : 'Pretendard' ,
134
+ } ,
135
+ text : {
136
+ fontFamily : 'Pretendard' ,
137
+ } ,
138
+ progressBarContainer : {
139
+ alignItems : 'center' ,
140
+ marginTop : 50 ,
141
+ } ,
142
+ levelText : {
143
+ fontSize : 24 ,
144
+ fontWeight : '700' ,
145
+ color : '#000000' ,
146
+ marginTop : - 30 ,
147
+ marginBottom : 30 ,
148
+ marginLeft : - 150 ,
149
+ fontFamily : 'Pretendard' ,
150
+ } ,
151
+ nameHighlight : {
152
+ color : '#5772FF' ,
153
+ } ,
154
+ levelHighlight : {
155
+ color : '#5772FF' ,
156
+ } ,
157
+ defaultColor : {
158
+ color : '#000000' ,
159
+ } ,
160
+ progressBarWrapper : {
161
+ width : 320 ,
162
+ flexDirection : 'row' ,
163
+ justifyContent : 'space-between' ,
164
+ marginBottom : 5 ,
165
+ } ,
166
+ progressLeftText : {
167
+ fontSize : 14 ,
168
+ fontWeight : '500' ,
169
+ color : '#8E8E8E' ,
170
+ fontFamily : 'Pretendard' ,
171
+ } ,
172
+ progressRightText : {
173
+ fontSize : 14 ,
174
+ fontWeight : '500' ,
175
+ color : '#8E8E8E' ,
176
+ fontFamily : 'Pretendard' ,
177
+ } ,
178
+ progressBar : {
179
+ width : 320 ,
180
+ height : 10 ,
181
+ backgroundColor : '#E0E0E0' ,
182
+ borderRadius : 5 ,
183
+ overflow : 'hidden' ,
184
+ } ,
185
+ progress : {
186
+ height : '100%' ,
187
+ backgroundColor : '#5772FF' ,
188
+ } ,
189
+ calendarContainer : {
190
+ marginTop : 50 ,
191
+ paddingHorizontal : 20 ,
192
+ } ,
193
+ calendar : {
194
+ borderRadius : 10 ,
195
+ elevation : 4 ,
196
+ backgroundColor : '#F3F4F6' ,
197
+ } ,
198
+ } ) ;
199
+
200
+ export default App ;
0 commit comments