dhre-ui-kit 0.0.2 → 0.0.4
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/package.json +4 -4
- package/src/assets/images/arrowLeft.svg +3 -0
- package/src/assets/images/caretDown.svg +3 -0
- package/src/assets/images/caretLeft.svg +3 -0
- package/src/assets/images/caretUp.svg +3 -0
- package/src/assets/images/circleTick.svg +3 -0
- package/src/assets/images/crossIcon.svg +3 -0
- package/src/assets/images/dotsThreeVertical.svg +5 -0
- package/src/assets/images/searchIcon.svg +4 -0
- package/src/assets/index.ts +20 -1
- package/src/components/accordion/Accordion.interface.ts +7 -0
- package/src/components/accordion/Accordion.styles.ts +28 -0
- package/src/components/accordion/Accordion.test.tsx +21 -0
- package/src/components/accordion/Accordion.tsx +64 -0
- package/src/components/accordion/index.ts +1 -0
- package/src/components/badge/Badge.test.tsx +12 -0
- package/src/components/badge/Badge.tsx +2 -1
- package/src/components/bottomDrawer/BottomDrawer.interface.ts +5 -0
- package/src/components/bottomDrawer/BottomDrawer.styles.ts +18 -10
- package/src/components/bottomDrawer/BottomDrawer.tsx +29 -12
- package/src/components/button/Button.interface.ts +0 -2
- package/src/components/button/Button.tsx +2 -7
- package/src/components/customHeader/CustomHeader.interface.tsx +10 -0
- package/src/components/customHeader/CustomHeader.styles.ts +24 -0
- package/src/components/customHeader/CustomHeader.test.tsx +14 -0
- package/src/components/customHeader/CustomHeader.tsx +46 -0
- package/src/components/customHeader/index.ts +1 -0
- package/src/components/customSearchBar/CustomSearchBar.interface.ts +9 -0
- package/src/components/customSearchBar/CustomSearchBar.styles.ts +23 -0
- package/src/components/customSearchBar/CustomSearchBar.test.tsx +19 -0
- package/src/components/customSearchBar/CustomSearchBar.tsx +55 -0
- package/src/components/customSearchBar/index.ts +1 -0
- package/src/components/customText/CustomText.tsx +3 -3
- package/src/components/customTypography/CustomTypography.test.tsx +12 -0
- package/src/components/customTypography/CustomTypography.tsx +5 -3
- package/src/components/swipableList/SwipableList.interface.ts +37 -0
- package/src/components/swipableList/SwipableList.styles.ts +24 -0
- package/src/components/{notification/Notification.test.tsx → swipableList/SwipableList.test.tsx} +20 -21
- package/src/components/swipableList/SwipableList.tsx +106 -0
- package/src/components/swipableList/index.ts +1 -0
- package/src/components/toast/Toast.interface.ts +8 -0
- package/src/components/toast/Toast.styles.ts +40 -0
- package/src/components/toast/Toast.test.tsx +21 -0
- package/src/components/toast/Toast.tsx +89 -0
- package/src/components/toast/index.ts +1 -0
- package/src/index.ts +5 -0
- package/src/theme/ThemeContext.tsx +6 -6
- package/src/theme/fonts.ts +8 -0
- package/src/utils/stylehelper.ts +1 -1
- package/src/components/notification/Notification.interface.ts +0 -61
- package/src/components/notification/Notification.styles.ts +0 -33
- package/src/components/notification/Notification.tsx +0 -156
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {FlatList, View, Pressable} from 'react-native';
|
|
3
|
-
import {GestureHandlerRootView, Swipeable} from 'react-native-gesture-handler';
|
|
4
|
-
import {
|
|
5
|
-
ActionButtonProps,
|
|
6
|
-
ListItemProps,
|
|
7
|
-
NotificationItem,
|
|
8
|
-
NotificationProps,
|
|
9
|
-
} from './Notification.interface';
|
|
10
|
-
import {styles} from './Notification.styles';
|
|
11
|
-
import CustomTypography from '../customTypography/CustomTypography';
|
|
12
|
-
|
|
13
|
-
const Notification = ({
|
|
14
|
-
notifications,
|
|
15
|
-
leftPrimaryActionIcon,
|
|
16
|
-
leftPrimaryActionTitle,
|
|
17
|
-
leftPrimaryActionHandler,
|
|
18
|
-
leftPrimaryActionStyle,
|
|
19
|
-
leftSecondaryActionIcon,
|
|
20
|
-
leftSecondaryActionTitle,
|
|
21
|
-
leftSecondaryActionHandler,
|
|
22
|
-
leftSecondaryActionStyle,
|
|
23
|
-
rightPrimaryActionIcon,
|
|
24
|
-
rightPrimaryActionTitle,
|
|
25
|
-
rightPrimaryActionHandler,
|
|
26
|
-
rightPrimaryActionStyle,
|
|
27
|
-
rightSecondaryActionIcon,
|
|
28
|
-
rightSecondaryActionTitle,
|
|
29
|
-
rightSecondaryActionHandler,
|
|
30
|
-
rightSecondaryActionStyle,
|
|
31
|
-
itemStyle,
|
|
32
|
-
titleStyle,
|
|
33
|
-
}: NotificationProps) => {
|
|
34
|
-
const ActionButton = ({
|
|
35
|
-
icon,
|
|
36
|
-
title,
|
|
37
|
-
onPress,
|
|
38
|
-
style,
|
|
39
|
-
testID,
|
|
40
|
-
}: ActionButtonProps) => (
|
|
41
|
-
<Pressable
|
|
42
|
-
testID={testID}
|
|
43
|
-
onPress={onPress}
|
|
44
|
-
style={[styles.actionButton, style, styles.itemIconAlign]}>
|
|
45
|
-
{icon}
|
|
46
|
-
<CustomTypography variant="H9medium" style={titleStyle} text={title} />
|
|
47
|
-
</Pressable>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const leftActionHandle = item => (
|
|
51
|
-
<View style={[styles.leftActions, leftPrimaryActionStyle]}>
|
|
52
|
-
{leftPrimaryActionIcon && leftPrimaryActionHandler && (
|
|
53
|
-
<ActionButton
|
|
54
|
-
icon={leftPrimaryActionIcon}
|
|
55
|
-
title={leftPrimaryActionTitle || ''}
|
|
56
|
-
onPress={() => leftPrimaryActionHandler(item.id)}
|
|
57
|
-
style={leftPrimaryActionStyle}
|
|
58
|
-
testID={`leftPrimary-${item.id}`}
|
|
59
|
-
/>
|
|
60
|
-
)}
|
|
61
|
-
{leftSecondaryActionIcon && leftSecondaryActionHandler && (
|
|
62
|
-
<ActionButton
|
|
63
|
-
icon={leftSecondaryActionIcon}
|
|
64
|
-
title={leftSecondaryActionTitle || ''}
|
|
65
|
-
onPress={() => leftSecondaryActionHandler(item.id)}
|
|
66
|
-
style={leftSecondaryActionStyle}
|
|
67
|
-
testID={`leftSecondary-${item.id}`}
|
|
68
|
-
/>
|
|
69
|
-
)}
|
|
70
|
-
</View>
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const rightActionHandle = item => (
|
|
74
|
-
<View style={[styles.rightActions, rightPrimaryActionStyle]}>
|
|
75
|
-
{rightPrimaryActionIcon && rightPrimaryActionHandler && (
|
|
76
|
-
<ActionButton
|
|
77
|
-
icon={rightPrimaryActionIcon}
|
|
78
|
-
title={rightPrimaryActionTitle || ''}
|
|
79
|
-
onPress={() => rightPrimaryActionHandler(item.id)}
|
|
80
|
-
style={rightPrimaryActionStyle}
|
|
81
|
-
testID={`rightPrimary-${item.id}`}
|
|
82
|
-
/>
|
|
83
|
-
)}
|
|
84
|
-
{rightSecondaryActionIcon && rightSecondaryActionHandler && (
|
|
85
|
-
<ActionButton
|
|
86
|
-
icon={rightSecondaryActionIcon}
|
|
87
|
-
title={rightSecondaryActionTitle || ''}
|
|
88
|
-
onPress={() => rightSecondaryActionHandler(item.id)}
|
|
89
|
-
style={rightSecondaryActionStyle}
|
|
90
|
-
testID={`rightSecondary-${item.id}`}
|
|
91
|
-
/>
|
|
92
|
-
)}
|
|
93
|
-
</View>
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const ListItem = ({item, itemStyle, titleStyle}: ListItemProps) => (
|
|
97
|
-
<GestureHandlerRootView testID="LIST" style={styles.container}>
|
|
98
|
-
<Swipeable
|
|
99
|
-
renderLeftActions={() => leftActionHandle(item)}
|
|
100
|
-
renderRightActions={() => rightActionHandle(item)}>
|
|
101
|
-
<View style={[styles.item, itemStyle]}>
|
|
102
|
-
<CustomTypography
|
|
103
|
-
variant="H7medium"
|
|
104
|
-
style={titleStyle}
|
|
105
|
-
text={item?.title}
|
|
106
|
-
/>
|
|
107
|
-
</View>
|
|
108
|
-
</Swipeable>
|
|
109
|
-
</GestureHandlerRootView>
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const sortData = (data: NotificationItem[]) => {
|
|
113
|
-
return data?.sort((a, b) => {
|
|
114
|
-
if (a.isPinned && !b.isPinned) return -1;
|
|
115
|
-
if (!a.isPinned && b.isPinned) return 1;
|
|
116
|
-
return 0;
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const renderItem = ({item}: {item: NotificationItem}) => (
|
|
121
|
-
<ListItem
|
|
122
|
-
item={item}
|
|
123
|
-
leftPrimaryActionIcon={leftPrimaryActionIcon}
|
|
124
|
-
leftPrimaryActionTitle={leftPrimaryActionTitle}
|
|
125
|
-
leftPrimaryActionHandler={leftPrimaryActionHandler}
|
|
126
|
-
leftPrimaryActionStyle={leftPrimaryActionStyle}
|
|
127
|
-
leftSecondaryActionIcon={leftSecondaryActionIcon}
|
|
128
|
-
leftSecondaryActionTitle={leftSecondaryActionTitle}
|
|
129
|
-
leftSecondaryActionHandler={leftSecondaryActionHandler}
|
|
130
|
-
leftSecondaryActionStyle={leftSecondaryActionStyle}
|
|
131
|
-
rightPrimaryActionIcon={rightPrimaryActionIcon}
|
|
132
|
-
rightPrimaryActionTitle={rightPrimaryActionTitle}
|
|
133
|
-
rightPrimaryActionHandler={rightPrimaryActionHandler}
|
|
134
|
-
rightPrimaryActionStyle={rightPrimaryActionStyle}
|
|
135
|
-
rightSecondaryActionIcon={rightSecondaryActionIcon}
|
|
136
|
-
rightSecondaryActionTitle={rightSecondaryActionTitle}
|
|
137
|
-
rightSecondaryActionHandler={rightSecondaryActionHandler}
|
|
138
|
-
rightSecondaryActionStyle={rightSecondaryActionStyle}
|
|
139
|
-
itemStyle={itemStyle}
|
|
140
|
-
titleStyle={titleStyle}
|
|
141
|
-
/>
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<View testID="NOTIFICATION">
|
|
146
|
-
<FlatList
|
|
147
|
-
data={sortData(notifications)}
|
|
148
|
-
renderItem={renderItem}
|
|
149
|
-
keyExtractor={item => item.id}
|
|
150
|
-
ItemSeparatorComponent={() => <View style={styles.sepratorView} />}
|
|
151
|
-
/>
|
|
152
|
-
</View>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export default Notification;
|