@omniumretail/component-library 1.0.74 → 1.0.75
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/NPMPUBLISH.md +29 -29
- package/README.md +54 -54
- package/bitbucket-pipelines.yml +94 -94
- package/dist/bundle.js +247 -291
- package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -5
- package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/AnalyticsBar/index.d.ts +2 -2
- package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -12
- package/dist/types/components/Button/Button.stories.d.ts +6 -6
- package/dist/types/components/Button/index.d.ts +7 -7
- package/dist/types/components/Category/Category.stories.d.ts +4 -4
- package/dist/types/components/Category/CategoryContent/index.d.ts +7 -7
- package/dist/types/components/Category/CategorySidebar/index.d.ts +26 -26
- package/dist/types/components/Category/index.d.ts +7 -7
- package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +4 -4
- package/dist/types/components/CategoryReadOnly/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryReadOnly/index.d.ts +9 -9
- package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -4
- package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryResponse/index.d.ts +9 -9
- package/dist/types/components/DatePicker/DatePicker.stories.d.ts +5 -5
- package/dist/types/components/DatePicker/index.d.ts +8 -8
- package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -5
- package/dist/types/components/DatePickerTag/index.d.ts +6 -6
- package/dist/types/components/Footer/Footer.stories.d.ts +5 -5
- package/dist/types/components/Footer/index.d.ts +4 -4
- package/dist/types/components/Input/Input.stories.d.ts +5 -5
- package/dist/types/components/Input/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +5 -5
- package/dist/types/components/Label/Label.stories.d.ts +6 -6
- package/dist/types/components/Label/index.d.ts +7 -7
- package/dist/types/components/Link/Link.stories.d.ts +7 -7
- package/dist/types/components/Link/index.d.ts +7 -7
- package/dist/types/components/Menu/Menu.stories.d.ts +5 -5
- package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/Menu/index.d.ts +3 -2
- package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/ModalStatusList.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/index.d.ts +9 -9
- package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +5 -5
- package/dist/types/components/ModalWithTable/index.d.ts +13 -13
- package/dist/types/components/Navigation/Navigation.stories.d.ts +5 -5
- package/dist/types/components/Navigation/index.d.ts +10 -10
- package/dist/types/components/Notification/Notification.stories.d.ts +5 -5
- package/dist/types/components/Notification/index.d.ts +9 -9
- package/dist/types/components/Questions/Questions.stories.d.ts +4 -4
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -1
- package/dist/types/components/Questions/index.d.ts +5 -5
- package/dist/types/components/Radio/Radio.stories.d.ts +5 -5
- package/dist/types/components/Radio/index.d.ts +10 -10
- package/dist/types/components/Select/Select.stories.d.ts +6 -6
- package/dist/types/components/Select/index.d.ts +5 -5
- package/dist/types/components/Separator/Separator.stories.d.ts +6 -6
- package/dist/types/components/Separator/index.d.ts +11 -11
- package/dist/types/components/Sidebar/Sidebar.stories.d.ts +6 -6
- package/dist/types/components/Sidebar/index.d.ts +15 -15
- package/dist/types/components/Switch/Switch.stories.d.ts +5 -5
- package/dist/types/components/Switch/index.d.ts +2 -2
- package/dist/types/components/Table/Table.stories.d.ts +9 -9
- package/dist/types/components/Table/index.d.ts +37 -37
- package/dist/types/components/Tag/Tag.stories.d.ts +5 -5
- package/dist/types/components/Tag/index.d.ts +8 -8
- package/dist/types/components/Upload/Upload.stories.d.ts +4 -4
- package/dist/types/components/Upload/index.d.ts +8 -8
- package/dist/types/components/UserInfo/UserInfo.stories.d.ts +4 -4
- package/dist/types/components/UserInfo/index.d.ts +8 -8
- package/dist/types/components/index.d.ts +25 -25
- package/dist/types/constants/i18n.d.ts +1 -1
- package/dist/types/constants/translationHelper.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- 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 +180 -180
- 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 +59 -59
- 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 +222 -222
- package/src/components/Table/index.tsx +279 -275
- 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,22 +1,22 @@
|
|
|
1
|
-
import {Meta, Story} from "@storybook/react";
|
|
2
|
-
import { Separator, SeparatorProps, Spaces } from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Separator',
|
|
6
|
-
component: Separator,
|
|
7
|
-
} as Meta;
|
|
8
|
-
|
|
9
|
-
const Template: Story<SeparatorProps> = (args) => <Separator {...args}></Separator>;
|
|
10
|
-
|
|
11
|
-
export const Primary = Template.bind({});
|
|
12
|
-
Primary.args = {
|
|
13
|
-
hasOpacity: false,
|
|
14
|
-
colorIsBlue: false,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Secondary = Template.bind({});
|
|
18
|
-
Secondary.args = {
|
|
19
|
-
hasOpacity: true,
|
|
20
|
-
colorIsBlue: true,
|
|
21
|
-
space: Spaces.l,
|
|
22
|
-
};
|
|
1
|
+
import {Meta, Story} from "@storybook/react";
|
|
2
|
+
import { Separator, SeparatorProps, Spaces } from '.';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Separator',
|
|
6
|
+
component: Separator,
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
const Template: Story<SeparatorProps> = (args) => <Separator {...args}></Separator>;
|
|
10
|
+
|
|
11
|
+
export const Primary = Template.bind({});
|
|
12
|
+
Primary.args = {
|
|
13
|
+
hasOpacity: false,
|
|
14
|
+
colorIsBlue: false,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Secondary = Template.bind({});
|
|
18
|
+
Secondary.args = {
|
|
19
|
+
hasOpacity: true,
|
|
20
|
+
colorIsBlue: true,
|
|
21
|
+
space: Spaces.l,
|
|
22
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
|
|
4
|
-
export enum Spaces {
|
|
5
|
-
s = 's',
|
|
6
|
-
m = 'm',
|
|
7
|
-
l = 'l',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface SeparatorProps {
|
|
11
|
-
hasOpacity?: boolean;
|
|
12
|
-
colorIsBlue?: boolean;
|
|
13
|
-
space: Spaces;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Separator = (props: SeparatorProps) => {
|
|
17
|
-
const { hasOpacity, colorIsBlue, space } = props;
|
|
18
|
-
|
|
19
|
-
const separatorClasses = classNames({
|
|
20
|
-
[styles.separator]: true,
|
|
21
|
-
[styles['separator--opacity-50']]: hasOpacity,
|
|
22
|
-
[styles['separator--blue-background']]: colorIsBlue,
|
|
23
|
-
[styles[`separator--space-${space}` || '']]: space && Spaces[space],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return <hr className={separatorClasses} />
|
|
27
|
-
};
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export enum Spaces {
|
|
5
|
+
s = 's',
|
|
6
|
+
m = 'm',
|
|
7
|
+
l = 'l',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SeparatorProps {
|
|
11
|
+
hasOpacity?: boolean;
|
|
12
|
+
colorIsBlue?: boolean;
|
|
13
|
+
space: Spaces;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Separator = (props: SeparatorProps) => {
|
|
17
|
+
const { hasOpacity, colorIsBlue, space } = props;
|
|
18
|
+
|
|
19
|
+
const separatorClasses = classNames({
|
|
20
|
+
[styles.separator]: true,
|
|
21
|
+
[styles['separator--opacity-50']]: hasOpacity,
|
|
22
|
+
[styles['separator--blue-background']]: colorIsBlue,
|
|
23
|
+
[styles[`separator--space-${space}` || '']]: space && Spaces[space],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return <hr className={separatorClasses} />
|
|
27
|
+
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
.separator {
|
|
2
|
-
background-color: var(--color-orange);
|
|
3
|
-
height: 1px;
|
|
4
|
-
border: none;
|
|
5
|
-
|
|
6
|
-
&--opacity-50 {
|
|
7
|
-
opacity: 50%;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&--blue-background {
|
|
11
|
-
background-color: var(--color-blue);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&--space-s {
|
|
15
|
-
margin: 8px 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&--space-m {
|
|
19
|
-
margin: 16px 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&--space-l {
|
|
23
|
-
margin: 24px 0;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
.separator {
|
|
2
|
+
background-color: var(--color-orange);
|
|
3
|
+
height: 1px;
|
|
4
|
+
border: none;
|
|
5
|
+
|
|
6
|
+
&--opacity-50 {
|
|
7
|
+
opacity: 50%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&--blue-background {
|
|
11
|
+
background-color: var(--color-blue);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--space-s {
|
|
15
|
+
margin: 8px 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--space-m {
|
|
19
|
+
margin: 16px 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--space-l {
|
|
23
|
+
margin: 24px 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { RightCircleOutlined } from "@ant-design/icons";
|
|
2
|
-
import { Meta, Story } from "@storybook/react";
|
|
3
|
-
import { Sidebar, SidebarProps } from '.';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Sidebar',
|
|
7
|
-
component: Sidebar,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: Story<SidebarProps> = (args) => {
|
|
11
|
-
const navigate = (targetRoute: string) => {
|
|
12
|
-
console.log(targetRoute);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return <Sidebar {...args} navigateFunction={navigate}></Sidebar>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Primary = Template.bind({});
|
|
19
|
-
Primary.args = {
|
|
20
|
-
isOpen: true,
|
|
21
|
-
links: [
|
|
22
|
-
{
|
|
23
|
-
label: "Ciclo de Avaliação",
|
|
24
|
-
targetRoute: "/ciclodeavaliacao",
|
|
25
|
-
active: true,
|
|
26
|
-
icon: <RightCircleOutlined />,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: "Gestão de Questionários",
|
|
30
|
-
targetRoute: "/gestaodequestionarios",
|
|
31
|
-
active: true,
|
|
32
|
-
sublinks: [
|
|
33
|
-
{
|
|
34
|
-
label: "Subpage 1121212",
|
|
35
|
-
targetRoute: "/analytics/subpage121212",
|
|
36
|
-
active: false,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: "Subpage 2111",
|
|
40
|
-
targetRoute: "/analytics/subpage211",
|
|
41
|
-
active: false
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: "Analytics",
|
|
47
|
-
targetRoute: "/analytics",
|
|
48
|
-
active: false,
|
|
49
|
-
sublinks: [
|
|
50
|
-
{
|
|
51
|
-
label: "Subpage 1",
|
|
52
|
-
targetRoute: "/analytics/subpage1",
|
|
53
|
-
active: false,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: "Subpage 2",
|
|
57
|
-
targetRoute: "/analytics/subpage2",
|
|
58
|
-
active: false
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const Secondary = Template.bind({});
|
|
66
|
-
Secondary.args = {
|
|
67
|
-
isOpen: false,
|
|
68
|
-
links: [
|
|
69
|
-
{
|
|
70
|
-
label: "Ciclo de Avaliação",
|
|
71
|
-
targetRoute: "/ciclodeavaliacao",
|
|
72
|
-
active: false,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: "Gestão de Questionários",
|
|
76
|
-
targetRoute: "/gestaodequestionarios",
|
|
77
|
-
active: false,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
label: "Analytics",
|
|
81
|
-
targetRoute: "/analytics",
|
|
82
|
-
active: false,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
1
|
+
import { RightCircleOutlined } from "@ant-design/icons";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import { Sidebar, SidebarProps } from '.';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Sidebar',
|
|
7
|
+
component: Sidebar,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<SidebarProps> = (args) => {
|
|
11
|
+
const navigate = (targetRoute: string) => {
|
|
12
|
+
console.log(targetRoute);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <Sidebar {...args} navigateFunction={navigate}></Sidebar>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Primary = Template.bind({});
|
|
19
|
+
Primary.args = {
|
|
20
|
+
isOpen: true,
|
|
21
|
+
links: [
|
|
22
|
+
{
|
|
23
|
+
label: "Ciclo de Avaliação",
|
|
24
|
+
targetRoute: "/ciclodeavaliacao",
|
|
25
|
+
active: true,
|
|
26
|
+
icon: <RightCircleOutlined />,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Gestão de Questionários",
|
|
30
|
+
targetRoute: "/gestaodequestionarios",
|
|
31
|
+
active: true,
|
|
32
|
+
sublinks: [
|
|
33
|
+
{
|
|
34
|
+
label: "Subpage 1121212",
|
|
35
|
+
targetRoute: "/analytics/subpage121212",
|
|
36
|
+
active: false,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "Subpage 2111",
|
|
40
|
+
targetRoute: "/analytics/subpage211",
|
|
41
|
+
active: false
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "Analytics",
|
|
47
|
+
targetRoute: "/analytics",
|
|
48
|
+
active: false,
|
|
49
|
+
sublinks: [
|
|
50
|
+
{
|
|
51
|
+
label: "Subpage 1",
|
|
52
|
+
targetRoute: "/analytics/subpage1",
|
|
53
|
+
active: false,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "Subpage 2",
|
|
57
|
+
targetRoute: "/analytics/subpage2",
|
|
58
|
+
active: false
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const Secondary = Template.bind({});
|
|
66
|
+
Secondary.args = {
|
|
67
|
+
isOpen: false,
|
|
68
|
+
links: [
|
|
69
|
+
{
|
|
70
|
+
label: "Ciclo de Avaliação",
|
|
71
|
+
targetRoute: "/ciclodeavaliacao",
|
|
72
|
+
active: false,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "Gestão de Questionários",
|
|
76
|
+
targetRoute: "/gestaodequestionarios",
|
|
77
|
+
active: false,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: "Analytics",
|
|
81
|
+
targetRoute: "/analytics",
|
|
82
|
+
active: false,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export interface Links {
|
|
7
|
-
label: string;
|
|
8
|
-
targetRoute: string;
|
|
9
|
-
active: boolean;
|
|
10
|
-
icon?: React.ReactNode;
|
|
11
|
-
sublinks?: Links[];
|
|
12
|
-
activeSubMenu?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SidebarProps {
|
|
16
|
-
isOpen?: boolean;
|
|
17
|
-
links: Links[];
|
|
18
|
-
navigateFunction: (targetRoute: string) => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Sidebar = (props: SidebarProps) => {
|
|
22
|
-
const { isOpen = false, links, navigateFunction } = props;
|
|
23
|
-
const [sidebarOpen, setSidebarOpen] = useState<boolean>(isOpen);
|
|
24
|
-
const [activeSubMenuIndex, setActiveSubMenuIndex] = useState<number>(-1);
|
|
25
|
-
|
|
26
|
-
const sidebarClasses = classNames({
|
|
27
|
-
[styles.sidebarClosed]: !sidebarOpen,
|
|
28
|
-
}, styles.sidebar);
|
|
29
|
-
|
|
30
|
-
const toggleSidebar = () => {
|
|
31
|
-
setSidebarOpen(!sidebarOpen);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const toggleSubMenu = (index: number) => {
|
|
35
|
-
setActiveSubMenuIndex(activeSubMenuIndex === index ? -1 : index);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const isLinkActive = (link: Links) => {
|
|
39
|
-
if (link.sublinks) {
|
|
40
|
-
return link.sublinks.some(sublink => sublink.active);
|
|
41
|
-
}
|
|
42
|
-
return link.active;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className={sidebarClasses}>
|
|
47
|
-
<div className={styles.toggle} onClick={toggleSidebar}>
|
|
48
|
-
{sidebarOpen ? <DoubleRightOutlined /> : <DoubleLeftOutlined />}
|
|
49
|
-
</div>
|
|
50
|
-
{links &&
|
|
51
|
-
links.map((link: Links, index: number) => {
|
|
52
|
-
const { label, targetRoute, icon, sublinks } = link;
|
|
53
|
-
const isActive = isLinkActive(link);
|
|
54
|
-
const isActiveSubMenu = activeSubMenuIndex === index;
|
|
55
|
-
|
|
56
|
-
const sidebarItemClasses = classNames({
|
|
57
|
-
[styles.sidebarItemActive]: isActive,
|
|
58
|
-
[styles.sidebarHasIcon]: icon
|
|
59
|
-
}, styles.sidebarItem);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div
|
|
63
|
-
className={sidebarItemClasses}
|
|
64
|
-
onClick={() => {
|
|
65
|
-
if (sublinks) {
|
|
66
|
-
toggleSubMenu(index);
|
|
67
|
-
} else {
|
|
68
|
-
navigateFunction(targetRoute);
|
|
69
|
-
}
|
|
70
|
-
}}
|
|
71
|
-
onMouseEnter={() => toggleSubMenu(index)}
|
|
72
|
-
onMouseLeave={() => toggleSubMenu(-1)}
|
|
73
|
-
key={index}
|
|
74
|
-
>
|
|
75
|
-
{icon ? (sidebarOpen ? label : icon) : label}
|
|
76
|
-
{sublinks && isActiveSubMenu && (
|
|
77
|
-
<div className={`${sidebarOpen ? styles.subMenu : ''}`}>
|
|
78
|
-
{sublinks.map((sublink: Links, subindex: number) => {
|
|
79
|
-
const { label: subLabel, targetRoute: subTargetRoute, active: subActive, icon: subIcon } = sublink;
|
|
80
|
-
|
|
81
|
-
const subLinkClasses = classNames({
|
|
82
|
-
[styles.sidebarItemActive]: subActive,
|
|
83
|
-
[styles.sidebarHasIcon]: icon,
|
|
84
|
-
}, styles.subMenuItem);
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<div
|
|
88
|
-
className={`${styles.sidebarItem} ${subLinkClasses}`}
|
|
89
|
-
onClick={() => navigateFunction(subTargetRoute)}
|
|
90
|
-
key={subindex}
|
|
91
|
-
>
|
|
92
|
-
{subIcon ? (sidebarOpen ? subLabel : subIcon) : (sidebarOpen ? subLabel : subLabel.charAt(0))}
|
|
93
|
-
</div>
|
|
94
|
-
);
|
|
95
|
-
})}
|
|
96
|
-
</div>
|
|
97
|
-
)}
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
})}
|
|
101
|
-
</div>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface Links {
|
|
7
|
+
label: string;
|
|
8
|
+
targetRoute: string;
|
|
9
|
+
active: boolean;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
sublinks?: Links[];
|
|
12
|
+
activeSubMenu?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SidebarProps {
|
|
16
|
+
isOpen?: boolean;
|
|
17
|
+
links: Links[];
|
|
18
|
+
navigateFunction: (targetRoute: string) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Sidebar = (props: SidebarProps) => {
|
|
22
|
+
const { isOpen = false, links, navigateFunction } = props;
|
|
23
|
+
const [sidebarOpen, setSidebarOpen] = useState<boolean>(isOpen);
|
|
24
|
+
const [activeSubMenuIndex, setActiveSubMenuIndex] = useState<number>(-1);
|
|
25
|
+
|
|
26
|
+
const sidebarClasses = classNames({
|
|
27
|
+
[styles.sidebarClosed]: !sidebarOpen,
|
|
28
|
+
}, styles.sidebar);
|
|
29
|
+
|
|
30
|
+
const toggleSidebar = () => {
|
|
31
|
+
setSidebarOpen(!sidebarOpen);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const toggleSubMenu = (index: number) => {
|
|
35
|
+
setActiveSubMenuIndex(activeSubMenuIndex === index ? -1 : index);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const isLinkActive = (link: Links) => {
|
|
39
|
+
if (link.sublinks) {
|
|
40
|
+
return link.sublinks.some(sublink => sublink.active);
|
|
41
|
+
}
|
|
42
|
+
return link.active;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={sidebarClasses}>
|
|
47
|
+
<div className={styles.toggle} onClick={toggleSidebar}>
|
|
48
|
+
{sidebarOpen ? <DoubleRightOutlined /> : <DoubleLeftOutlined />}
|
|
49
|
+
</div>
|
|
50
|
+
{links &&
|
|
51
|
+
links.map((link: Links, index: number) => {
|
|
52
|
+
const { label, targetRoute, icon, sublinks } = link;
|
|
53
|
+
const isActive = isLinkActive(link);
|
|
54
|
+
const isActiveSubMenu = activeSubMenuIndex === index;
|
|
55
|
+
|
|
56
|
+
const sidebarItemClasses = classNames({
|
|
57
|
+
[styles.sidebarItemActive]: isActive,
|
|
58
|
+
[styles.sidebarHasIcon]: icon
|
|
59
|
+
}, styles.sidebarItem);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
className={sidebarItemClasses}
|
|
64
|
+
onClick={() => {
|
|
65
|
+
if (sublinks) {
|
|
66
|
+
toggleSubMenu(index);
|
|
67
|
+
} else {
|
|
68
|
+
navigateFunction(targetRoute);
|
|
69
|
+
}
|
|
70
|
+
}}
|
|
71
|
+
onMouseEnter={() => toggleSubMenu(index)}
|
|
72
|
+
onMouseLeave={() => toggleSubMenu(-1)}
|
|
73
|
+
key={index}
|
|
74
|
+
>
|
|
75
|
+
{icon ? (sidebarOpen ? label : icon) : label}
|
|
76
|
+
{sublinks && isActiveSubMenu && (
|
|
77
|
+
<div className={`${sidebarOpen ? styles.subMenu : ''}`}>
|
|
78
|
+
{sublinks.map((sublink: Links, subindex: number) => {
|
|
79
|
+
const { label: subLabel, targetRoute: subTargetRoute, active: subActive, icon: subIcon } = sublink;
|
|
80
|
+
|
|
81
|
+
const subLinkClasses = classNames({
|
|
82
|
+
[styles.sidebarItemActive]: subActive,
|
|
83
|
+
[styles.sidebarHasIcon]: icon,
|
|
84
|
+
}, styles.subMenuItem);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
className={`${styles.sidebarItem} ${subLinkClasses}`}
|
|
89
|
+
onClick={() => navigateFunction(subTargetRoute)}
|
|
90
|
+
key={subindex}
|
|
91
|
+
>
|
|
92
|
+
{subIcon ? (sidebarOpen ? subLabel : subIcon) : (sidebarOpen ? subLabel : subLabel.charAt(0))}
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
96
|
+
</div>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
})}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
104
|
|