@openlettermarketing/olc-react-sdk 0.0.8 → 0.0.10
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/.eslintignore +1 -0
- package/.eslintrc.cjs +18 -0
- package/.eslintrc.yml +47 -0
- package/.prettierignore +3 -0
- package/.prettierrc.yml +5 -0
- package/CHANGELOG.md +4 -0
- package/babel.config.json +10 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/examples/.eslintrc.yml +4 -0
- package/index.html +18 -0
- package/package.json +6 -6
- package/public/vite.svg +1 -0
- package/src/App.tsx +76 -0
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/input/cancel.tsx +20 -0
- package/src/assets/images/input/search.tsx +20 -0
- package/src/assets/images/modal-icons/cancelIcon.png +0 -0
- package/src/assets/images/modal-icons/del.tsx +19 -0
- package/src/assets/images/modal-icons/delete.svg +3 -0
- package/src/assets/images/modal-icons/modal-cross.tsx +23 -0
- package/src/assets/images/modal-icons/save.tsx +23 -0
- package/src/assets/images/templates/add-icon.svg +5 -0
- package/src/assets/images/templates/back-arrow.tsx +19 -0
- package/src/assets/images/templates/back-dialog-icon.png +0 -0
- package/src/assets/images/templates/back-dialog-icon.svg +3 -0
- package/src/assets/images/templates/barcode.png +0 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
- package/src/assets/images/templates/black-trash-icon.svg +3 -0
- package/src/assets/images/templates/cancel.svg +4 -0
- package/src/assets/images/templates/cancelIcon.png +0 -0
- package/src/assets/images/templates/clipboard.svg +3 -0
- package/src/assets/images/templates/contact-search.svg +3 -0
- package/src/assets/images/templates/content-copy-icon.tsx +24 -0
- package/src/assets/images/templates/cross.svg +3 -0
- package/src/assets/images/templates/custom-template-icon-black.svg +3 -0
- package/src/assets/images/templates/custom-template-icon.svg +3 -0
- package/src/assets/images/templates/custom-template.tsx +23 -0
- package/src/assets/images/templates/dummy-template.svg +21 -0
- package/src/assets/images/templates/dynamic-field.tsx +119 -0
- package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
- package/src/assets/images/templates/filter-2.svg +13 -0
- package/src/assets/images/templates/info-icon.svg +12 -0
- package/src/assets/images/templates/info-icon.tsx +37 -0
- package/src/assets/images/templates/one-barcode.png +0 -0
- package/src/assets/images/templates/personal-letter.tsx +53 -0
- package/src/assets/images/templates/plus-icon.svg +5 -0
- package/src/assets/images/templates/postcard.tsx +32 -0
- package/src/assets/images/templates/professional-letter.tsx +53 -0
- package/src/assets/images/templates/real-penned-letters.tsx +57 -0
- package/src/assets/images/templates/search.svg +3 -0
- package/src/assets/images/templates/size-image-lg.tsx +20 -0
- package/src/assets/images/templates/size-image-mid.tsx +20 -0
- package/src/assets/images/templates/size-image.tsx +20 -0
- package/src/assets/images/templates/template-copy.svg +3 -0
- package/src/assets/images/templates/template-default-design.tsx +21 -0
- package/src/assets/images/templates/template-delete.svg +3 -0
- package/src/assets/images/templates/template-edit.svg +4 -0
- package/src/assets/images/templates/template-save-icon.svg +3 -0
- package/src/assets/images/templates/template-search-2.svg +9 -0
- package/src/assets/images/templates/template-search.svg +4 -0
- package/src/assets/images/templates/thumbnail.svg +10 -0
- package/src/assets/images/templates/trash-icon.svg +13 -0
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
- package/src/components/CreateTemplate/index.tsx +377 -0
- package/src/components/CreateTemplate/styles.scss +363 -0
- package/src/components/GenericUIBlocks/Button/index.tsx +21 -0
- package/src/components/GenericUIBlocks/Button/styles.scss +15 -0
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +98 -0
- package/src/components/GenericUIBlocks/Dialog/index.tsx +127 -0
- package/src/components/GenericUIBlocks/Dialog/styles.scss +106 -0
- package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
- package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +86 -0
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +77 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +24 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +9 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +53 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +34 -0
- package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
- package/src/components/GenericUIBlocks/Input/index.tsx +89 -0
- package/src/components/GenericUIBlocks/Input/styles.scss +80 -0
- package/src/components/GenericUIBlocks/Snackbar/index.tsx +66 -0
- package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
- package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
- package/src/components/SidePanel/customFields/customFieldSection.tsx +162 -0
- package/src/components/SidePanel/customFields/styles.scss +47 -0
- package/src/components/SidePanel/index.tsx +30 -0
- package/src/components/SidePanel/templates/customTemplateSection.tsx +505 -0
- package/src/components/SidePanel/templates/styles.scss +151 -0
- package/src/components/TemplateBuilder/index.tsx +295 -0
- package/src/components/TemplateBuilder/styles.scss +66 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +58 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +98 -0
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +60 -0
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
- package/src/components/TopNavigation/index.tsx +388 -0
- package/src/components/TopNavigation/styles.scss +83 -0
- package/src/importMeta.d.ts +9 -0
- package/src/index.scss +130 -0
- package/src/index.tsx +82 -0
- package/src/libs/test.ts +7 -0
- package/src/redux/actions/action-types.ts +42 -0
- package/src/redux/actions/customFieldAction.ts +28 -0
- package/src/redux/actions/snackbarActions.ts +16 -0
- package/src/redux/actions/templateActions.ts +456 -0
- package/src/redux/reducers/customFieldReducer.ts +97 -0
- package/src/redux/reducers/index.ts +14 -0
- package/src/redux/reducers/snackbarReducer.ts +41 -0
- package/src/redux/reducers/templateReducer.ts +353 -0
- package/src/redux/store.ts +18 -0
- package/src/styles/colors.scss +61 -0
- package/src/test/mocks.js +89 -0
- package/src/test/setupJest.js +1 -0
- package/src/utils/api.ts +36 -0
- package/src/utils/constants.ts +40 -0
- package/src/utils/customStyles.ts +135 -0
- package/src/utils/fetchWrapper.ts +68 -0
- package/src/utils/fonts.json +1597 -0
- package/src/utils/helper.ts +19 -0
- package/src/utils/local-storage.ts +15 -0
- package/src/utils/message.ts +71 -0
- package/src/utils/template-builder.ts +147 -0
- package/src/utils/templateRestrictedArea/biFold.ts +433 -0
- package/src/utils/templateRestrictedArea/postCard.ts +439 -0
- package/src/utils/templateRestrictedArea/professional.ts +422 -0
- package/src/utils/templateRestrictedArea/realPenned.ts +283 -0
- package/src/utils/templateRestrictedArea/triFold.ts +434 -0
- package/tsconfig.json +29 -0
- package/tsconfig.node.json +12 -0
- package/vite.config.ts +8 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* The Modal (background) */
|
|
2
|
+
.modal {
|
|
3
|
+
display: none; /* Hidden by default */
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
position: fixed; /* Stay in place */
|
|
7
|
+
z-index: 99999; /* Sit on top */
|
|
8
|
+
left: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
width: 100%; /* Full width */
|
|
11
|
+
height: 100%; /* Full height */
|
|
12
|
+
overflow: auto; /* Enable scroll if needed */
|
|
13
|
+
background-color: rgb(0, 0, 0); /* Fallback color */
|
|
14
|
+
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
|
|
15
|
+
/* Modal Content */
|
|
16
|
+
.modal-content {
|
|
17
|
+
position: relative;
|
|
18
|
+
background-color: var(--dialogModalBgColor);
|
|
19
|
+
margin: auto;
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 1px solid #888;
|
|
22
|
+
width: 80%;
|
|
23
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
24
|
+
-webkit-animation-name: animatetop;
|
|
25
|
+
-webkit-animation-duration: 0.4s;
|
|
26
|
+
animation-name: animatetop;
|
|
27
|
+
animation-duration: 0.4s;
|
|
28
|
+
border-radius: 11px;
|
|
29
|
+
.modal-header {
|
|
30
|
+
position: relative;
|
|
31
|
+
height: 100%;
|
|
32
|
+
min-height: 20px;
|
|
33
|
+
color: var(--dialogModalTextColor);
|
|
34
|
+
/* The Close Button */
|
|
35
|
+
.close {
|
|
36
|
+
color: var(--dialogModalTextColor);
|
|
37
|
+
float: right;
|
|
38
|
+
font-size: 28px;
|
|
39
|
+
font-weight: bold;
|
|
40
|
+
position: absolute;
|
|
41
|
+
right: 10px;
|
|
42
|
+
top: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.close:hover,
|
|
46
|
+
.close:focus {
|
|
47
|
+
color: var(--dialogModalTextColor);
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.modal-body {
|
|
54
|
+
padding: 2px 16px;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
align-items: center;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
color: var(--dialogModalTextColor);
|
|
60
|
+
.modal-icon{
|
|
61
|
+
svg{
|
|
62
|
+
width: 100%;
|
|
63
|
+
max-width: 60px;
|
|
64
|
+
height: 100%;
|
|
65
|
+
min-height: 70px;
|
|
66
|
+
fill: var(--dialogModalSVGColor);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.modal-footer {
|
|
72
|
+
padding: 2px 16px;
|
|
73
|
+
color: var(--dialogModalTextColor);
|
|
74
|
+
position: absolute;
|
|
75
|
+
bottom: 10px;
|
|
76
|
+
width: 100%;
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 20px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Add Animation */
|
|
85
|
+
@-webkit-keyframes animatetop {
|
|
86
|
+
from {
|
|
87
|
+
top: -300px;
|
|
88
|
+
opacity: 0;
|
|
89
|
+
}
|
|
90
|
+
to {
|
|
91
|
+
top: 0;
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@keyframes animatetop {
|
|
97
|
+
from {
|
|
98
|
+
top: -300px;
|
|
99
|
+
opacity: 0;
|
|
100
|
+
}
|
|
101
|
+
to {
|
|
102
|
+
top: 0;
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// react select
|
|
4
|
+
import Select, {StylesConfig} from 'react-select';
|
|
5
|
+
|
|
6
|
+
// components
|
|
7
|
+
import Typography from '../Typography';
|
|
8
|
+
|
|
9
|
+
// styles
|
|
10
|
+
import './styles.scss';
|
|
11
|
+
|
|
12
|
+
interface Option {
|
|
13
|
+
id?: number | string;
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface GeneralSelectProps {
|
|
19
|
+
options: Option[];
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
selectedValue: Option | null;
|
|
24
|
+
isError: boolean;
|
|
25
|
+
setSelectedValue: (option: Option | null) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const colourStyles: StylesConfig<Option, false> = {
|
|
29
|
+
dropdownIndicator: (styles, {isFocused, selectProps}) => ({
|
|
30
|
+
...styles,
|
|
31
|
+
color: isFocused && selectProps.menuIsOpen ? 'var(--primaryColor)' : 'grey',
|
|
32
|
+
transform:
|
|
33
|
+
!isFocused && !selectProps.menuIsOpen ? 'rotate(180deg)' : undefined,
|
|
34
|
+
}),
|
|
35
|
+
option: (styles, {isDisabled, isFocused, isSelected}) => {
|
|
36
|
+
return {
|
|
37
|
+
...styles,
|
|
38
|
+
backgroundColor: isDisabled
|
|
39
|
+
? undefined
|
|
40
|
+
: isSelected && isFocused
|
|
41
|
+
? 'var(--selectOptionSelectedBg)'
|
|
42
|
+
: isFocused && !isSelected
|
|
43
|
+
? 'var(--selectOptionFocusedColor)'
|
|
44
|
+
: undefined,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const errorStyles = {
|
|
50
|
+
color: '#FF0000',
|
|
51
|
+
fontWeight: '400'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const GeneralSelect: React.FC<GeneralSelectProps> = ({
|
|
55
|
+
options,
|
|
56
|
+
placeholder,
|
|
57
|
+
error,
|
|
58
|
+
label,
|
|
59
|
+
isError,
|
|
60
|
+
selectedValue,
|
|
61
|
+
setSelectedValue,
|
|
62
|
+
}) => {
|
|
63
|
+
return (
|
|
64
|
+
<div className="select-layout">
|
|
65
|
+
<label>{label && label}</label>
|
|
66
|
+
<Select
|
|
67
|
+
value={selectedValue}
|
|
68
|
+
options={options}
|
|
69
|
+
onChange={setSelectedValue}
|
|
70
|
+
styles={colourStyles}
|
|
71
|
+
className="generic-select-container"
|
|
72
|
+
classNamePrefix="generic-select"
|
|
73
|
+
placeholder={placeholder}
|
|
74
|
+
blurInputOnSelect
|
|
75
|
+
/>
|
|
76
|
+
{isError && (
|
|
77
|
+
<Typography variant="p" style={errorStyles}>
|
|
78
|
+
<sup>*</sup>
|
|
79
|
+
{error}
|
|
80
|
+
</Typography>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default GeneralSelect;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.select-layout {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
justify-content: flex-start;
|
|
6
|
+
width: 100%;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
|
|
9
|
+
label {
|
|
10
|
+
color: var(--selectTextColor);
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
line-height: normal;
|
|
15
|
+
margin-bottom: 5px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.generic-select-container {
|
|
19
|
+
width: 100%;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
line-height: 21px;
|
|
23
|
+
.generic-select__control {
|
|
24
|
+
height: 100%;
|
|
25
|
+
min-height: 55px;
|
|
26
|
+
background-color: var(--selectBgColor);
|
|
27
|
+
border: 0.5px solid var(--selectBorderColor);
|
|
28
|
+
border-radius: 7px;
|
|
29
|
+
padding-left: 10px;
|
|
30
|
+
.generic-select__value-container {
|
|
31
|
+
.generic-select__single-value {
|
|
32
|
+
color: var(--selectTextColor);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&:hover {
|
|
36
|
+
border: 0.5px solid var(--selectBorderColor);
|
|
37
|
+
}
|
|
38
|
+
&::placeholder {
|
|
39
|
+
opacity: 0.5;
|
|
40
|
+
}
|
|
41
|
+
&.generic-select__control--is-focused {
|
|
42
|
+
border: 0.5px solid var(--selectBorderColor);
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
}
|
|
45
|
+
.generic-select__indicators {
|
|
46
|
+
transition: 0.2s ease-in all;
|
|
47
|
+
.generic-select__indicator-separator {
|
|
48
|
+
display: none !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.generic-select__menu {
|
|
54
|
+
background-color: var(--selectMenuBgColor);
|
|
55
|
+
.generic-select__menu-list {
|
|
56
|
+
padding: 0px 5px;
|
|
57
|
+
.generic-select__option {
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
line-height: 16.94px;
|
|
61
|
+
text-align: left;
|
|
62
|
+
color: var(--selectOptionTextColor);
|
|
63
|
+
padding: auto 10px;
|
|
64
|
+
border-bottom: 0.5px solid var(--selectOptionBorderColor);
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
&:last-child {
|
|
67
|
+
border: none;
|
|
68
|
+
}
|
|
69
|
+
&.generic-select__option--is-focused {
|
|
70
|
+
background-color: var(--selectOptionFocusedColor);
|
|
71
|
+
color: var(--selectOptionFocusedTextColor);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// react-tooltip
|
|
4
|
+
import { Tooltip } from 'react-tooltip';
|
|
5
|
+
import 'react-tooltip/dist/react-tooltip.css';
|
|
6
|
+
|
|
7
|
+
// styles
|
|
8
|
+
import './styles.scss';
|
|
9
|
+
|
|
10
|
+
interface GeneralTooltipProps {
|
|
11
|
+
anchorSelect: string;
|
|
12
|
+
place: 'top' | 'right' | 'bottom' | 'left';
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const GeneralTooltip: React.FC<GeneralTooltipProps> = ({ anchorSelect, place, title }) => {
|
|
17
|
+
return (
|
|
18
|
+
<Tooltip className="basic-tooltip" anchorSelect={anchorSelect} place={place}>
|
|
19
|
+
{title}
|
|
20
|
+
</Tooltip>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default GeneralTooltip;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
// Toastify
|
|
4
|
+
import {ToastContainer, toast} from 'react-toastify';
|
|
5
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
6
|
+
|
|
7
|
+
//Hooks
|
|
8
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
9
|
+
import { AppDispatch, RootState } from '../../../redux/store';
|
|
10
|
+
|
|
11
|
+
// Actions
|
|
12
|
+
import { closeSnackbar } from '../../../redux/actions/snackbarActions';
|
|
13
|
+
|
|
14
|
+
// Components
|
|
15
|
+
import Typography from '../Typography';
|
|
16
|
+
|
|
17
|
+
// styles
|
|
18
|
+
import './styles.scss'
|
|
19
|
+
|
|
20
|
+
const GenericSnackbar:React.FC = () => {
|
|
21
|
+
const open = useSelector(
|
|
22
|
+
(state: RootState) => state.snackbarReducers.snackbar.open
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const heading = useSelector(
|
|
26
|
+
(state: RootState) => state.snackbarReducers.snackbar.heading
|
|
27
|
+
);
|
|
28
|
+
const message = useSelector(
|
|
29
|
+
(state: RootState) => state.snackbarReducers.snackbar.message
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const dispatch: AppDispatch = useDispatch();
|
|
33
|
+
|
|
34
|
+
const Element = (
|
|
35
|
+
<div className="toast-content">
|
|
36
|
+
<Typography>{heading || ''}</Typography>
|
|
37
|
+
<Typography>{message || ''}</Typography>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const notify = () => toast(Element);
|
|
42
|
+
|
|
43
|
+
useEffect(() =>{
|
|
44
|
+
if(open){
|
|
45
|
+
notify()
|
|
46
|
+
dispatch(closeSnackbar())
|
|
47
|
+
}
|
|
48
|
+
}, [open])
|
|
49
|
+
|
|
50
|
+
return <ToastContainer className="toast-container" toastClassName='basic-toast' bodyClassName="toast-body" hideProgressBar autoClose={3000}/>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default GenericSnackbar;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.toast-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 400px;
|
|
4
|
+
|
|
5
|
+
.basic-toast {
|
|
6
|
+
background-color: #ef7820;
|
|
7
|
+
button {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
svg {
|
|
10
|
+
height: 20px;
|
|
11
|
+
width: 20px;
|
|
12
|
+
fill: #ffffff;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.toast-body {
|
|
16
|
+
.toast-content {
|
|
17
|
+
height: 100%;
|
|
18
|
+
max-height: 50px;
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
gap: 10px;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
p {
|
|
25
|
+
color: #ffffff;
|
|
26
|
+
margin: 0;
|
|
27
|
+
&:first-child {
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/components/Grid.js
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// styled components
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
|
|
7
|
+
interface GridItemProps {
|
|
8
|
+
xs?: number;
|
|
9
|
+
sm?: number;
|
|
10
|
+
md?: number;
|
|
11
|
+
lg?: number;
|
|
12
|
+
xl?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const breakpoints = {
|
|
16
|
+
xs: '0px',
|
|
17
|
+
sm: '600px',
|
|
18
|
+
md: '960px',
|
|
19
|
+
lg: '1280px',
|
|
20
|
+
xl: '1920px',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Container = styled.div`
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
width: 100%;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const Col = styled.div<GridItemProps>`
|
|
30
|
+
padding: 0 8px;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
${(props) =>
|
|
33
|
+
props.xs &&
|
|
34
|
+
`flex: 0 0 ${(props.xs / 12) * 100}%;
|
|
35
|
+
max-width: ${
|
|
36
|
+
(props.xs / 12) * 100
|
|
37
|
+
}%;`}
|
|
38
|
+
@media (min-width: ${breakpoints.sm}) {
|
|
39
|
+
${(props) =>
|
|
40
|
+
props.sm &&
|
|
41
|
+
`flex: 0 0 ${(props.sm / 12) * 100}%;
|
|
42
|
+
max-width: ${
|
|
43
|
+
(props.sm / 12) * 100
|
|
44
|
+
}%;`}
|
|
45
|
+
}
|
|
46
|
+
@media (min-width: ${breakpoints.md}) {
|
|
47
|
+
${(props) =>
|
|
48
|
+
props.md &&
|
|
49
|
+
`flex: 0 0 ${(props.md / 12) * 100}%;
|
|
50
|
+
max-width: ${
|
|
51
|
+
(props.md / 12) * 100
|
|
52
|
+
}%;`}
|
|
53
|
+
}
|
|
54
|
+
@media (min-width: ${breakpoints.lg}) {
|
|
55
|
+
${(props) =>
|
|
56
|
+
props.lg &&
|
|
57
|
+
`flex: 0 0 ${(props.lg / 12) * 100}%;
|
|
58
|
+
max-width: ${
|
|
59
|
+
(props.lg / 12) * 100
|
|
60
|
+
}%;`}
|
|
61
|
+
}
|
|
62
|
+
@media (min-width: ${breakpoints.xl}) {
|
|
63
|
+
${(props) =>
|
|
64
|
+
props.xl &&
|
|
65
|
+
`flex: 0 0 ${(props.xl / 12) * 100}%;
|
|
66
|
+
max-width: ${
|
|
67
|
+
(props.xl / 12) * 100
|
|
68
|
+
}%;`}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
export const GridContainer = ({children, style = {}}: any) => {
|
|
73
|
+
return <Container style={style}>{children}</Container>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const GridItem = ({xs, sm, md, lg, xl, children}: any) => {
|
|
77
|
+
return (
|
|
78
|
+
<Col xs={xs} sm={sm} md={md} lg={lg} xl={xl}>
|
|
79
|
+
{children}
|
|
80
|
+
</Col>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, {ChangeEvent, FC} from 'react';
|
|
2
|
+
|
|
3
|
+
// components
|
|
4
|
+
import Typography from '../Typography';
|
|
5
|
+
|
|
6
|
+
// icon
|
|
7
|
+
import Search from '../../../assets/images/input/search';
|
|
8
|
+
import Cancel from '../../../assets/images/input/cancel';
|
|
9
|
+
|
|
10
|
+
// styles
|
|
11
|
+
import './styles.scss';
|
|
12
|
+
|
|
13
|
+
const errorStyles = {
|
|
14
|
+
color: '#FF0000',
|
|
15
|
+
fontWeight: "400"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
interface InputProps {
|
|
19
|
+
variant?: keyof JSX.IntrinsicElements;
|
|
20
|
+
type: any;
|
|
21
|
+
value: string;
|
|
22
|
+
onChange: (
|
|
23
|
+
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | any>
|
|
24
|
+
) => void;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
inputIcon?: boolean;
|
|
29
|
+
searchApplied?: boolean;
|
|
30
|
+
onClick?: () => void;
|
|
31
|
+
removeSearchInput?: () => void;
|
|
32
|
+
onKeyDown?: () => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Input: FC<InputProps> = ({
|
|
36
|
+
variant = 'input',
|
|
37
|
+
type,
|
|
38
|
+
value,
|
|
39
|
+
onChange,
|
|
40
|
+
placeholder,
|
|
41
|
+
label,
|
|
42
|
+
error,
|
|
43
|
+
inputIcon = false,
|
|
44
|
+
onClick,
|
|
45
|
+
searchApplied,
|
|
46
|
+
removeSearchInput,
|
|
47
|
+
onKeyDown,
|
|
48
|
+
}) => {
|
|
49
|
+
const InputVariant = variant || 'input';
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="input-layout">
|
|
53
|
+
<label className="basic-label">{label ? label : ''}</label>
|
|
54
|
+
<div className={`input-with-icon ${searchApplied && 'focused'}`}>
|
|
55
|
+
<InputVariant
|
|
56
|
+
type={type}
|
|
57
|
+
value={value}
|
|
58
|
+
onChange={onChange}
|
|
59
|
+
placeholder={placeholder}
|
|
60
|
+
className="basic-input"
|
|
61
|
+
onKeyDown={onKeyDown}
|
|
62
|
+
/>
|
|
63
|
+
{inputIcon && (
|
|
64
|
+
<>
|
|
65
|
+
{searchApplied && value.length > 0 ? (
|
|
66
|
+
<div className="cancel-input-button" onClick={removeSearchInput}>
|
|
67
|
+
<Cancel fill="var(--inputSearchIcon)" />
|
|
68
|
+
</div>
|
|
69
|
+
) : null}
|
|
70
|
+
<div
|
|
71
|
+
className="search-input-button"
|
|
72
|
+
onClick={value.length > 0 ? onClick : () => {}}
|
|
73
|
+
>
|
|
74
|
+
<Search fill="#ED5C2F" />
|
|
75
|
+
</div>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
{error && (
|
|
80
|
+
<Typography variant="p" style={errorStyles}>
|
|
81
|
+
<sup>*</sup>
|
|
82
|
+
{error}
|
|
83
|
+
</Typography>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default Input;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.input-layout {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
justify-content: flex-start;
|
|
6
|
+
width: 100%;
|
|
7
|
+
gap: 10px;
|
|
8
|
+
|
|
9
|
+
.basic-label {
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.input-with-icon {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
border: 0.5px solid var(--inputBorderColor);
|
|
19
|
+
border-radius: 7px;
|
|
20
|
+
height: 100%;
|
|
21
|
+
min-height: 55px;
|
|
22
|
+
width: 100%;
|
|
23
|
+
background-color: var(--inputBgColor);
|
|
24
|
+
|
|
25
|
+
.basic-input {
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding: 5px 20px;
|
|
28
|
+
background: transparent;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
font-family: 'Inter', sans-serif !important;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
line-height: 24px;
|
|
33
|
+
color: var(--inputTextColor);
|
|
34
|
+
border: none;
|
|
35
|
+
border-radius: 7px;
|
|
36
|
+
&:focus {
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
&::placeholder {
|
|
40
|
+
opacity: 50%;
|
|
41
|
+
color: var(--inputTextColor);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.search-input-button {
|
|
46
|
+
position: relative;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
&::before {
|
|
51
|
+
content: '';
|
|
52
|
+
position: absolute;
|
|
53
|
+
background-color: #303030;
|
|
54
|
+
height: 100%;
|
|
55
|
+
width: 1px;
|
|
56
|
+
top: 0;
|
|
57
|
+
right: 40px;
|
|
58
|
+
}
|
|
59
|
+
svg {
|
|
60
|
+
margin-right: 10px;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.cancel-input-button {
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
svg {
|
|
70
|
+
width: 15px !important;
|
|
71
|
+
margin-right: 10px;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.focused {
|
|
78
|
+
background-color: var(--inputSearchAppliedBg);
|
|
79
|
+
}
|
|
80
|
+
}
|