react-frontend-common-components 0.0.77 → 0.0.81
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/index.d.ts +7 -5
- package/dist/index.js +13 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +40 -40
- package/rollup.config.js +44 -44
- package/src/components/app-avatar/app-avatar.tsx +24 -24
- package/src/components/app-back-arrow/app-back-arrow.css +17 -17
- package/src/components/app-back-arrow/app-back-arrow.tsx +37 -37
- package/src/components/app-badge/app-badge.css +11 -11
- package/src/components/app-badge/app-badge.tsx +44 -44
- package/src/components/app-bread-crumb/app-bread-crumb.tsx +16 -16
- package/src/components/app-button/app-button.css +13 -13
- package/src/components/app-button/app-button.tsx +51 -51
- package/src/components/app-card/app-card.css +8 -8
- package/src/components/app-card/app-card.tsx +43 -43
- package/src/components/app-carousel/app-carousel.css +68 -68
- package/src/components/app-carousel/app-carousel.tsx +62 -62
- package/src/components/app-chart/app-chart.css +6 -6
- package/src/components/app-chart/app-chart.tsx +98 -98
- package/src/components/app-checkbox-text/app-checkbox-text.css +12 -12
- package/src/components/app-checkbox-text/app-checkbox-text.tsx +32 -32
- package/src/components/app-collapse/app-collapse.tsx +57 -57
- package/src/components/app-custom-loader/app-custom-loader.css +116 -116
- package/src/components/app-custom-loader/app-custom-loader.tsx +23 -23
- package/src/components/app-divider/app-divider.tsx +16 -16
- package/src/components/app-float-button/app-float-button.tsx +23 -23
- package/src/components/app-image-box/app-image-box.css +22 -22
- package/src/components/app-image-box/app-image-box.tsx +42 -42
- package/src/components/app-input/app-input.css +59 -59
- package/src/components/app-input/app-input.tsx +93 -93
- package/src/components/app-label/app-label.css +5 -5
- package/src/components/app-label/app-label.tsx +34 -34
- package/src/components/app-list/app-list.tsx +26 -26
- package/src/components/app-loader/app-loader.css +16 -16
- package/src/components/app-loader/app-loader.tsx +28 -28
- package/src/components/app-location-map/app-location-map.css +4 -4
- package/src/components/app-location-map/app-location-map.tsx +62 -62
- package/src/components/app-modal/app-modal.css +34 -34
- package/src/components/app-modal/app-modal.tsx +61 -61
- package/src/components/app-otp-field/app-otp-field.css +28 -28
- package/src/components/app-otp-field/app-otp-field.tsx +70 -70
- package/src/components/app-pagination/app-pagination.tsx +40 -40
- package/src/components/app-password-input/app-password-input.css +41 -41
- package/src/components/app-password-input/app-password-input.tsx +90 -90
- package/src/components/app-phone-input/app-phone-input.css +12 -12
- package/src/components/app-phone-input/app-phone-input.tsx +56 -56
- package/src/components/app-popover/app-popover.css +5 -5
- package/src/components/app-popover/app-popover.tsx +45 -45
- package/src/components/app-progress/app-progress.tsx +40 -40
- package/src/components/app-radio-group/app-radio-group.css +6 -6
- package/src/components/app-radio-group/app-radio-group.tsx +45 -45
- package/src/components/app-select/app-select.css +33 -33
- package/src/components/app-select/app-select.tsx +90 -59
- package/src/components/app-select-add/app-select-add.css +21 -21
- package/src/components/app-select-add/app-select-add.tsx +34 -34
- package/src/components/app-sidebar/app-sidebar.css +49 -49
- package/src/components/app-sidebar/app-sidebar.tsx +87 -87
- package/src/components/app-tab/app-tab.css +22 -22
- package/src/components/app-tab/app-tab.tsx +31 -31
- package/src/components/app-table/app-table.tsx +42 -42
- package/src/components/app-tag/app-tag.css +11 -11
- package/src/components/app-tag/app-tag.tsx +48 -48
- package/src/components/app-textarea/app-textarea.css +25 -25
- package/src/components/app-textarea/app-textarea.tsx +59 -59
- package/src/components/app-title/app-title.css +12 -12
- package/src/components/app-title/app-title.tsx +28 -28
- package/src/components/app-toggle-button/app-toggle-button.css +27 -27
- package/src/components/app-toggle-button/app-toggle-button.tsx +43 -43
- package/src/components/app-upload-image/app-upload-image.css +26 -26
- package/src/components/app-upload-image/app-upload-image.tsx +90 -90
- package/src/components/over-view-card/over-view-card.css +15 -15
- package/src/components/over-view-card/over-view-card.tsx +26 -26
- package/src/index.ts +38 -38
- package/src/themes/icons/icons.tsx +146 -146
- package/src/themes/images/profile-img.svg +14 -14
- package/tsconfig.json +20 -20
@@ -1,59 +1,59 @@
|
|
1
|
-
.appInput {
|
2
|
-
font-size: var(--font-14);
|
3
|
-
font-weight: 500;
|
4
|
-
.ant-input::placeholder {
|
5
|
-
color: #202123 !important;
|
6
|
-
font-size: 14px;
|
7
|
-
font-weight: 500;
|
8
|
-
line-height: normal;
|
9
|
-
}
|
10
|
-
|
11
|
-
*:focus {
|
12
|
-
outline: 0 !important;
|
13
|
-
box-shadow: unset !important;
|
14
|
-
}
|
15
|
-
&:hover {
|
16
|
-
.ant-input {
|
17
|
-
border-color: #d9d9d9;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
&:has(.ant-input-affix-wrapper) {
|
22
|
-
.ant-input {
|
23
|
-
border: none !important;
|
24
|
-
height: unset !important;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
.ant-input-affix-wrapper {
|
28
|
-
height: 40px;
|
29
|
-
display: flex;
|
30
|
-
align-items: center;
|
31
|
-
.ant-input-outlined:focus-within {
|
32
|
-
box-shadow: unset !important;
|
33
|
-
}
|
34
|
-
|
35
|
-
*:focus {
|
36
|
-
outline: 0 !important;
|
37
|
-
box-shadow: unset !important;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
.ant-input-outlined {
|
41
|
-
height: 40px;
|
42
|
-
&:hover {
|
43
|
-
border-color: #d9d9d9;
|
44
|
-
}
|
45
|
-
&:focus {
|
46
|
-
box-shadow: unset;
|
47
|
-
}
|
48
|
-
&:focus-within {
|
49
|
-
box-shadow: unset;
|
50
|
-
border-color: #d9d9d9;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
.error {
|
56
|
-
color: red;
|
57
|
-
font-size: 0.875rem;
|
58
|
-
margin-top: 0.25rem;
|
59
|
-
}
|
1
|
+
.appInput {
|
2
|
+
font-size: var(--font-14);
|
3
|
+
font-weight: 500;
|
4
|
+
.ant-input::placeholder {
|
5
|
+
color: #202123 !important;
|
6
|
+
font-size: 14px;
|
7
|
+
font-weight: 500;
|
8
|
+
line-height: normal;
|
9
|
+
}
|
10
|
+
|
11
|
+
*:focus {
|
12
|
+
outline: 0 !important;
|
13
|
+
box-shadow: unset !important;
|
14
|
+
}
|
15
|
+
&:hover {
|
16
|
+
.ant-input {
|
17
|
+
border-color: #d9d9d9;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
&:has(.ant-input-affix-wrapper) {
|
22
|
+
.ant-input {
|
23
|
+
border: none !important;
|
24
|
+
height: unset !important;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
.ant-input-affix-wrapper {
|
28
|
+
height: 40px;
|
29
|
+
display: flex;
|
30
|
+
align-items: center;
|
31
|
+
.ant-input-outlined:focus-within {
|
32
|
+
box-shadow: unset !important;
|
33
|
+
}
|
34
|
+
|
35
|
+
*:focus {
|
36
|
+
outline: 0 !important;
|
37
|
+
box-shadow: unset !important;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
.ant-input-outlined {
|
41
|
+
height: 40px;
|
42
|
+
&:hover {
|
43
|
+
border-color: #d9d9d9;
|
44
|
+
}
|
45
|
+
&:focus {
|
46
|
+
box-shadow: unset;
|
47
|
+
}
|
48
|
+
&:focus-within {
|
49
|
+
box-shadow: unset;
|
50
|
+
border-color: #d9d9d9;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
.error {
|
56
|
+
color: red;
|
57
|
+
font-size: 0.875rem;
|
58
|
+
margin-top: 0.25rem;
|
59
|
+
}
|
@@ -1,93 +1,93 @@
|
|
1
|
-
"use client";
|
2
|
-
|
3
|
-
import { Input, InputProps, InputRef } from "antd";
|
4
|
-
import {
|
5
|
-
ChangeEventHandler,
|
6
|
-
KeyboardEventHandler,
|
7
|
-
MouseEventHandler,
|
8
|
-
useEffect,
|
9
|
-
useRef,
|
10
|
-
} from "react";
|
11
|
-
import "./app-input.css";
|
12
|
-
|
13
|
-
interface AppInputProps extends InputProps {
|
14
|
-
className?: string;
|
15
|
-
label?: string;
|
16
|
-
name?: string;
|
17
|
-
value?: string;
|
18
|
-
dataTestId?: string;
|
19
|
-
id?: string;
|
20
|
-
disabled?: boolean;
|
21
|
-
handleChange?: ChangeEventHandler<HTMLInputElement>;
|
22
|
-
onClick?: MouseEventHandler<HTMLElement>;
|
23
|
-
onPressEnter?: KeyboardEventHandler<HTMLInputElement>;
|
24
|
-
defaultValue?: string;
|
25
|
-
isAutoFocus?: boolean;
|
26
|
-
triggerFocus?: boolean;
|
27
|
-
type?: string;
|
28
|
-
isOptional?: boolean;
|
29
|
-
errorMessage?: string;
|
30
|
-
suffixIcon?: React.ReactNode;
|
31
|
-
prefixIcon?: React.ReactNode;
|
32
|
-
required?:boolean;
|
33
|
-
}
|
34
|
-
|
35
|
-
const AppInput = ({
|
36
|
-
className,
|
37
|
-
label,
|
38
|
-
name,
|
39
|
-
value,
|
40
|
-
dataTestId,
|
41
|
-
type,
|
42
|
-
id,
|
43
|
-
disabled,
|
44
|
-
handleChange,
|
45
|
-
onClick,
|
46
|
-
defaultValue,
|
47
|
-
onPressEnter,
|
48
|
-
isAutoFocus,
|
49
|
-
triggerFocus,
|
50
|
-
isOptional,
|
51
|
-
errorMessage,
|
52
|
-
suffixIcon,
|
53
|
-
prefixIcon,
|
54
|
-
required,
|
55
|
-
...props
|
56
|
-
}: AppInputProps) => {
|
57
|
-
const inputRef = useRef<InputRef>(null);
|
58
|
-
|
59
|
-
useEffect(() => {
|
60
|
-
if (isAutoFocus && inputRef.current) {
|
61
|
-
inputRef.current.focus();
|
62
|
-
}
|
63
|
-
}, [triggerFocus, isAutoFocus]);
|
64
|
-
|
65
|
-
const placeholder = isOptional ? `${label} (optional)` : label;
|
66
|
-
|
67
|
-
return (
|
68
|
-
<div className={`appInput ${className}`}>
|
69
|
-
<Input
|
70
|
-
type={type}
|
71
|
-
data-test-id={dataTestId}
|
72
|
-
id={id}
|
73
|
-
disabled={disabled}
|
74
|
-
name={name}
|
75
|
-
className={"input"}
|
76
|
-
value={value}
|
77
|
-
onChange={handleChange}
|
78
|
-
onClick={onClick}
|
79
|
-
defaultValue={defaultValue}
|
80
|
-
onPressEnter={onPressEnter}
|
81
|
-
placeholder={`${required ? placeholder + " (required)" : placeholder}`}
|
82
|
-
ref={inputRef}
|
83
|
-
prefix={prefixIcon && prefixIcon}
|
84
|
-
suffix={suffixIcon && suffixIcon}
|
85
|
-
{...props}
|
86
|
-
/>
|
87
|
-
|
88
|
-
{errorMessage && <div className={"error"}>{errorMessage}</div>}
|
89
|
-
</div>
|
90
|
-
);
|
91
|
-
};
|
92
|
-
|
93
|
-
export default AppInput;
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
import { Input, InputProps, InputRef } from "antd";
|
4
|
+
import {
|
5
|
+
ChangeEventHandler,
|
6
|
+
KeyboardEventHandler,
|
7
|
+
MouseEventHandler,
|
8
|
+
useEffect,
|
9
|
+
useRef,
|
10
|
+
} from "react";
|
11
|
+
import "./app-input.css";
|
12
|
+
|
13
|
+
interface AppInputProps extends InputProps {
|
14
|
+
className?: string;
|
15
|
+
label?: string;
|
16
|
+
name?: string;
|
17
|
+
value?: string;
|
18
|
+
dataTestId?: string;
|
19
|
+
id?: string;
|
20
|
+
disabled?: boolean;
|
21
|
+
handleChange?: ChangeEventHandler<HTMLInputElement>;
|
22
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
23
|
+
onPressEnter?: KeyboardEventHandler<HTMLInputElement>;
|
24
|
+
defaultValue?: string;
|
25
|
+
isAutoFocus?: boolean;
|
26
|
+
triggerFocus?: boolean;
|
27
|
+
type?: string;
|
28
|
+
isOptional?: boolean;
|
29
|
+
errorMessage?: string;
|
30
|
+
suffixIcon?: React.ReactNode;
|
31
|
+
prefixIcon?: React.ReactNode;
|
32
|
+
required?:boolean;
|
33
|
+
}
|
34
|
+
|
35
|
+
const AppInput = ({
|
36
|
+
className,
|
37
|
+
label,
|
38
|
+
name,
|
39
|
+
value,
|
40
|
+
dataTestId,
|
41
|
+
type,
|
42
|
+
id,
|
43
|
+
disabled,
|
44
|
+
handleChange,
|
45
|
+
onClick,
|
46
|
+
defaultValue,
|
47
|
+
onPressEnter,
|
48
|
+
isAutoFocus,
|
49
|
+
triggerFocus,
|
50
|
+
isOptional,
|
51
|
+
errorMessage,
|
52
|
+
suffixIcon,
|
53
|
+
prefixIcon,
|
54
|
+
required,
|
55
|
+
...props
|
56
|
+
}: AppInputProps) => {
|
57
|
+
const inputRef = useRef<InputRef>(null);
|
58
|
+
|
59
|
+
useEffect(() => {
|
60
|
+
if (isAutoFocus && inputRef.current) {
|
61
|
+
inputRef.current.focus();
|
62
|
+
}
|
63
|
+
}, [triggerFocus, isAutoFocus]);
|
64
|
+
|
65
|
+
const placeholder = isOptional ? `${label} (optional)` : label;
|
66
|
+
|
67
|
+
return (
|
68
|
+
<div className={`appInput ${className}`}>
|
69
|
+
<Input
|
70
|
+
type={type}
|
71
|
+
data-test-id={dataTestId}
|
72
|
+
id={id}
|
73
|
+
disabled={disabled}
|
74
|
+
name={name}
|
75
|
+
className={"input"}
|
76
|
+
value={value}
|
77
|
+
onChange={handleChange}
|
78
|
+
onClick={onClick}
|
79
|
+
defaultValue={defaultValue}
|
80
|
+
onPressEnter={onPressEnter}
|
81
|
+
placeholder={`${required ? placeholder + " (required)" : placeholder}`}
|
82
|
+
ref={inputRef}
|
83
|
+
prefix={prefixIcon && prefixIcon}
|
84
|
+
suffix={suffixIcon && suffixIcon}
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
|
88
|
+
{errorMessage && <div className={"error"}>{errorMessage}</div>}
|
89
|
+
</div>
|
90
|
+
);
|
91
|
+
};
|
92
|
+
|
93
|
+
export default AppInput;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
.label {
|
2
|
-
display: inline-block;
|
3
|
-
font-weight: 500;
|
4
|
-
margin-bottom: 0.5rem;
|
5
|
-
}
|
1
|
+
.label {
|
2
|
+
display: inline-block;
|
3
|
+
font-weight: 500;
|
4
|
+
margin-bottom: 0.5rem;
|
5
|
+
}
|
@@ -1,34 +1,34 @@
|
|
1
|
-
import "./app-label.css";
|
2
|
-
|
3
|
-
interface AppLabelProps {
|
4
|
-
text: string;
|
5
|
-
htmlFor?: string;
|
6
|
-
color?: string;
|
7
|
-
fontSize?: string;
|
8
|
-
className?: string;
|
9
|
-
}
|
10
|
-
|
11
|
-
const AppLabel = ({
|
12
|
-
text,
|
13
|
-
htmlFor,
|
14
|
-
color = "inherit",
|
15
|
-
fontSize = "inherit",
|
16
|
-
className,
|
17
|
-
}: AppLabelProps) => {
|
18
|
-
const labelStyle = {
|
19
|
-
color,
|
20
|
-
fontSize,
|
21
|
-
};
|
22
|
-
|
23
|
-
return (
|
24
|
-
<label
|
25
|
-
htmlFor={htmlFor}
|
26
|
-
className={`label ${className}`}
|
27
|
-
style={labelStyle}
|
28
|
-
>
|
29
|
-
{text}
|
30
|
-
</label>
|
31
|
-
);
|
32
|
-
};
|
33
|
-
|
34
|
-
export default AppLabel;
|
1
|
+
import "./app-label.css";
|
2
|
+
|
3
|
+
interface AppLabelProps {
|
4
|
+
text: string;
|
5
|
+
htmlFor?: string;
|
6
|
+
color?: string;
|
7
|
+
fontSize?: string;
|
8
|
+
className?: string;
|
9
|
+
}
|
10
|
+
|
11
|
+
const AppLabel = ({
|
12
|
+
text,
|
13
|
+
htmlFor,
|
14
|
+
color = "inherit",
|
15
|
+
fontSize = "inherit",
|
16
|
+
className,
|
17
|
+
}: AppLabelProps) => {
|
18
|
+
const labelStyle = {
|
19
|
+
color,
|
20
|
+
fontSize,
|
21
|
+
};
|
22
|
+
|
23
|
+
return (
|
24
|
+
<label
|
25
|
+
htmlFor={htmlFor}
|
26
|
+
className={`label ${className}`}
|
27
|
+
style={labelStyle}
|
28
|
+
>
|
29
|
+
{text}
|
30
|
+
</label>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
export default AppLabel;
|
@@ -1,26 +1,26 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { List, ListProps } from "antd";
|
3
|
-
|
4
|
-
interface AppListProps<T> extends ListProps<T> {
|
5
|
-
renderItem: (item: T, index: number) => React.ReactNode;
|
6
|
-
className?: string;
|
7
|
-
}
|
8
|
-
|
9
|
-
const AppList = <T extends unknown>({
|
10
|
-
renderItem,
|
11
|
-
dataSource,
|
12
|
-
className,
|
13
|
-
...props
|
14
|
-
}: AppListProps<T>) => {
|
15
|
-
return (
|
16
|
-
<div className={className}>
|
17
|
-
<List
|
18
|
-
dataSource={dataSource}
|
19
|
-
renderItem={(item, index) => renderItem(item, index)}
|
20
|
-
{...props}
|
21
|
-
/>
|
22
|
-
</div>
|
23
|
-
);
|
24
|
-
};
|
25
|
-
|
26
|
-
export default AppList;
|
1
|
+
import React from "react";
|
2
|
+
import { List, ListProps } from "antd";
|
3
|
+
|
4
|
+
interface AppListProps<T> extends ListProps<T> {
|
5
|
+
renderItem: (item: T, index: number) => React.ReactNode;
|
6
|
+
className?: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
const AppList = <T extends unknown>({
|
10
|
+
renderItem,
|
11
|
+
dataSource,
|
12
|
+
className,
|
13
|
+
...props
|
14
|
+
}: AppListProps<T>) => {
|
15
|
+
return (
|
16
|
+
<div className={className}>
|
17
|
+
<List
|
18
|
+
dataSource={dataSource}
|
19
|
+
renderItem={(item, index) => renderItem(item, index)}
|
20
|
+
{...props}
|
21
|
+
/>
|
22
|
+
</div>
|
23
|
+
);
|
24
|
+
};
|
25
|
+
|
26
|
+
export default AppList;
|
@@ -1,16 +1,16 @@
|
|
1
|
-
.loader {
|
2
|
-
width: 100vw;
|
3
|
-
height: 100vh;
|
4
|
-
display: grid;
|
5
|
-
place-items: center;
|
6
|
-
|
7
|
-
position: fixed;
|
8
|
-
top: 0;
|
9
|
-
left: 0;
|
10
|
-
background-color: (0, 0, 0, 0.3);
|
11
|
-
backdrop-filter: blur(10px);
|
12
|
-
z-index: 99;
|
13
|
-
* {
|
14
|
-
transform: scale(1.5);
|
15
|
-
}
|
16
|
-
}
|
1
|
+
.loader {
|
2
|
+
width: 100vw;
|
3
|
+
height: 100vh;
|
4
|
+
display: grid;
|
5
|
+
place-items: center;
|
6
|
+
|
7
|
+
position: fixed;
|
8
|
+
top: 0;
|
9
|
+
left: 0;
|
10
|
+
background-color: (0, 0, 0, 0.3);
|
11
|
+
backdrop-filter: blur(10px);
|
12
|
+
z-index: 99;
|
13
|
+
* {
|
14
|
+
transform: scale(1.5);
|
15
|
+
}
|
16
|
+
}
|
@@ -1,28 +1,28 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { Spin, Skeleton } from "antd";
|
3
|
-
import "./app-loader.css";
|
4
|
-
|
5
|
-
type LoaderType = "spinner" | "skeleton" | "custom";
|
6
|
-
|
7
|
-
interface AppLoaderProps {
|
8
|
-
type?: LoaderType;
|
9
|
-
customLoader?: React.ReactNode;
|
10
|
-
className?: string;
|
11
|
-
}
|
12
|
-
|
13
|
-
const AppLoader = ({ type, customLoader, className }: AppLoaderProps) => {
|
14
|
-
const loaderType: LoaderType = customLoader ? "custom" : type || "spinner";
|
15
|
-
|
16
|
-
switch (loaderType) {
|
17
|
-
case "spinner":
|
18
|
-
return <Spin className={`loader ${className}`} />;
|
19
|
-
case "skeleton":
|
20
|
-
return <Skeleton active className={`loader ${className}`} />;
|
21
|
-
case "custom":
|
22
|
-
return customLoader || <Spin className={`loader ${className}`} />;
|
23
|
-
default:
|
24
|
-
return <Spin className={`loader ${className}`} />;
|
25
|
-
}
|
26
|
-
};
|
27
|
-
|
28
|
-
export default AppLoader;
|
1
|
+
import React from "react";
|
2
|
+
import { Spin, Skeleton } from "antd";
|
3
|
+
import "./app-loader.css";
|
4
|
+
|
5
|
+
type LoaderType = "spinner" | "skeleton" | "custom";
|
6
|
+
|
7
|
+
interface AppLoaderProps {
|
8
|
+
type?: LoaderType;
|
9
|
+
customLoader?: React.ReactNode;
|
10
|
+
className?: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
const AppLoader = ({ type, customLoader, className }: AppLoaderProps) => {
|
14
|
+
const loaderType: LoaderType = customLoader ? "custom" : type || "spinner";
|
15
|
+
|
16
|
+
switch (loaderType) {
|
17
|
+
case "spinner":
|
18
|
+
return <Spin className={`loader ${className}`} />;
|
19
|
+
case "skeleton":
|
20
|
+
return <Skeleton active className={`loader ${className}`} />;
|
21
|
+
case "custom":
|
22
|
+
return customLoader || <Spin className={`loader ${className}`} />;
|
23
|
+
default:
|
24
|
+
return <Spin className={`loader ${className}`} />;
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
export default AppLoader;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.appLocationMap {
|
2
|
-
width: max-content;
|
3
|
-
height: max-content;
|
4
|
-
}
|
1
|
+
.appLocationMap {
|
2
|
+
width: max-content;
|
3
|
+
height: max-content;
|
4
|
+
}
|
@@ -1,62 +1,62 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
2
|
-
import { GoogleMap, LoadScript } from "@react-google-maps/api";
|
3
|
-
import "./app-location-map.css";
|
4
|
-
|
5
|
-
interface LatLng {
|
6
|
-
lat: number;
|
7
|
-
lng: number;
|
8
|
-
}
|
9
|
-
|
10
|
-
interface LocationMapProps {
|
11
|
-
cityId?: LatLng;
|
12
|
-
className?: string;
|
13
|
-
containerStyle?: React.CSSProperties;
|
14
|
-
clickableIcons?: boolean;
|
15
|
-
zoom?: number;
|
16
|
-
mapKey: string;
|
17
|
-
}
|
18
|
-
|
19
|
-
const AppLocationMap = ({
|
20
|
-
cityId,
|
21
|
-
className,
|
22
|
-
containerStyle,
|
23
|
-
clickableIcons,
|
24
|
-
zoom = 10,
|
25
|
-
mapKey,
|
26
|
-
}: LocationMapProps) => {
|
27
|
-
const [center, setCenter] = useState<LatLng | null>(null);
|
28
|
-
|
29
|
-
useEffect(() => {
|
30
|
-
if (cityId) {
|
31
|
-
setCenter(cityId);
|
32
|
-
} else {
|
33
|
-
if (navigator.geolocation) {
|
34
|
-
navigator.geolocation.getCurrentPosition((position) => {
|
35
|
-
setCenter({
|
36
|
-
lat: position.coords.latitude,
|
37
|
-
lng: position.coords.longitude,
|
38
|
-
});
|
39
|
-
});
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}, [cityId]);
|
43
|
-
|
44
|
-
return (
|
45
|
-
<div className={`appLocationMap ${className}`}>
|
46
|
-
<LoadScript googleMapsApiKey={mapKey}>
|
47
|
-
<div style={containerStyle}>
|
48
|
-
{center && (
|
49
|
-
<GoogleMap
|
50
|
-
mapContainerStyle={containerStyle}
|
51
|
-
center={center}
|
52
|
-
clickableIcons={clickableIcons}
|
53
|
-
zoom={zoom}
|
54
|
-
/>
|
55
|
-
)}
|
56
|
-
</div>
|
57
|
-
</LoadScript>
|
58
|
-
</div>
|
59
|
-
);
|
60
|
-
};
|
61
|
-
|
62
|
-
export default AppLocationMap;
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import { GoogleMap, LoadScript } from "@react-google-maps/api";
|
3
|
+
import "./app-location-map.css";
|
4
|
+
|
5
|
+
interface LatLng {
|
6
|
+
lat: number;
|
7
|
+
lng: number;
|
8
|
+
}
|
9
|
+
|
10
|
+
interface LocationMapProps {
|
11
|
+
cityId?: LatLng;
|
12
|
+
className?: string;
|
13
|
+
containerStyle?: React.CSSProperties;
|
14
|
+
clickableIcons?: boolean;
|
15
|
+
zoom?: number;
|
16
|
+
mapKey: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const AppLocationMap = ({
|
20
|
+
cityId,
|
21
|
+
className,
|
22
|
+
containerStyle,
|
23
|
+
clickableIcons,
|
24
|
+
zoom = 10,
|
25
|
+
mapKey,
|
26
|
+
}: LocationMapProps) => {
|
27
|
+
const [center, setCenter] = useState<LatLng | null>(null);
|
28
|
+
|
29
|
+
useEffect(() => {
|
30
|
+
if (cityId) {
|
31
|
+
setCenter(cityId);
|
32
|
+
} else {
|
33
|
+
if (navigator.geolocation) {
|
34
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
35
|
+
setCenter({
|
36
|
+
lat: position.coords.latitude,
|
37
|
+
lng: position.coords.longitude,
|
38
|
+
});
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}, [cityId]);
|
43
|
+
|
44
|
+
return (
|
45
|
+
<div className={`appLocationMap ${className}`}>
|
46
|
+
<LoadScript googleMapsApiKey={mapKey}>
|
47
|
+
<div style={containerStyle}>
|
48
|
+
{center && (
|
49
|
+
<GoogleMap
|
50
|
+
mapContainerStyle={containerStyle}
|
51
|
+
center={center}
|
52
|
+
clickableIcons={clickableIcons}
|
53
|
+
zoom={zoom}
|
54
|
+
/>
|
55
|
+
)}
|
56
|
+
</div>
|
57
|
+
</LoadScript>
|
58
|
+
</div>
|
59
|
+
);
|
60
|
+
};
|
61
|
+
|
62
|
+
export default AppLocationMap;
|