react-native-nepali-picker 0.1.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.
Files changed (86) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +31 -0
  3. package/lib/commonjs/CalendarPicker.js +368 -0
  4. package/lib/commonjs/CalendarPicker.js.map +1 -0
  5. package/lib/commonjs/assets/DateSync.js +105 -0
  6. package/lib/commonjs/assets/DateSync.js.map +1 -0
  7. package/lib/commonjs/assets/Icons.js +182 -0
  8. package/lib/commonjs/assets/Icons.js.map +1 -0
  9. package/lib/commonjs/assets/Triangle.js +37 -0
  10. package/lib/commonjs/assets/Triangle.js.map +1 -0
  11. package/lib/commonjs/assets/cIcon.js +76 -0
  12. package/lib/commonjs/assets/cIcon.js.map +1 -0
  13. package/lib/commonjs/calendar/config.js +125 -0
  14. package/lib/commonjs/calendar/config.js.map +1 -0
  15. package/lib/commonjs/calendar/functions.js +114 -0
  16. package/lib/commonjs/calendar/functions.js.map +1 -0
  17. package/lib/commonjs/calendar/settings.js +40 -0
  18. package/lib/commonjs/calendar/settings.js.map +1 -0
  19. package/lib/commonjs/index.js +33 -0
  20. package/lib/commonjs/index.js.map +1 -0
  21. package/lib/module/CalendarPicker.js +363 -0
  22. package/lib/module/CalendarPicker.js.map +1 -0
  23. package/lib/module/assets/DateSync.js +101 -0
  24. package/lib/module/assets/DateSync.js.map +1 -0
  25. package/lib/module/assets/Icons.js +175 -0
  26. package/lib/module/assets/Icons.js.map +1 -0
  27. package/lib/module/assets/Triangle.js +33 -0
  28. package/lib/module/assets/Triangle.js.map +1 -0
  29. package/lib/module/assets/cIcon.js +72 -0
  30. package/lib/module/assets/cIcon.js.map +1 -0
  31. package/lib/module/calendar/config.js +121 -0
  32. package/lib/module/calendar/config.js.map +1 -0
  33. package/lib/module/calendar/functions.js +106 -0
  34. package/lib/module/calendar/functions.js.map +1 -0
  35. package/lib/module/calendar/settings.js +35 -0
  36. package/lib/module/calendar/settings.js.map +1 -0
  37. package/lib/module/index.js +6 -0
  38. package/lib/module/index.js.map +1 -0
  39. package/lib/typescript/commonjs/package.json +1 -0
  40. package/lib/typescript/commonjs/src/CalendarPicker.d.ts +13 -0
  41. package/lib/typescript/commonjs/src/CalendarPicker.d.ts.map +1 -0
  42. package/lib/typescript/commonjs/src/assets/DateSync.d.ts +7 -0
  43. package/lib/typescript/commonjs/src/assets/DateSync.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/src/assets/Icons.d.ts +20 -0
  45. package/lib/typescript/commonjs/src/assets/Icons.d.ts.map +1 -0
  46. package/lib/typescript/commonjs/src/assets/Triangle.d.ts +7 -0
  47. package/lib/typescript/commonjs/src/assets/Triangle.d.ts.map +1 -0
  48. package/lib/typescript/commonjs/src/assets/cIcon.d.ts +6 -0
  49. package/lib/typescript/commonjs/src/assets/cIcon.d.ts.map +1 -0
  50. package/lib/typescript/commonjs/src/calendar/config.d.ts +9 -0
  51. package/lib/typescript/commonjs/src/calendar/config.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/src/calendar/functions.d.ts +7 -0
  53. package/lib/typescript/commonjs/src/calendar/functions.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/calendar/settings.d.ts +4 -0
  55. package/lib/typescript/commonjs/src/calendar/settings.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/index.d.ts +4 -0
  57. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  58. package/lib/typescript/module/package.json +1 -0
  59. package/lib/typescript/module/src/CalendarPicker.d.ts +13 -0
  60. package/lib/typescript/module/src/CalendarPicker.d.ts.map +1 -0
  61. package/lib/typescript/module/src/assets/DateSync.d.ts +7 -0
  62. package/lib/typescript/module/src/assets/DateSync.d.ts.map +1 -0
  63. package/lib/typescript/module/src/assets/Icons.d.ts +20 -0
  64. package/lib/typescript/module/src/assets/Icons.d.ts.map +1 -0
  65. package/lib/typescript/module/src/assets/Triangle.d.ts +7 -0
  66. package/lib/typescript/module/src/assets/Triangle.d.ts.map +1 -0
  67. package/lib/typescript/module/src/assets/cIcon.d.ts +6 -0
  68. package/lib/typescript/module/src/assets/cIcon.d.ts.map +1 -0
  69. package/lib/typescript/module/src/calendar/config.d.ts +9 -0
  70. package/lib/typescript/module/src/calendar/config.d.ts.map +1 -0
  71. package/lib/typescript/module/src/calendar/functions.d.ts +7 -0
  72. package/lib/typescript/module/src/calendar/functions.d.ts.map +1 -0
  73. package/lib/typescript/module/src/calendar/settings.d.ts +4 -0
  74. package/lib/typescript/module/src/calendar/settings.d.ts.map +1 -0
  75. package/lib/typescript/module/src/index.d.ts +4 -0
  76. package/lib/typescript/module/src/index.d.ts.map +1 -0
  77. package/package.json +949 -0
  78. package/src/CalendarPicker.tsx +460 -0
  79. package/src/assets/DateSync.tsx +84 -0
  80. package/src/assets/Icons.tsx +143 -0
  81. package/src/assets/Triangle.tsx +31 -0
  82. package/src/assets/cIcon.tsx +74 -0
  83. package/src/calendar/config.ts +263 -0
  84. package/src/calendar/functions.ts +126 -0
  85. package/src/calendar/settings.ts +45 -0
  86. package/src/index.tsx +4 -0
@@ -0,0 +1,460 @@
1
+ import { useEffect, useState, type ReactNode } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ Modal,
6
+ Pressable,
7
+ StyleSheet,
8
+ TouchableOpacity,
9
+ ScrollView,
10
+ } from 'react-native';
11
+ import {
12
+ bs,
13
+ daysInEnglish,
14
+ daysInNepali,
15
+ getNepaliNumber,
16
+ monthsInEnglish,
17
+ monthsInNepali,
18
+ } from './calendar/config';
19
+ import { calcFirstDay, isToday } from './calendar/settings';
20
+ import { NepaliToday } from './calendar/functions';
21
+ import { ChevronIcon } from './assets/Icons';
22
+ import DateSyncLogo from './assets/DateSync';
23
+ import Triangle from './assets/Triangle';
24
+
25
+ interface CalendarPickerPoros {
26
+ visible: boolean;
27
+ children?: ReactNode;
28
+ onClose: () => void;
29
+ theme?: 'dark' | 'light';
30
+ onDateSelect: (date: string) => void;
31
+ language?: 'en' | 'np';
32
+ brandColor?: string;
33
+ }
34
+
35
+ const CalendarPicker = ({
36
+ visible,
37
+ onClose,
38
+ theme = 'light',
39
+ onDateSelect,
40
+ language = 'np',
41
+ brandColor = '#2081b9',
42
+ }: CalendarPickerPoros) => {
43
+ const TodayNepaliDate = NepaliToday();
44
+ const cYear = parseInt(TodayNepaliDate.split('-')[0], 10);
45
+ const cMonth = parseInt(TodayNepaliDate.split('-')[1], 10);
46
+ const cDay = parseInt(TodayNepaliDate.split('-')[2], 10);
47
+
48
+ const [firstDayOfMonth, setFirstDayOfMonth] = useState<number>(0);
49
+ const [month, setMonth] = useState<number>(cMonth);
50
+ const [year, setYear] = useState<number>(cYear);
51
+ const [calendarDate, setCalendarDate] = useState<(number | null)[]>([]);
52
+
53
+ const [yearModal, setYearModal] = useState<boolean>(false);
54
+ const handleDateClick = (day: number) => {
55
+ const date = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
56
+ onDateSelect(date);
57
+ onClose();
58
+ };
59
+
60
+ const handleNextClick = () => {
61
+ if (month === 12) {
62
+ if (year < 2099) {
63
+ setYear((prev) => prev + 1);
64
+ setMonth(1);
65
+ }
66
+ } else {
67
+ setMonth((prev) => prev + 1);
68
+ }
69
+ };
70
+ const handlePreviousClick = () => {
71
+ if (month === 1) {
72
+ if (year > 2000) {
73
+ setYear((prev) => prev - 1);
74
+ setMonth(12);
75
+ }
76
+ } else {
77
+ setMonth((prev) => prev - 1);
78
+ }
79
+ };
80
+
81
+ const openYearView = () => {
82
+ setYearModal(true);
83
+ };
84
+
85
+ const closeYearView = () => {
86
+ setYearModal(false);
87
+ };
88
+
89
+ useEffect(() => {
90
+ // calculate First Day Of Month (FDOM) and Days In Month(DIM)
91
+ const FDOM = calcFirstDay(year, month);
92
+ const DIM = bs[year][month];
93
+ setFirstDayOfMonth(FDOM);
94
+
95
+ // array which contain 42 cells and it only fill the date with number if the date is present otherwise it fill cells with null.
96
+ const calendarCells = Array.from({ length: 42 }, (_, index) => {
97
+ const dayNumber = index - FDOM + 1;
98
+ if (dayNumber > 0 && dayNumber <= DIM) {
99
+ return dayNumber;
100
+ } else {
101
+ return null;
102
+ }
103
+ });
104
+ setCalendarDate(calendarCells);
105
+ }, [year, month]);
106
+
107
+ const syncToday = () => {
108
+ setMonth(cMonth);
109
+ setYear(cYear);
110
+ };
111
+
112
+ const handleYearClick = (year: number) => {
113
+ setYear(year);
114
+ closeYearView();
115
+ };
116
+ const dark = theme === 'dark';
117
+ const weekDays = language === 'en' ? daysInEnglish : daysInNepali;
118
+
119
+ return (
120
+ <Modal visible={visible} onRequestClose={onClose}>
121
+ <Pressable style={styles.outerPressable} onPress={onClose}>
122
+ <Pressable onPress={() => {}} style={styles.innerPressable}>
123
+ <View
124
+ style={{
125
+ ...styles.innerView,
126
+ backgroundColor: dark ? '#383838' : '#ffffff',
127
+ }}
128
+ >
129
+ <Text
130
+ style={{ color: dark ? 'white' : 'black', paddingHorizontal: 10 }}
131
+ >
132
+ {language === 'np' ? 'आजको मिति ' : "Today's Date"}
133
+ </Text>
134
+ {/* Today date in large fonts on click sync the calenar with today date */}
135
+ <View
136
+ style={{
137
+ display: 'flex',
138
+ flexDirection: 'row',
139
+ justifyContent: 'space-between',
140
+ paddingHorizontal: 10,
141
+ marginBottom: 20,
142
+ alignItems: 'center',
143
+ }}
144
+ >
145
+ <View>
146
+ <TouchableOpacity onPress={syncToday}>
147
+ {language == 'np' ? (
148
+ <Text
149
+ style={{
150
+ ...styles.TitleText,
151
+ fontSize: 20,
152
+ color: dark ? '#fff' : '#000',
153
+ }}
154
+ >
155
+ {getNepaliNumber(cYear)} {monthsInNepali[cMonth - 1]}
156
+ {' '} {getNepaliNumber(cDay)}
157
+ </Text>
158
+ ) : (
159
+ <Text
160
+ style={{
161
+ ...styles.TitleText,
162
+ fontSize: 27,
163
+ color: dark ? '#fff' : '#000',
164
+ }}
165
+ >
166
+ {cYear} {monthsInEnglish[cMonth - 1]}
167
+ {' '} {cDay}
168
+ </Text>
169
+ )}
170
+ </TouchableOpacity>
171
+ </View>
172
+ <TouchableOpacity onPress={syncToday}>
173
+ <DateSyncLogo day={cDay} color={dark ? '#ffff' : '#000'} />
174
+ </TouchableOpacity>
175
+ </View>
176
+
177
+ {/* for button container */}
178
+ <View style={styles.ButtonContainer}>
179
+ <TouchableOpacity
180
+ style={styles.CButton}
181
+ onPress={handlePreviousClick}
182
+ >
183
+ <ChevronIcon
184
+ direction="right"
185
+ color={dark ? 'white' : 'black'}
186
+ />
187
+ </TouchableOpacity>
188
+ <TouchableOpacity
189
+ style={{ flexDirection: 'row', alignItems: 'center' }}
190
+ onPress={openYearView}
191
+ >
192
+ <Text
193
+ style={{
194
+ ...styles.TitleText,
195
+ marginRight: 6,
196
+ color: dark ? 'white' : 'black',
197
+ }}
198
+ >
199
+ {language == 'np'
200
+ ? monthsInNepali[month - 1]
201
+ : monthsInEnglish[month - 1]}
202
+ </Text>
203
+ <Text
204
+ style={{
205
+ ...styles.TitleText,
206
+ marginRight: 10,
207
+ color: dark ? 'white' : 'black',
208
+ }}
209
+ >
210
+ {language == 'np' ? getNepaliNumber(year) : year}
211
+ </Text>
212
+
213
+ <Triangle
214
+ height={10}
215
+ width={13}
216
+ color={dark ? 'white' : 'black'}
217
+ />
218
+ </TouchableOpacity>
219
+ <TouchableOpacity
220
+ style={styles.CButton}
221
+ onPress={handleNextClick}
222
+ >
223
+ <ChevronIcon
224
+ direction="left"
225
+ color={dark ? 'white' : 'black'}
226
+ />
227
+ </TouchableOpacity>
228
+ </View>
229
+
230
+ {/* Overall date container whith week days and day item */}
231
+ <View style={styles.outerDateConainer}>
232
+ {/* for header of calendar week days */}
233
+ <View style={styles.weekContainer}>
234
+ {weekDays.map((item, index) => {
235
+ return (
236
+ <View style={styles.WeekItem} key={index}>
237
+ <Text
238
+ style={{
239
+ ...styles.WeekText,
240
+ color: dark ? 'white' : 'black',
241
+ }}
242
+ >
243
+ {item}
244
+ </Text>
245
+ </View>
246
+ );
247
+ })}
248
+ </View>
249
+
250
+ {/* for actual data fo calenadr which has the day in them */}
251
+ <View style={styles.datesContainer}>
252
+ {calendarDate.map((dayItem, index) => {
253
+ return (
254
+ <TouchableOpacity
255
+ style={styles.dateItem}
256
+ key={index}
257
+ onPress={
258
+ //execute on day item press, Only execute when dayItem is not null
259
+ dayItem ? () => handleDateClick(dayItem) : () => {}
260
+ }
261
+ >
262
+ {dayItem ? (
263
+ <View
264
+ style={{
265
+ paddingHorizontal: 6,
266
+ paddingVertical: 3,
267
+ borderRadius: 999,
268
+ //check if the date is today or not and apply conditional styling.
269
+ backgroundColor: isToday(
270
+ TodayNepaliDate,
271
+ index,
272
+ year,
273
+ month,
274
+ firstDayOfMonth
275
+ )
276
+ ? brandColor
277
+ : dark
278
+ ? '#383838'
279
+ : '#fff',
280
+ }}
281
+ >
282
+ <Text
283
+ style={{
284
+ ...styles.DayText,
285
+ color: isToday(
286
+ TodayNepaliDate,
287
+ index,
288
+ year,
289
+ month,
290
+ firstDayOfMonth
291
+ )
292
+ ? '#fff'
293
+ : dark
294
+ ? 'white'
295
+ : 'black',
296
+ }}
297
+ >
298
+ {language === 'np'
299
+ ? getNepaliNumber(dayItem)
300
+ : dayItem}
301
+ </Text>
302
+ </View>
303
+ ) : null}
304
+ </TouchableOpacity>
305
+ );
306
+ })}
307
+ </View>
308
+ </View>
309
+ </View>
310
+ </Pressable>
311
+ </Pressable>
312
+ <Modal visible={yearModal} onRequestClose={closeYearView}>
313
+ <Pressable
314
+ style={styles.outerPressable}
315
+ onPress={() => closeYearView()}
316
+ >
317
+ <Pressable style={styles.YearInnerPressable} onPress={() => {}}>
318
+ <View
319
+ style={{
320
+ ...styles.InnerYearView,
321
+ backgroundColor: dark ? '#383838' : '#f2f2f2',
322
+ }}
323
+ >
324
+ <ScrollView
325
+ showsVerticalScrollIndicator={false}
326
+ contentContainerStyle={{
327
+ display: 'flex',
328
+ paddingVertical: 10,
329
+ flexDirection: 'row',
330
+ justifyContent: 'center',
331
+ flexWrap: 'wrap',
332
+ }}
333
+ >
334
+ {Array(100)
335
+ .fill(0)
336
+ .map((_, index) => {
337
+ return (
338
+ <TouchableOpacity
339
+ key={index}
340
+ onPress={() => handleYearClick(index + 2000)}
341
+ style={{
342
+ paddingHorizontal: 20,
343
+ paddingVertical: 6,
344
+ marginHorizontal: 4,
345
+ marginVertical: 4,
346
+ borderColor: dark ? 'white' : 'black',
347
+ borderRadius: 20,
348
+
349
+ backgroundColor:
350
+ index + 2000 === year ? brandColor : '',
351
+ borderWidth: 0.4,
352
+ }}
353
+ >
354
+ <Text
355
+ style={{
356
+ fontWeight: '500',
357
+ color:
358
+ index + 2000 === year
359
+ ? 'white'
360
+ : dark
361
+ ? 'white'
362
+ : 'black',
363
+ }}
364
+ >
365
+ {language === 'np'
366
+ ? getNepaliNumber(index + 2000)
367
+ : index + 2000}
368
+ </Text>
369
+ </TouchableOpacity>
370
+ );
371
+ })}
372
+ </ScrollView>
373
+ </View>
374
+ </Pressable>
375
+ </Pressable>
376
+ </Modal>
377
+ </Modal>
378
+ );
379
+ };
380
+
381
+ const styles = StyleSheet.create({
382
+ outerPressable: {
383
+ height: '100%',
384
+ justifyContent: 'center',
385
+ width: '100%',
386
+ alignItems: 'center',
387
+ backgroundColor: 'rgba(0,0,0,0.54)',
388
+ },
389
+ innerPressable: {
390
+ minHeight: '20%',
391
+ maxWidth: 500,
392
+ marginHorizontal: 30,
393
+ },
394
+ innerView: {
395
+ borderRadius: 20,
396
+ backgroundColor: '#f2f2f2',
397
+ padding: 10,
398
+ },
399
+
400
+ weekContainer: {
401
+ flexDirection: 'row',
402
+ width: '100%',
403
+ },
404
+ WeekItem: {
405
+ width: '14.28%',
406
+ alignItems: 'center',
407
+ paddingVertical: 18,
408
+ },
409
+ WeekText: {
410
+ fontWeight: 'bold',
411
+ fontSize: 14,
412
+ color: 'black',
413
+ },
414
+ datesContainer: {
415
+ flexDirection: 'row',
416
+ flexWrap: 'wrap',
417
+ },
418
+ dateItem: {
419
+ overflow: 'hidden',
420
+ width: '14.28%',
421
+ justifyContent: 'center',
422
+ alignItems: 'center',
423
+ paddingVertical: 10,
424
+ },
425
+ DayText: {
426
+ fontSize: 14,
427
+ fontWeight: '600',
428
+ },
429
+ CButton: {
430
+ paddingHorizontal: 20,
431
+ paddingVertical: 10,
432
+ },
433
+ ButtonContainer: {
434
+ alignItems: 'center',
435
+ flexDirection: 'row',
436
+ marginBottom: 10,
437
+ justifyContent: 'space-between',
438
+ },
439
+ outerDateConainer: {
440
+ paddingHorizontal: 3,
441
+ },
442
+ TitleText: {
443
+ fontSize: 20,
444
+ fontWeight: 'bold',
445
+ },
446
+ // for year view modal
447
+ YearInnerPressable: {
448
+ justifyContent: 'center',
449
+ maxWidth: 500,
450
+ maxHeight: '70%',
451
+ marginHorizontal: 30,
452
+ },
453
+ InnerYearView: {
454
+ borderRadius: 20,
455
+ backgroundColor: '#f2f2f2',
456
+ minHeight: 50,
457
+ maxHeight: '100%',
458
+ },
459
+ });
460
+ export default CalendarPicker;
@@ -0,0 +1,84 @@
1
+ import { View, Text, StyleSheet } from 'react-native';
2
+ const DateSyncLogo = ({ size = 28, color = '#003a05', day = 0 }) => {
3
+ const scale = size / 24;
4
+
5
+ // Format the date as DD
6
+
7
+ return (
8
+ <View style={[styles.container, { width: size, height: size }]}>
9
+ {/* Calendar base */}
10
+ <View style={[styles.calendarBase, { borderColor: color }]}>
11
+ {/* Date text */}
12
+ <Text style={[styles.dateText, { color: color, fontSize: 9 * scale }]}>
13
+ {day}
14
+ </Text>
15
+ </View>
16
+
17
+ {/* Calendar top */}
18
+ <View
19
+ style={[styles.calendarTop, { borderColor: color, top: 2 * scale }]}
20
+ />
21
+ </View>
22
+ );
23
+ };
24
+
25
+ const styles = StyleSheet.create({
26
+ container: {
27
+ aspectRatio: 1,
28
+ position: 'relative',
29
+ },
30
+ calendarBase: {
31
+ position: 'absolute',
32
+ left: '12.5%',
33
+ top: '12.5%',
34
+ width: '75%',
35
+ height: '75%',
36
+ borderWidth: 2,
37
+ borderRadius: 3,
38
+ justifyContent: 'center',
39
+ alignItems: 'center',
40
+ },
41
+ dateText: {
42
+ fontWeight: '800',
43
+ },
44
+ calendarTop: {
45
+ position: 'absolute',
46
+ left: '12.5%',
47
+ width: '75%',
48
+ height: '20%',
49
+ borderTopWidth: 4,
50
+ borderLeftWidth: 2,
51
+ borderRightWidth: 2,
52
+ borderTopLeftRadius: 10,
53
+ borderTopRightRadius: 0,
54
+ },
55
+ syncCircle: {
56
+ position: 'absolute',
57
+ width: '50%',
58
+ height: '50%',
59
+ borderWidth: 2,
60
+ borderRadius: 100,
61
+ justifyContent: 'center',
62
+ alignItems: 'center',
63
+ },
64
+ syncArrow: {
65
+ position: 'absolute',
66
+ width: '40%',
67
+ height: '40%',
68
+ borderWidth: 2,
69
+ borderTopWidth: 0,
70
+ borderRightWidth: 0,
71
+ transform: [{ rotate: '45deg' }],
72
+ },
73
+ syncArrowLeft: {
74
+ left: '15%',
75
+ top: '10%',
76
+ },
77
+ syncArrowRight: {
78
+ right: '15%',
79
+ bottom: '10%',
80
+ transform: [{ rotate: '225deg' }],
81
+ },
82
+ });
83
+
84
+ export default DateSyncLogo;
@@ -0,0 +1,143 @@
1
+ import { View, StyleSheet } from 'react-native';
2
+
3
+ const ChevronIcon = ({ direction = 'right', size = 15, color = '#000' }) => {
4
+ const isLeft = direction === 'left';
5
+
6
+ return (
7
+ <View style={[styles.container, { width: size, height: size }]}>
8
+ <View
9
+ style={[
10
+ styles.line,
11
+ isLeft ? styles.leftTop : styles.rightTop,
12
+ { backgroundColor: color },
13
+ ]}
14
+ />
15
+ <View
16
+ style={[
17
+ styles.line,
18
+ isLeft ? styles.leftBottom : styles.rightBottom,
19
+ { backgroundColor: color },
20
+ ]}
21
+ />
22
+ </View>
23
+ );
24
+ };
25
+
26
+ const EditPencilIcon = ({ size = 24, color = '#000' }) => {
27
+ return (
28
+ <View style={[styles.container, { width: size, height: size }]}>
29
+ <View style={[styles.pencilBody, { backgroundColor: color }]} />
30
+ <View style={[styles.pencilTip, { borderBottomColor: color }]} />
31
+ <View style={[styles.pencilEraser, { backgroundColor: '#FFA07A' }]} />
32
+ </View>
33
+ );
34
+ };
35
+ const Triangle = ({ width = 10, height = 20, color = 'white' }) => {
36
+ return (
37
+ <View
38
+ style={[
39
+ styles.triangle,
40
+ {
41
+ borderLeftWidth: width / 2,
42
+ borderRightWidth: width / 2,
43
+ borderBottomWidth: height,
44
+ borderBottomColor: color,
45
+ },
46
+ ]}
47
+ />
48
+ );
49
+ };
50
+ const ChevronDown = ({ size = 10, color = '#000' }) => {
51
+ return (
52
+ <View
53
+ style={[
54
+ styles.container,
55
+ { width: size, height: size, transform: [{ rotate: '-90deg' }] },
56
+ ]}
57
+ >
58
+ <View
59
+ style={[styles.line, styles.rightTop, { backgroundColor: color }]}
60
+ />
61
+ <View
62
+ style={[styles.line, styles.rightBottom, { backgroundColor: color }]}
63
+ />
64
+ </View>
65
+ );
66
+ };
67
+
68
+ const styles = StyleSheet.create({
69
+ container: {
70
+ justifyContent: 'center',
71
+ alignItems: 'center',
72
+ },
73
+ line: {
74
+ position: 'absolute',
75
+ width: '90%',
76
+ height: 2,
77
+ },
78
+ leftTop: {
79
+ top: '15%',
80
+ left: '20%',
81
+ transform: [{ rotate: '45deg' }],
82
+ },
83
+ leftBottom: {
84
+ bottom: '15%',
85
+ left: '20%',
86
+ transform: [{ rotate: '-45deg' }],
87
+ },
88
+ rightTop: {
89
+ top: '15%',
90
+ right: '20%',
91
+ transform: [{ rotate: '-45deg' }],
92
+ },
93
+ rightBottom: {
94
+ bottom: '15%',
95
+ right: '20%',
96
+ transform: [{ rotate: '45deg' }],
97
+ },
98
+ triangle: {
99
+ width: 0,
100
+ height: 0,
101
+ backgroundColor: 'transparent',
102
+ borderStyle: 'solid',
103
+ borderLeftWidth: 6,
104
+ borderRightWidth: 6,
105
+ borderBottomWidth: 0,
106
+ borderLeftColor: 'transparent',
107
+ borderRightColor: 'transparent',
108
+ borderTopWidth: 8,
109
+ },
110
+ pencilBody: {
111
+ width: '60%',
112
+ height: '75%',
113
+ position: 'absolute',
114
+ bottom: '12.5%',
115
+ left: '20%',
116
+ transform: [{ skewX: '5deg' }],
117
+ },
118
+ pencilTip: {
119
+ width: 0,
120
+ height: 0,
121
+ backgroundColor: 'transparent',
122
+ borderStyle: 'solid',
123
+ borderLeftWidth: 7,
124
+ borderRightWidth: 7,
125
+ borderTopWidth: 0,
126
+ borderLeftColor: 'transparent',
127
+ borderRightColor: 'transparent',
128
+ borderBottomWidth: 10,
129
+ position: 'absolute',
130
+ bottom: '12.5%',
131
+ left: '20%',
132
+ },
133
+ pencilEraser: {
134
+ width: '60%',
135
+ height: '10%',
136
+ position: 'absolute',
137
+ top: '12.5%',
138
+ left: '20%',
139
+ transform: [{ skewX: '5deg' }],
140
+ },
141
+ });
142
+
143
+ export { ChevronIcon, ChevronDown, EditPencilIcon, Triangle };