@omniumretail/component-library 1.0.66 → 1.0.68
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/.storybook/main.js +16 -16
- package/.storybook/preview-head.html +20 -20
- package/.storybook/preview.js +27 -27
- package/README.md +54 -54
- package/bitbucket-pipelines.yml +94 -94
- package/dist/bundle.js +12047 -0
- package/dist/main.css +1244 -0
- package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -0
- package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -0
- package/dist/types/components/AnalyticsBar/index.d.ts +2 -0
- package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -0
- package/dist/types/components/Button/Button.stories.d.ts +6 -0
- package/dist/types/components/Button/index.d.ts +7 -0
- package/dist/types/components/Category/Category.stories.d.ts +4 -0
- package/dist/types/components/Category/CategoryContent/index.d.ts +7 -0
- package/dist/types/components/Category/CategorySidebar/index.d.ts +26 -0
- package/dist/types/components/Category/index.d.ts +7 -0
- package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +4 -0
- package/dist/types/components/CategoryReadOnly/evaluationOptions.d.ts +10 -0
- package/dist/types/components/CategoryReadOnly/index.d.ts +9 -0
- package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -0
- package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -0
- package/dist/types/components/CategoryResponse/index.d.ts +9 -0
- package/dist/types/components/DatePicker/DatePicker.stories.d.ts +5 -0
- package/dist/types/components/DatePicker/index.d.ts +8 -0
- package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -0
- package/dist/types/components/DatePickerTag/index.d.ts +6 -0
- package/dist/types/components/Footer/Footer.stories.d.ts +5 -0
- package/dist/types/components/Footer/index.d.ts +4 -0
- package/dist/types/components/Input/Input.stories.d.ts +5 -0
- package/dist/types/components/Input/index.d.ts +10 -0
- package/dist/types/components/InputCountryCode/index.d.ts +10 -0
- package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +5 -0
- package/dist/types/components/Label/Label.stories.d.ts +6 -0
- package/dist/types/components/Label/index.d.ts +7 -0
- package/dist/types/components/Link/Link.stories.d.ts +7 -0
- package/dist/types/components/Link/index.d.ts +7 -0
- package/dist/types/components/Menu/Menu.stories.d.ts +5 -0
- package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -0
- package/dist/types/components/Menu/index.d.ts +2 -0
- package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +5 -0
- package/dist/types/components/ModalConfirmation/ModalStatusList.d.ts +5 -0
- package/dist/types/components/ModalConfirmation/index.d.ts +9 -0
- package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +5 -0
- package/dist/types/components/ModalWithTable/index.d.ts +13 -0
- package/dist/types/components/Navigation/Navigation.stories.d.ts +5 -0
- package/dist/types/components/Navigation/index.d.ts +10 -0
- package/dist/types/components/Notification/Notification.stories.d.ts +5 -0
- package/dist/types/components/Notification/index.d.ts +9 -0
- package/dist/types/components/Questions/Questions.stories.d.ts +4 -0
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -0
- package/dist/types/components/Questions/index.d.ts +5 -0
- package/dist/types/components/Radio/Radio.stories.d.ts +5 -0
- package/dist/types/components/Radio/index.d.ts +10 -0
- package/dist/types/components/Select/Select.stories.d.ts +6 -0
- package/dist/types/components/Select/index.d.ts +5 -0
- package/dist/types/components/Separator/Separator.stories.d.ts +6 -0
- package/dist/types/components/Separator/index.d.ts +11 -0
- package/dist/types/components/Sidebar/Sidebar.stories.d.ts +6 -0
- package/dist/types/components/Sidebar/index.d.ts +15 -0
- package/dist/types/components/Switch/Switch.stories.d.ts +5 -0
- package/dist/types/components/Switch/index.d.ts +2 -0
- package/dist/types/components/Table/Table.stories.d.ts +9 -0
- package/dist/types/components/Table/index.d.ts +36 -0
- package/dist/types/components/Tag/Tag.stories.d.ts +5 -0
- package/dist/types/components/Tag/index.d.ts +8 -0
- package/dist/types/components/Upload/Upload.stories.d.ts +4 -0
- package/dist/types/components/Upload/index.d.ts +8 -0
- package/dist/types/components/UserInfo/UserInfo.stories.d.ts +4 -0
- package/dist/types/components/UserInfo/index.d.ts +8 -0
- package/dist/types/components/index.d.ts +25 -0
- package/dist/types/constants/i18n.d.ts +1 -0
- package/dist/types/constants/translationHelper.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +198 -198
- package/src/assets/scss/_global.scss +89 -89
- package/src/assets/scss/index.scss +2 -2
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +236 -236
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -19
- package/src/components/AnalyticsBar/index.tsx +76 -76
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -13
- package/src/components/AnalyticsBar/styles.module.scss +108 -108
- package/src/components/Button/Button.stories.tsx +26 -26
- package/src/components/Button/index.tsx +24 -24
- package/src/components/Button/styles.module.scss +65 -65
- package/src/components/Category/Category.stories.tsx +88 -88
- package/src/components/Category/CategoryContent/index.tsx +188 -188
- package/src/components/Category/CategoryContent/styles.module.scss +51 -51
- package/src/components/Category/CategorySidebar/index.tsx +268 -268
- package/src/components/Category/CategorySidebar/styles.module.scss +28 -28
- package/src/components/Category/index.tsx +76 -76
- package/src/components/Category/styles.module.scss +13 -13
- package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +270 -270
- package/src/components/CategoryReadOnly/evaluationOptions.tsx +81 -81
- package/src/components/CategoryReadOnly/index.tsx +254 -254
- package/src/components/CategoryReadOnly/styles.module.scss +184 -184
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +251 -251
- package/src/components/CategoryResponse/evaluationOptions.tsx +81 -81
- package/src/components/CategoryResponse/index.tsx +277 -277
- package/src/components/CategoryResponse/styles.module.scss +175 -160
- package/src/components/DatePicker/DatePicker.stories.tsx +16 -16
- package/src/components/DatePicker/index.tsx +38 -38
- package/src/components/DatePicker/styles.module.scss +3 -3
- package/src/components/DatePickerTag/DatePickerTag.stories.tsx +19 -19
- package/src/components/DatePickerTag/index.tsx +89 -89
- package/src/components/DatePickerTag/styles.module.scss +31 -31
- package/src/components/Footer/Footer.stories.tsx +14 -14
- package/src/components/Footer/index.tsx +38 -38
- package/src/components/Footer/styles.module.scss +38 -38
- package/src/components/Input/Input.stories.tsx +13 -13
- package/src/components/Input/index.tsx +31 -31
- package/src/components/Input/styles.module.scss +8 -8
- package/src/components/InputCountryCode/index.tsx +75 -75
- package/src/components/InputCountryCode/inputCountryCode.stories.tsx +55 -55
- package/src/components/InputCountryCode/styles.module.scss +3 -3
- package/src/components/Label/Label.stories.tsx +21 -21
- package/src/components/Label/index.tsx +19 -19
- package/src/components/Label/styles.module.scss +16 -16
- package/src/components/Link/Link.stories.tsx +30 -30
- package/src/components/Link/index.tsx +21 -21
- package/src/components/Link/styles.module.scss +24 -24
- package/src/components/Menu/Menu.stories.tsx +178 -178
- package/src/components/Menu/helpers/codeMutation.tsx +19 -19
- package/src/components/Menu/index.tsx +23 -23
- package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +40 -40
- package/src/components/ModalConfirmation/ModalStatusList.tsx +5 -5
- package/src/components/ModalConfirmation/index.tsx +70 -70
- package/src/components/ModalConfirmation/styles.module.scss +62 -62
- package/src/components/ModalWithTable/ModalWithTable.stories.tsx +96 -96
- package/src/components/ModalWithTable/index.tsx +232 -232
- package/src/components/ModalWithTable/styles.module.scss +77 -77
- package/src/components/Navigation/Navigation.stories.tsx +17 -17
- package/src/components/Navigation/index.tsx +33 -33
- package/src/components/Navigation/styles.module.scss +58 -42
- package/src/components/Notification/Notification.stories.tsx +29 -29
- package/src/components/Notification/index.tsx +21 -21
- package/src/components/Questions/Questions.stories.tsx +37 -37
- package/src/components/Questions/SingleQuestion/index.tsx +84 -84
- package/src/components/Questions/SingleQuestion/styles.module.scss +81 -81
- package/src/components/Questions/index.tsx +78 -78
- package/src/components/Radio/Radio.stories.tsx +43 -43
- package/src/components/Radio/index.tsx +26 -26
- package/src/components/Radio/styles.module.scss +23 -23
- package/src/components/Select/Select.stories.tsx +39 -39
- package/src/components/Select/index.tsx +27 -27
- package/src/components/Select/styles.module.scss +13 -13
- package/src/components/Separator/Separator.stories.tsx +22 -22
- package/src/components/Separator/index.tsx +27 -27
- package/src/components/Separator/styles.module.scss +25 -25
- package/src/components/Sidebar/Sidebar.stories.tsx +85 -85
- package/src/components/Sidebar/index.tsx +103 -103
- package/src/components/Sidebar/styles.module.scss +85 -85
- package/src/components/Switch/Switch.stories.tsx +14 -14
- package/src/components/Switch/index.tsx +8 -8
- package/src/components/Switch/styles.module.scss +7 -7
- package/src/components/Table/Table.stories.tsx +221 -221
- package/src/components/Table/index.tsx +271 -271
- package/src/components/Table/styles.module.scss +75 -75
- package/src/components/Tag/Tag.stories.tsx +22 -22
- package/src/components/Tag/index.tsx +189 -189
- package/src/components/Tag/styles.module.scss +60 -60
- package/src/components/Upload/Upload.stories.tsx +45 -45
- package/src/components/Upload/index.tsx +91 -91
- package/src/components/UserInfo/UserInfo.stories.tsx +37 -37
- package/src/components/UserInfo/index.tsx +62 -62
- package/src/components/UserInfo/styles.module.scss +29 -29
- package/src/components/index.tsx +25 -25
- package/src/constants/i18n.ts +25 -25
- package/src/constants/translationHelper.ts +7 -7
- package/src/index.ts +2 -2
- package/src/locales/en.json +86 -86
- package/src/locales/es.json +86 -86
- package/src/locales/pt.json +86 -86
- package/src/types/Global.d.ts +4 -4
- package/tsconfig.json +29 -29
- package/webpack.config.js +51 -51
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import { Link } from '../Link';
|
|
3
|
-
import { ArrowLeftOutlined, HomeOutlined, LogoutOutlined } from '@ant-design/icons';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
export interface NavigationProps {
|
|
6
|
-
backLink?: boolean;
|
|
7
|
-
title: string;
|
|
8
|
-
homeLink?: boolean;
|
|
9
|
-
loginLink?: boolean;
|
|
10
|
-
loginOnClickFunction?: () => void;
|
|
11
|
-
backLinkOnClickFunction?: () => void;
|
|
12
|
-
homeOnClickFunction?: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const Navigation = (props: NavigationProps) => {
|
|
16
|
-
const { backLink, title, homeLink, loginOnClickFunction, loginLink, backLinkOnClickFunction, homeOnClickFunction } = props;
|
|
17
|
-
const { t } = useTranslation();
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className={styles.navigation}>
|
|
21
|
-
<div className={styles.columnLeft}>
|
|
22
|
-
{ backLink && <Link href="#" icon={<ArrowLeftOutlined />} linkSecondary onClick={backLinkOnClickFunction}> {t('navigation.back')} </Link> }
|
|
23
|
-
</div>
|
|
24
|
-
<div className={styles.columnCenter}>
|
|
25
|
-
<h1 className={styles.title}>{title}</h1>
|
|
26
|
-
</div>
|
|
27
|
-
<div className={styles.columnRight}>
|
|
28
|
-
{homeLink && <Link href="#" icon={<HomeOutlined />} linkSecondary iconAlignRight onClick={homeOnClickFunction}> {t('navigation.home')} </Link>}
|
|
29
|
-
{loginLink && <Link href="#" onClick={loginOnClickFunction} icon={<LogoutOutlined />} linkSecondary iconAlignRight> {t('navigation.logout')} </Link>}
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
)
|
|
33
|
-
};
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import { Link } from '../Link';
|
|
3
|
+
import { ArrowLeftOutlined, HomeOutlined, LogoutOutlined } from '@ant-design/icons';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
export interface NavigationProps {
|
|
6
|
+
backLink?: boolean;
|
|
7
|
+
title: string;
|
|
8
|
+
homeLink?: boolean;
|
|
9
|
+
loginLink?: boolean;
|
|
10
|
+
loginOnClickFunction?: () => void;
|
|
11
|
+
backLinkOnClickFunction?: () => void;
|
|
12
|
+
homeOnClickFunction?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Navigation = (props: NavigationProps) => {
|
|
16
|
+
const { backLink, title, homeLink, loginOnClickFunction, loginLink, backLinkOnClickFunction, homeOnClickFunction } = props;
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={styles.navigation}>
|
|
21
|
+
<div className={styles.columnLeft}>
|
|
22
|
+
{ backLink && <Link href="#" icon={<ArrowLeftOutlined />} linkSecondary onClick={backLinkOnClickFunction}> {t('navigation.back')} </Link> }
|
|
23
|
+
</div>
|
|
24
|
+
<div className={styles.columnCenter}>
|
|
25
|
+
<h1 className={styles.title}>{title}</h1>
|
|
26
|
+
</div>
|
|
27
|
+
<div className={styles.columnRight}>
|
|
28
|
+
{homeLink && <Link href="#" icon={<HomeOutlined />} linkSecondary iconAlignRight onClick={homeOnClickFunction}> {t('navigation.home')} </Link>}
|
|
29
|
+
{loginLink && <Link href="#" onClick={loginOnClickFunction} icon={<LogoutOutlined />} linkSecondary iconAlignRight> {t('navigation.logout')} </Link>}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
};
|
|
@@ -1,42 +1,58 @@
|
|
|
1
|
-
.navigation {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: repeat(3, 1fr);
|
|
4
|
-
justify-items: center;
|
|
5
|
-
align-items: center;
|
|
6
|
-
height: 75px;
|
|
7
|
-
gap: 0 24px;
|
|
8
|
-
position: relative;
|
|
9
|
-
|
|
10
|
-
@media(max-width: 767px) {
|
|
11
|
-
padding-top:
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: space-between;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.title {
|
|
18
|
-
font-size: var(--font-size-body-
|
|
19
|
-
font-weight: var(--font-weight-semibold);
|
|
20
|
-
text-transform: uppercase;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
justify-self:
|
|
41
|
-
}
|
|
42
|
-
|
|
1
|
+
.navigation {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(3, 1fr);
|
|
4
|
+
justify-items: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 75px;
|
|
7
|
+
gap: 0 24px;
|
|
8
|
+
position: relative;
|
|
9
|
+
|
|
10
|
+
@media(max-width: 767px) {
|
|
11
|
+
padding-top: 6px;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.title {
|
|
18
|
+
font-size: var(--font-size-body-3);
|
|
19
|
+
font-weight: var(--font-weight-semibold);
|
|
20
|
+
text-transform: uppercase;
|
|
21
|
+
|
|
22
|
+
@media(min-width: 768px) {
|
|
23
|
+
font-size: var(--font-size-body-4);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.columnCenter {
|
|
28
|
+
align-self: center;
|
|
29
|
+
@media(max-width: 767px) {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
margin: 0 auto;
|
|
33
|
+
left: 0;
|
|
34
|
+
right: 0;
|
|
35
|
+
text-align: center;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.columnLeft {
|
|
40
|
+
justify-self: start;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.columnRight {
|
|
44
|
+
justify-self: end;
|
|
45
|
+
|
|
46
|
+
:global {
|
|
47
|
+
.ant-btn {
|
|
48
|
+
span {
|
|
49
|
+
&:not([role="img"]) {
|
|
50
|
+
@media(max-width: 767px) {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { Notification, ErrorNotificationProps } from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Notification',
|
|
6
|
-
component: Notification,
|
|
7
|
-
} as unknown as Meta;
|
|
8
|
-
|
|
9
|
-
const Template: Story<ErrorNotificationProps> = (args) => {
|
|
10
|
-
|
|
11
|
-
const { openNotificationWithIcon } = Notification({
|
|
12
|
-
message: args.message,
|
|
13
|
-
description: args.description,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
{openNotificationWithIcon('error')}
|
|
19
|
-
</>
|
|
20
|
-
)
|
|
21
|
-
};
|
|
22
|
-
export const Primary = Template.bind({});
|
|
23
|
-
Primary.args = {
|
|
24
|
-
message: "Sucesso",
|
|
25
|
-
description: "Parabéns, conseguiste!"
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Notification, ErrorNotificationProps } from '.';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Notification',
|
|
6
|
+
component: Notification,
|
|
7
|
+
} as unknown as Meta;
|
|
8
|
+
|
|
9
|
+
const Template: Story<ErrorNotificationProps> = (args) => {
|
|
10
|
+
|
|
11
|
+
const { openNotificationWithIcon } = Notification({
|
|
12
|
+
message: args.message,
|
|
13
|
+
description: args.description,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{openNotificationWithIcon('error')}
|
|
19
|
+
</>
|
|
20
|
+
)
|
|
21
|
+
};
|
|
22
|
+
export const Primary = Template.bind({});
|
|
23
|
+
Primary.args = {
|
|
24
|
+
message: "Sucesso",
|
|
25
|
+
description: "Parabéns, conseguiste!"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { notification } from 'antd';
|
|
2
|
-
|
|
3
|
-
export interface ErrorNotificationProps {
|
|
4
|
-
message: string;
|
|
5
|
-
description: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
type NotificationType = 'success' | 'info' | 'warning' | 'error';
|
|
9
|
-
|
|
10
|
-
export const Notification = ({ message, description }: ErrorNotificationProps) => {
|
|
11
|
-
const openNotificationWithIcon = (type: NotificationType) => {
|
|
12
|
-
notification[type]({
|
|
13
|
-
message: message,
|
|
14
|
-
description: description,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
openNotificationWithIcon,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
1
|
+
import { notification } from 'antd';
|
|
2
|
+
|
|
3
|
+
export interface ErrorNotificationProps {
|
|
4
|
+
message: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type NotificationType = 'success' | 'info' | 'warning' | 'error';
|
|
9
|
+
|
|
10
|
+
export const Notification = ({ message, description }: ErrorNotificationProps) => {
|
|
11
|
+
const openNotificationWithIcon = (type: NotificationType) => {
|
|
12
|
+
notification[type]({
|
|
13
|
+
message: message,
|
|
14
|
+
description: description,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
openNotificationWithIcon,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { Questions } from '.';
|
|
3
|
-
import { SearchOutlined } from '@ant-design/icons';
|
|
4
|
-
import { Button, Form, Input } from "antd";
|
|
5
|
-
import { useForm } from 'antd/lib/form/Form';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Questions',
|
|
9
|
-
component: Questions,
|
|
10
|
-
} as Meta;
|
|
11
|
-
|
|
12
|
-
const Template: Story<any> = (args) => {
|
|
13
|
-
const [form] = useForm();
|
|
14
|
-
|
|
15
|
-
const onFinish = (values: any) => {
|
|
16
|
-
console.log('Received values of form:', values);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<>
|
|
21
|
-
<Form
|
|
22
|
-
name="dynamic_form_nest_item"
|
|
23
|
-
onFinish={onFinish}
|
|
24
|
-
autoComplete="off"
|
|
25
|
-
form={form}
|
|
26
|
-
>
|
|
27
|
-
<Questions {...args}></Questions>
|
|
28
|
-
</Form>
|
|
29
|
-
<div style={{marginTop: '60px'}}></div>
|
|
30
|
-
<Button onClick={() => form.submit()}>Submit</Button>
|
|
31
|
-
</>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const Primary = Template.bind({});
|
|
36
|
-
Primary.args = {
|
|
37
|
-
};
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Questions } from '.';
|
|
3
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Button, Form, Input } from "antd";
|
|
5
|
+
import { useForm } from 'antd/lib/form/Form';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Questions',
|
|
9
|
+
component: Questions,
|
|
10
|
+
} as Meta;
|
|
11
|
+
|
|
12
|
+
const Template: Story<any> = (args) => {
|
|
13
|
+
const [form] = useForm();
|
|
14
|
+
|
|
15
|
+
const onFinish = (values: any) => {
|
|
16
|
+
console.log('Received values of form:', values);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<Form
|
|
22
|
+
name="dynamic_form_nest_item"
|
|
23
|
+
onFinish={onFinish}
|
|
24
|
+
autoComplete="off"
|
|
25
|
+
form={form}
|
|
26
|
+
>
|
|
27
|
+
<Questions {...args}></Questions>
|
|
28
|
+
</Form>
|
|
29
|
+
<div style={{marginTop: '60px'}}></div>
|
|
30
|
+
<Button onClick={() => form.submit()}>Submit</Button>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Primary = Template.bind({});
|
|
36
|
+
Primary.args = {
|
|
37
|
+
};
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { DeleteOutlined, HolderOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
|
2
|
-
import { Form, Input, Space } from 'antd';
|
|
3
|
-
import { t } from 'i18next';
|
|
4
|
-
import styles from './styles.module.scss';
|
|
5
|
-
|
|
6
|
-
export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrade, handleChanges, ...restField }: any) => {
|
|
7
|
-
return (
|
|
8
|
-
<div
|
|
9
|
-
key={key}
|
|
10
|
-
ref={provided.innerRef}
|
|
11
|
-
snapshot={snapshot}
|
|
12
|
-
{...provided.draggableProps}
|
|
13
|
-
{...provided.dragHandleProps}
|
|
14
|
-
className={styles.dragItem}
|
|
15
|
-
>
|
|
16
|
-
<Space>
|
|
17
|
-
<div className={styles.question}>
|
|
18
|
-
<div className={styles.drag}>
|
|
19
|
-
<HolderOutlined />
|
|
20
|
-
</div>
|
|
21
|
-
<div className={styles.content}>
|
|
22
|
-
<div className={styles.label}>
|
|
23
|
-
abc
|
|
24
|
-
</div>
|
|
25
|
-
<Form.Item
|
|
26
|
-
{...restField}
|
|
27
|
-
name={[name, 'question']}
|
|
28
|
-
>
|
|
29
|
-
<Input placeholder={`${t('components.category.placeholderQuestion')}`} onBlur={handleChanges} />
|
|
30
|
-
</Form.Item>
|
|
31
|
-
</div>
|
|
32
|
-
<div className={styles.actions}>
|
|
33
|
-
{/* <div className={styles.edit}>
|
|
34
|
-
<div className={styles.notEditing}
|
|
35
|
-
// onClick={() => handleStartEdit(index)}
|
|
36
|
-
>
|
|
37
|
-
<EditOutlined />
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div className={styles.editing}>
|
|
41
|
-
<CheckOutlined style={{ color: 'var( --color-confirmation-600)' }}
|
|
42
|
-
onClick={() => handleSaveEdit()}
|
|
43
|
-
/>
|
|
44
|
-
<CloseOutlined style={{ color: 'var( --color-warning-500)' }}
|
|
45
|
-
//onClick={() => handleCancelEdit(index)}
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
</div> */}
|
|
49
|
-
<div className={styles.delete}>
|
|
50
|
-
<DeleteOutlined onClick={() => remove(name)} />
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div className={styles.information}>
|
|
55
|
-
<div className={styles.infoIcon}>
|
|
56
|
-
<InfoCircleOutlined />
|
|
57
|
-
</div>
|
|
58
|
-
<div className={styles.content}>
|
|
59
|
-
<div className={styles.label}>
|
|
60
|
-
xpto
|
|
61
|
-
</div>
|
|
62
|
-
<Form.Item
|
|
63
|
-
{...restField}
|
|
64
|
-
name={[name, 'info']}
|
|
65
|
-
>
|
|
66
|
-
<Input placeholder={`${t('components.category.placeholderInfo')}`} onBlur={handleChanges}/>
|
|
67
|
-
</Form.Item>
|
|
68
|
-
</div>
|
|
69
|
-
{showGrade &&
|
|
70
|
-
<div className={styles.grade}>
|
|
71
|
-
<Form.Item
|
|
72
|
-
{...restField}
|
|
73
|
-
name={[name, 'grade']}
|
|
74
|
-
>
|
|
75
|
-
<Input placeholder={`${t('components.category.placeholderGrade')}`} onBlur={handleChanges} />
|
|
76
|
-
</Form.Item>
|
|
77
|
-
</div>
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
</Space>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
1
|
+
import { DeleteOutlined, HolderOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Form, Input, Space } from 'antd';
|
|
3
|
+
import { t } from 'i18next';
|
|
4
|
+
import styles from './styles.module.scss';
|
|
5
|
+
|
|
6
|
+
export const SingleQuestion = ({ key, provided, snapshot, remove, name, showGrade, handleChanges, ...restField }: any) => {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
key={key}
|
|
10
|
+
ref={provided.innerRef}
|
|
11
|
+
snapshot={snapshot}
|
|
12
|
+
{...provided.draggableProps}
|
|
13
|
+
{...provided.dragHandleProps}
|
|
14
|
+
className={styles.dragItem}
|
|
15
|
+
>
|
|
16
|
+
<Space>
|
|
17
|
+
<div className={styles.question}>
|
|
18
|
+
<div className={styles.drag}>
|
|
19
|
+
<HolderOutlined />
|
|
20
|
+
</div>
|
|
21
|
+
<div className={styles.content}>
|
|
22
|
+
<div className={styles.label}>
|
|
23
|
+
abc
|
|
24
|
+
</div>
|
|
25
|
+
<Form.Item
|
|
26
|
+
{...restField}
|
|
27
|
+
name={[name, 'question']}
|
|
28
|
+
>
|
|
29
|
+
<Input placeholder={`${t('components.category.placeholderQuestion')}`} onBlur={handleChanges} />
|
|
30
|
+
</Form.Item>
|
|
31
|
+
</div>
|
|
32
|
+
<div className={styles.actions}>
|
|
33
|
+
{/* <div className={styles.edit}>
|
|
34
|
+
<div className={styles.notEditing}
|
|
35
|
+
// onClick={() => handleStartEdit(index)}
|
|
36
|
+
>
|
|
37
|
+
<EditOutlined />
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div className={styles.editing}>
|
|
41
|
+
<CheckOutlined style={{ color: 'var( --color-confirmation-600)' }}
|
|
42
|
+
onClick={() => handleSaveEdit()}
|
|
43
|
+
/>
|
|
44
|
+
<CloseOutlined style={{ color: 'var( --color-warning-500)' }}
|
|
45
|
+
//onClick={() => handleCancelEdit(index)}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div> */}
|
|
49
|
+
<div className={styles.delete}>
|
|
50
|
+
<DeleteOutlined onClick={() => remove(name)} />
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div className={styles.information}>
|
|
55
|
+
<div className={styles.infoIcon}>
|
|
56
|
+
<InfoCircleOutlined />
|
|
57
|
+
</div>
|
|
58
|
+
<div className={styles.content}>
|
|
59
|
+
<div className={styles.label}>
|
|
60
|
+
xpto
|
|
61
|
+
</div>
|
|
62
|
+
<Form.Item
|
|
63
|
+
{...restField}
|
|
64
|
+
name={[name, 'info']}
|
|
65
|
+
>
|
|
66
|
+
<Input placeholder={`${t('components.category.placeholderInfo')}`} onBlur={handleChanges}/>
|
|
67
|
+
</Form.Item>
|
|
68
|
+
</div>
|
|
69
|
+
{showGrade &&
|
|
70
|
+
<div className={styles.grade}>
|
|
71
|
+
<Form.Item
|
|
72
|
+
{...restField}
|
|
73
|
+
name={[name, 'grade']}
|
|
74
|
+
>
|
|
75
|
+
<Input placeholder={`${t('components.category.placeholderGrade')}`} onBlur={handleChanges} />
|
|
76
|
+
</Form.Item>
|
|
77
|
+
</div>
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
</div>
|
|
81
|
+
</Space>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|