react-frontend-common-components 0.0.77 → 0.0.79
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,42 +1,42 @@
|
|
1
|
-
import { Table, TableProps } from "antd";
|
2
|
-
import { ColumnsType } from "antd/lib/table";
|
3
|
-
|
4
|
-
interface AppTableProps<T> extends TableProps<T> {
|
5
|
-
columns: ColumnsType<T>;
|
6
|
-
dataSource: T[];
|
7
|
-
rowKey?: string;
|
8
|
-
bordered?: boolean;
|
9
|
-
pagination?: TableProps<T>["pagination"];
|
10
|
-
size?: "small" | "middle" | "large";
|
11
|
-
scroll?: TableProps<T>["scroll"];
|
12
|
-
className?: string;
|
13
|
-
}
|
14
|
-
|
15
|
-
const AppTable = <T extends object>({
|
16
|
-
columns,
|
17
|
-
dataSource,
|
18
|
-
rowKey,
|
19
|
-
bordered = false,
|
20
|
-
pagination = { pageSize: 10 },
|
21
|
-
size = "middle",
|
22
|
-
scroll,
|
23
|
-
className,
|
24
|
-
...tableProps
|
25
|
-
}: AppTableProps<T>) => {
|
26
|
-
return (
|
27
|
-
<div className={className}>
|
28
|
-
<Table
|
29
|
-
columns={columns}
|
30
|
-
dataSource={dataSource}
|
31
|
-
rowKey={rowKey}
|
32
|
-
bordered={bordered}
|
33
|
-
pagination={pagination}
|
34
|
-
size={size}
|
35
|
-
scroll={scroll}
|
36
|
-
{...tableProps}
|
37
|
-
/>
|
38
|
-
</div>
|
39
|
-
);
|
40
|
-
};
|
41
|
-
|
42
|
-
export default AppTable;
|
1
|
+
import { Table, TableProps } from "antd";
|
2
|
+
import { ColumnsType } from "antd/lib/table";
|
3
|
+
|
4
|
+
interface AppTableProps<T> extends TableProps<T> {
|
5
|
+
columns: ColumnsType<T>;
|
6
|
+
dataSource: T[];
|
7
|
+
rowKey?: string;
|
8
|
+
bordered?: boolean;
|
9
|
+
pagination?: TableProps<T>["pagination"];
|
10
|
+
size?: "small" | "middle" | "large";
|
11
|
+
scroll?: TableProps<T>["scroll"];
|
12
|
+
className?: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
const AppTable = <T extends object>({
|
16
|
+
columns,
|
17
|
+
dataSource,
|
18
|
+
rowKey,
|
19
|
+
bordered = false,
|
20
|
+
pagination = { pageSize: 10 },
|
21
|
+
size = "middle",
|
22
|
+
scroll,
|
23
|
+
className,
|
24
|
+
...tableProps
|
25
|
+
}: AppTableProps<T>) => {
|
26
|
+
return (
|
27
|
+
<div className={className}>
|
28
|
+
<Table
|
29
|
+
columns={columns}
|
30
|
+
dataSource={dataSource}
|
31
|
+
rowKey={rowKey}
|
32
|
+
bordered={bordered}
|
33
|
+
pagination={pagination}
|
34
|
+
size={size}
|
35
|
+
scroll={scroll}
|
36
|
+
{...tableProps}
|
37
|
+
/>
|
38
|
+
</div>
|
39
|
+
);
|
40
|
+
};
|
41
|
+
|
42
|
+
export default AppTable;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
.appTab {
|
2
|
-
width: max-content;
|
3
|
-
.ant-tag {
|
4
|
-
display: flex;
|
5
|
-
align-items: center;
|
6
|
-
margin: 0;
|
7
|
-
border-radius: 8px;
|
8
|
-
padding: 4px 8px;
|
9
|
-
line-height: normal;
|
10
|
-
}
|
11
|
-
}
|
1
|
+
.appTab {
|
2
|
+
width: max-content;
|
3
|
+
.ant-tag {
|
4
|
+
display: flex;
|
5
|
+
align-items: center;
|
6
|
+
margin: 0;
|
7
|
+
border-radius: 8px;
|
8
|
+
padding: 4px 8px;
|
9
|
+
line-height: normal;
|
10
|
+
}
|
11
|
+
}
|
@@ -1,48 +1,48 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Tag } from "antd";
|
3
|
-
import "./app-tag.css";
|
4
|
-
|
5
|
-
interface AppTagProps {
|
6
|
-
color?: string;
|
7
|
-
closable?: boolean;
|
8
|
-
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
9
|
-
style?: React.CSSProperties;
|
10
|
-
className?: string;
|
11
|
-
children: React.ReactNode;
|
12
|
-
closeIcon?: React.ReactNode;
|
13
|
-
}
|
14
|
-
|
15
|
-
const AppTag = ({
|
16
|
-
color,
|
17
|
-
closable = false,
|
18
|
-
onClick,
|
19
|
-
style,
|
20
|
-
className,
|
21
|
-
children,
|
22
|
-
closeIcon,
|
23
|
-
}: AppTagProps) => {
|
24
|
-
const [visible, setVisible] = useState(true);
|
25
|
-
|
26
|
-
const handleClose = () => {
|
27
|
-
setVisible(false);
|
28
|
-
};
|
29
|
-
|
30
|
-
if (!visible) return null;
|
31
|
-
|
32
|
-
return (
|
33
|
-
<div className={`appTab ${className}`}>
|
34
|
-
<Tag
|
35
|
-
color={color}
|
36
|
-
closable={closable}
|
37
|
-
onClose={handleClose}
|
38
|
-
onClick={onClick}
|
39
|
-
style={style}
|
40
|
-
closeIcon={closeIcon}
|
41
|
-
>
|
42
|
-
{children}
|
43
|
-
</Tag>
|
44
|
-
</div>
|
45
|
-
);
|
46
|
-
};
|
47
|
-
|
48
|
-
export default AppTag;
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Tag } from "antd";
|
3
|
+
import "./app-tag.css";
|
4
|
+
|
5
|
+
interface AppTagProps {
|
6
|
+
color?: string;
|
7
|
+
closable?: boolean;
|
8
|
+
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
9
|
+
style?: React.CSSProperties;
|
10
|
+
className?: string;
|
11
|
+
children: React.ReactNode;
|
12
|
+
closeIcon?: React.ReactNode;
|
13
|
+
}
|
14
|
+
|
15
|
+
const AppTag = ({
|
16
|
+
color,
|
17
|
+
closable = false,
|
18
|
+
onClick,
|
19
|
+
style,
|
20
|
+
className,
|
21
|
+
children,
|
22
|
+
closeIcon,
|
23
|
+
}: AppTagProps) => {
|
24
|
+
const [visible, setVisible] = useState(true);
|
25
|
+
|
26
|
+
const handleClose = () => {
|
27
|
+
setVisible(false);
|
28
|
+
};
|
29
|
+
|
30
|
+
if (!visible) return null;
|
31
|
+
|
32
|
+
return (
|
33
|
+
<div className={`appTab ${className}`}>
|
34
|
+
<Tag
|
35
|
+
color={color}
|
36
|
+
closable={closable}
|
37
|
+
onClose={handleClose}
|
38
|
+
onClick={onClick}
|
39
|
+
style={style}
|
40
|
+
closeIcon={closeIcon}
|
41
|
+
>
|
42
|
+
{children}
|
43
|
+
</Tag>
|
44
|
+
</div>
|
45
|
+
);
|
46
|
+
};
|
47
|
+
|
48
|
+
export default AppTag;
|
@@ -1,25 +1,25 @@
|
|
1
|
-
.appTextArea {
|
2
|
-
.ant-input-outlined {
|
3
|
-
border-color: #bfbebe;
|
4
|
-
&:hover {
|
5
|
-
border-color: #bfbebe;
|
6
|
-
}
|
7
|
-
}
|
8
|
-
.ant-input::placeholder {
|
9
|
-
color: #202123 !important;
|
10
|
-
font-size: 14px;
|
11
|
-
font-weight: 500;
|
12
|
-
line-height: normal;
|
13
|
-
}
|
14
|
-
|
15
|
-
*:focus {
|
16
|
-
outline: 0 !important;
|
17
|
-
box-shadow: unset !important;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
.error {
|
22
|
-
color: red;
|
23
|
-
font-size: 0.875rem;
|
24
|
-
margin-top: 0.25rem;
|
25
|
-
}
|
1
|
+
.appTextArea {
|
2
|
+
.ant-input-outlined {
|
3
|
+
border-color: #bfbebe;
|
4
|
+
&:hover {
|
5
|
+
border-color: #bfbebe;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
.ant-input::placeholder {
|
9
|
+
color: #202123 !important;
|
10
|
+
font-size: 14px;
|
11
|
+
font-weight: 500;
|
12
|
+
line-height: normal;
|
13
|
+
}
|
14
|
+
|
15
|
+
*:focus {
|
16
|
+
outline: 0 !important;
|
17
|
+
box-shadow: unset !important;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.error {
|
22
|
+
color: red;
|
23
|
+
font-size: 0.875rem;
|
24
|
+
margin-top: 0.25rem;
|
25
|
+
}
|
@@ -1,59 +1,59 @@
|
|
1
|
-
import { Input } from "antd";
|
2
|
-
import { ChangeEventHandler, KeyboardEventHandler } from "react";
|
3
|
-
import "./app-textarea.css";
|
4
|
-
|
5
|
-
interface textAreaProps {
|
6
|
-
id?: string;
|
7
|
-
label?: string;
|
8
|
-
name?: string;
|
9
|
-
value?: string;
|
10
|
-
dataTestId?: string;
|
11
|
-
defaultValue?: string;
|
12
|
-
onPressEnter?: KeyboardEventHandler<HTMLTextAreaElement>;
|
13
|
-
handleChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
14
|
-
autoSize?: {
|
15
|
-
minRows?: number;
|
16
|
-
maxRows?: number;
|
17
|
-
};
|
18
|
-
rows?: number;
|
19
|
-
cols?: number;
|
20
|
-
placeholder?: string;
|
21
|
-
className?: string;
|
22
|
-
error?: string;
|
23
|
-
}
|
24
|
-
|
25
|
-
const AppTextarea = ({
|
26
|
-
id,
|
27
|
-
placeholder,
|
28
|
-
name,
|
29
|
-
value,
|
30
|
-
dataTestId,
|
31
|
-
defaultValue,
|
32
|
-
onPressEnter,
|
33
|
-
handleChange,
|
34
|
-
rows,
|
35
|
-
cols,
|
36
|
-
className,
|
37
|
-
error,
|
38
|
-
}: textAreaProps) => {
|
39
|
-
return (
|
40
|
-
<div className={`appTextArea ${className}`}>
|
41
|
-
<Input.TextArea
|
42
|
-
data-test-id={dataTestId}
|
43
|
-
id={id}
|
44
|
-
name={name}
|
45
|
-
placeholder={placeholder}
|
46
|
-
value={value}
|
47
|
-
className={"textArea"}
|
48
|
-
onChange={handleChange}
|
49
|
-
defaultValue={defaultValue}
|
50
|
-
onPressEnter={onPressEnter}
|
51
|
-
rows={rows}
|
52
|
-
cols={cols}
|
53
|
-
/>
|
54
|
-
{error && <div className={"error"}>{error}</div>}
|
55
|
-
</div>
|
56
|
-
);
|
57
|
-
};
|
58
|
-
|
59
|
-
export default AppTextarea;
|
1
|
+
import { Input } from "antd";
|
2
|
+
import { ChangeEventHandler, KeyboardEventHandler } from "react";
|
3
|
+
import "./app-textarea.css";
|
4
|
+
|
5
|
+
interface textAreaProps {
|
6
|
+
id?: string;
|
7
|
+
label?: string;
|
8
|
+
name?: string;
|
9
|
+
value?: string;
|
10
|
+
dataTestId?: string;
|
11
|
+
defaultValue?: string;
|
12
|
+
onPressEnter?: KeyboardEventHandler<HTMLTextAreaElement>;
|
13
|
+
handleChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
14
|
+
autoSize?: {
|
15
|
+
minRows?: number;
|
16
|
+
maxRows?: number;
|
17
|
+
};
|
18
|
+
rows?: number;
|
19
|
+
cols?: number;
|
20
|
+
placeholder?: string;
|
21
|
+
className?: string;
|
22
|
+
error?: string;
|
23
|
+
}
|
24
|
+
|
25
|
+
const AppTextarea = ({
|
26
|
+
id,
|
27
|
+
placeholder,
|
28
|
+
name,
|
29
|
+
value,
|
30
|
+
dataTestId,
|
31
|
+
defaultValue,
|
32
|
+
onPressEnter,
|
33
|
+
handleChange,
|
34
|
+
rows,
|
35
|
+
cols,
|
36
|
+
className,
|
37
|
+
error,
|
38
|
+
}: textAreaProps) => {
|
39
|
+
return (
|
40
|
+
<div className={`appTextArea ${className}`}>
|
41
|
+
<Input.TextArea
|
42
|
+
data-test-id={dataTestId}
|
43
|
+
id={id}
|
44
|
+
name={name}
|
45
|
+
placeholder={placeholder}
|
46
|
+
value={value}
|
47
|
+
className={"textArea"}
|
48
|
+
onChange={handleChange}
|
49
|
+
defaultValue={defaultValue}
|
50
|
+
onPressEnter={onPressEnter}
|
51
|
+
rows={rows}
|
52
|
+
cols={cols}
|
53
|
+
/>
|
54
|
+
{error && <div className={"error"}>{error}</div>}
|
55
|
+
</div>
|
56
|
+
);
|
57
|
+
};
|
58
|
+
|
59
|
+
export default AppTextarea;
|
@@ -1,12 +1,12 @@
|
|
1
|
-
.titleComponent {
|
2
|
-
span {
|
3
|
-
color: #000;
|
4
|
-
text-align: center;
|
5
|
-
font-style: normal;
|
6
|
-
font-weight: 400;
|
7
|
-
line-height: normal;
|
8
|
-
}
|
9
|
-
.subText {
|
10
|
-
font-size: 1rem !important;
|
11
|
-
}
|
12
|
-
}
|
1
|
+
.titleComponent {
|
2
|
+
span {
|
3
|
+
color: #000;
|
4
|
+
text-align: center;
|
5
|
+
font-style: normal;
|
6
|
+
font-weight: 400;
|
7
|
+
line-height: normal;
|
8
|
+
}
|
9
|
+
.subText {
|
10
|
+
font-size: 1rem !important;
|
11
|
+
}
|
12
|
+
}
|
@@ -1,28 +1,28 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { Typography } from "antd";
|
3
|
-
import "./app-title.css";
|
4
|
-
|
5
|
-
const { Title, Text } = Typography;
|
6
|
-
|
7
|
-
interface TitleProps {
|
8
|
-
mainText: React.ReactNode;
|
9
|
-
className?: string;
|
10
|
-
subText?: string;
|
11
|
-
level?: 1 | 2 | 3 | 4 | 5;
|
12
|
-
}
|
13
|
-
|
14
|
-
const AppTitle = ({
|
15
|
-
mainText,
|
16
|
-
className = "",
|
17
|
-
subText,
|
18
|
-
level = 1,
|
19
|
-
}: TitleProps) => {
|
20
|
-
return (
|
21
|
-
<div className={`titleComponent ${className}`}>
|
22
|
-
<Title level={level}>{mainText}</Title>
|
23
|
-
{subText && <Text className={"subText"}>{subText}</Text>}
|
24
|
-
</div>
|
25
|
-
);
|
26
|
-
};
|
27
|
-
|
28
|
-
export default AppTitle;
|
1
|
+
import React from "react";
|
2
|
+
import { Typography } from "antd";
|
3
|
+
import "./app-title.css";
|
4
|
+
|
5
|
+
const { Title, Text } = Typography;
|
6
|
+
|
7
|
+
interface TitleProps {
|
8
|
+
mainText: React.ReactNode;
|
9
|
+
className?: string;
|
10
|
+
subText?: string;
|
11
|
+
level?: 1 | 2 | 3 | 4 | 5;
|
12
|
+
}
|
13
|
+
|
14
|
+
const AppTitle = ({
|
15
|
+
mainText,
|
16
|
+
className = "",
|
17
|
+
subText,
|
18
|
+
level = 1,
|
19
|
+
}: TitleProps) => {
|
20
|
+
return (
|
21
|
+
<div className={`titleComponent ${className}`}>
|
22
|
+
<Title level={level}>{mainText}</Title>
|
23
|
+
{subText && <Text className={"subText"}>{subText}</Text>}
|
24
|
+
</div>
|
25
|
+
);
|
26
|
+
};
|
27
|
+
|
28
|
+
export default AppTitle;
|
@@ -1,27 +1,27 @@
|
|
1
|
-
.toggleContainer {
|
2
|
-
display: flex;
|
3
|
-
align-items: center;
|
4
|
-
.ant-switch {
|
5
|
-
height: 16px;
|
6
|
-
position: relative;
|
7
|
-
.ant-switch-handle {
|
8
|
-
top: 50%;
|
9
|
-
bottom: 50%;
|
10
|
-
transform: translateY(-50%);
|
11
|
-
}
|
12
|
-
}
|
13
|
-
&:not(.ant-switch.ant-switch-checked .ant-switch-handle) {
|
14
|
-
inset-inline-start: 0px;
|
15
|
-
}
|
16
|
-
& .ant-switch.ant-switch-checked .ant-switch-handle {
|
17
|
-
inset-inline-start: calc(100% - 18px);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
.switch {
|
22
|
-
margin-right: 0.5rem;
|
23
|
-
}
|
24
|
-
|
25
|
-
.label {
|
26
|
-
font-size: 1rem;
|
27
|
-
}
|
1
|
+
.toggleContainer {
|
2
|
+
display: flex;
|
3
|
+
align-items: center;
|
4
|
+
.ant-switch {
|
5
|
+
height: 16px;
|
6
|
+
position: relative;
|
7
|
+
.ant-switch-handle {
|
8
|
+
top: 50%;
|
9
|
+
bottom: 50%;
|
10
|
+
transform: translateY(-50%);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
&:not(.ant-switch.ant-switch-checked .ant-switch-handle) {
|
14
|
+
inset-inline-start: 0px;
|
15
|
+
}
|
16
|
+
& .ant-switch.ant-switch-checked .ant-switch-handle {
|
17
|
+
inset-inline-start: calc(100% - 18px);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.switch {
|
22
|
+
margin-right: 0.5rem;
|
23
|
+
}
|
24
|
+
|
25
|
+
.label {
|
26
|
+
font-size: 1rem;
|
27
|
+
}
|
@@ -1,43 +1,43 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Switch } from "antd";
|
3
|
-
import "./app-toggle-button.css";
|
4
|
-
|
5
|
-
interface AppToggleButtonProps {
|
6
|
-
initialChecked?: boolean;
|
7
|
-
onChange?: (checked: boolean) => void;
|
8
|
-
checkedLabel?: string;
|
9
|
-
uncheckedLabel?: string;
|
10
|
-
className?: string;
|
11
|
-
}
|
12
|
-
|
13
|
-
const AppToggleButton = ({
|
14
|
-
initialChecked = false,
|
15
|
-
onChange,
|
16
|
-
checkedLabel,
|
17
|
-
uncheckedLabel,
|
18
|
-
className,
|
19
|
-
}: AppToggleButtonProps) => {
|
20
|
-
const [isChecked, setIsChecked] = useState(initialChecked);
|
21
|
-
|
22
|
-
const handleToggle = (checked: boolean) => {
|
23
|
-
setIsChecked(checked);
|
24
|
-
if (onChange) {
|
25
|
-
onChange(checked);
|
26
|
-
}
|
27
|
-
};
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div className={`toggleContainer ${className}`}>
|
31
|
-
<Switch
|
32
|
-
checked={isChecked}
|
33
|
-
onChange={handleToggle}
|
34
|
-
className={"switch"}
|
35
|
-
/>
|
36
|
-
<span className={"label"}>
|
37
|
-
{isChecked ? checkedLabel : uncheckedLabel}
|
38
|
-
</span>
|
39
|
-
</div>
|
40
|
-
);
|
41
|
-
};
|
42
|
-
|
43
|
-
export default AppToggleButton;
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Switch } from "antd";
|
3
|
+
import "./app-toggle-button.css";
|
4
|
+
|
5
|
+
interface AppToggleButtonProps {
|
6
|
+
initialChecked?: boolean;
|
7
|
+
onChange?: (checked: boolean) => void;
|
8
|
+
checkedLabel?: string;
|
9
|
+
uncheckedLabel?: string;
|
10
|
+
className?: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
const AppToggleButton = ({
|
14
|
+
initialChecked = false,
|
15
|
+
onChange,
|
16
|
+
checkedLabel,
|
17
|
+
uncheckedLabel,
|
18
|
+
className,
|
19
|
+
}: AppToggleButtonProps) => {
|
20
|
+
const [isChecked, setIsChecked] = useState(initialChecked);
|
21
|
+
|
22
|
+
const handleToggle = (checked: boolean) => {
|
23
|
+
setIsChecked(checked);
|
24
|
+
if (onChange) {
|
25
|
+
onChange(checked);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
return (
|
30
|
+
<div className={`toggleContainer ${className}`}>
|
31
|
+
<Switch
|
32
|
+
checked={isChecked}
|
33
|
+
onChange={handleToggle}
|
34
|
+
className={"switch"}
|
35
|
+
/>
|
36
|
+
<span className={"label"}>
|
37
|
+
{isChecked ? checkedLabel : uncheckedLabel}
|
38
|
+
</span>
|
39
|
+
</div>
|
40
|
+
);
|
41
|
+
};
|
42
|
+
|
43
|
+
export default AppToggleButton;
|
@@ -1,26 +1,26 @@
|
|
1
|
-
.profileImageContainer {
|
2
|
-
display: flex;
|
3
|
-
align-items: center;
|
4
|
-
gap: 2rem;
|
5
|
-
}
|
6
|
-
|
7
|
-
.altTextWrapper {
|
8
|
-
font-size: 0.8rem;
|
9
|
-
text-align: center;
|
10
|
-
img {
|
11
|
-
border-radius: 0;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
.profileImage {
|
16
|
-
width: 100px;
|
17
|
-
height: 100px;
|
18
|
-
border-radius: 50%;
|
19
|
-
object-fit: cover;
|
20
|
-
position: relative;
|
21
|
-
font-size: 0.8rem;
|
22
|
-
}
|
23
|
-
|
24
|
-
.fileInput {
|
25
|
-
display: none;
|
26
|
-
}
|
1
|
+
.profileImageContainer {
|
2
|
+
display: flex;
|
3
|
+
align-items: center;
|
4
|
+
gap: 2rem;
|
5
|
+
}
|
6
|
+
|
7
|
+
.altTextWrapper {
|
8
|
+
font-size: 0.8rem;
|
9
|
+
text-align: center;
|
10
|
+
img {
|
11
|
+
border-radius: 0;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
.profileImage {
|
16
|
+
width: 100px;
|
17
|
+
height: 100px;
|
18
|
+
border-radius: 50%;
|
19
|
+
object-fit: cover;
|
20
|
+
position: relative;
|
21
|
+
font-size: 0.8rem;
|
22
|
+
}
|
23
|
+
|
24
|
+
.fileInput {
|
25
|
+
display: none;
|
26
|
+
}
|