w-design-system 0.0.34 → 0.0.36
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/components/Paginate/index.d.ts +2 -1
- package/dist/components/Paginate/index.d.ts.map +1 -1
- package/dist/components/Paginate/index.js +8 -8
- package/dist/components/Paginate/index.js.map +1 -1
- package/dist/components/Paginate/stories.d.ts +1 -0
- package/dist/components/Paginate/stories.d.ts.map +1 -1
- package/dist/components/Paginate/stories.js +7 -2
- package/dist/components/Paginate/stories.js.map +1 -1
- package/dist/components/Paginate/styles.d.ts.map +1 -1
- package/dist/components/Paginate/styles.js +5 -38
- package/dist/components/Paginate/styles.js.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +5 -5
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/stories.js +1 -0
- package/dist/components/Select/stories.js.map +1 -1
- package/dist/components/Sidebar/SidebarGroup/index.js +2 -2
- package/dist/components/Sidebar/SidebarGroup/index.js.map +1 -1
- package/dist/components/Sidebar/SidebarGroup/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarGroup/styles.js +4 -6
- package/dist/components/Sidebar/SidebarGroup/styles.js.map +1 -1
- package/dist/components/Sidebar/SidebarItem/index.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarItem/index.js +8 -5
- package/dist/components/Sidebar/SidebarItem/index.js.map +1 -1
- package/dist/components/Sidebar/SidebarItem/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarItem/styles.js +3 -1
- package/dist/components/Sidebar/SidebarItem/styles.js.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/index.d.ts +2 -1
- package/dist/components/Sidebar/SidebarLogo/index.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/index.js +2 -2
- package/dist/components/Sidebar/SidebarLogo/index.js.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/styles.d.ts +1 -0
- package/dist/components/Sidebar/SidebarLogo/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarLogo/styles.js +3 -2
- package/dist/components/Sidebar/SidebarLogo/styles.js.map +1 -1
- package/dist/components/Sidebar/index.d.ts +2 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +4 -3
- package/dist/components/Sidebar/index.js.map +1 -1
- package/dist/components/Sidebar/stories.d.ts.map +1 -1
- package/dist/components/Sidebar/stories.js +61 -3
- package/dist/components/Sidebar/stories.js.map +1 -1
- package/dist/components/Sidebar/styles.d.ts +1 -0
- package/dist/components/Sidebar/styles.d.ts.map +1 -1
- package/dist/components/Sidebar/styles.js +1 -2
- package/dist/components/Sidebar/styles.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Paginate/index.tsx +10 -6
- package/src/components/Paginate/stories.tsx +9 -3
- package/src/components/Paginate/styles.ts +5 -38
- package/src/components/Select/index.tsx +5 -3
- package/src/components/Select/stories.tsx +1 -1
- package/src/components/Sidebar/SidebarGroup/index.tsx +3 -3
- package/src/components/Sidebar/SidebarGroup/styles.ts +4 -6
- package/src/components/Sidebar/SidebarItem/index.tsx +15 -11
- package/src/components/Sidebar/SidebarItem/styles.ts +3 -1
- package/src/components/Sidebar/SidebarLogo/index.tsx +3 -2
- package/src/components/Sidebar/SidebarLogo/styles.ts +4 -2
- package/src/components/Sidebar/index.tsx +5 -3
- package/src/components/Sidebar/stories.tsx +88 -30
- package/src/components/Sidebar/styles.ts +2 -2
|
@@ -6,11 +6,69 @@ const meta = {
|
|
|
6
6
|
title: 'Components/Sidebar',
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
component: Sidebar,
|
|
9
|
+
argTypes: {
|
|
10
|
+
layout: {
|
|
11
|
+
control: 'object',
|
|
12
|
+
description: 'Array of sidebar layout',
|
|
13
|
+
},
|
|
14
|
+
currentItemId: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Current item id',
|
|
17
|
+
},
|
|
18
|
+
currentGroupId: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Current group id',
|
|
21
|
+
},
|
|
22
|
+
setLink: {
|
|
23
|
+
action: 'setLink',
|
|
24
|
+
description: 'Function to set link',
|
|
25
|
+
},
|
|
26
|
+
items: {
|
|
27
|
+
control: 'object',
|
|
28
|
+
description: 'Items data',
|
|
29
|
+
},
|
|
30
|
+
groups: {
|
|
31
|
+
control: 'object',
|
|
32
|
+
description: 'Groups data',
|
|
33
|
+
},
|
|
34
|
+
logoUrl: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Logo url',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
args: {
|
|
40
|
+
layout: [
|
|
41
|
+
{
|
|
42
|
+
type: 'item',
|
|
43
|
+
id: 'DASHBOARD',
|
|
44
|
+
},
|
|
45
|
+
{ type: 'group', id: 'group1' },
|
|
46
|
+
],
|
|
47
|
+
currentItemId: 'DASHBOARD',
|
|
48
|
+
currentGroupId: 'DASHBOARD',
|
|
49
|
+
items: {
|
|
50
|
+
DASHBOARD: {
|
|
51
|
+
menuTitle: 'Dashboard',
|
|
52
|
+
icon: dashboardSVG,
|
|
53
|
+
link: '/dashboard',
|
|
54
|
+
disabled: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
groups: {
|
|
58
|
+
group1: {
|
|
59
|
+
name: 'Group 1',
|
|
60
|
+
icon: dashboardSVG,
|
|
61
|
+
itemIds: ['DASHBOARD'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
logoUrl: '',
|
|
65
|
+
baseColor: '',
|
|
66
|
+
},
|
|
9
67
|
};
|
|
10
68
|
export default meta;
|
|
11
69
|
export const Playground = {
|
|
12
|
-
render:
|
|
13
|
-
return (React.createElement(Sidebar, { layout: [
|
|
70
|
+
render: args => {
|
|
71
|
+
return (React.createElement(Sidebar, Object.assign({}, args, { layout: [
|
|
14
72
|
{
|
|
15
73
|
type: 'item',
|
|
16
74
|
id: 'DASHBOARD',
|
|
@@ -29,7 +87,7 @@ export const Playground = {
|
|
|
29
87
|
icon: dashboardSVG,
|
|
30
88
|
itemIds: ['DASHBOARD'],
|
|
31
89
|
},
|
|
32
|
-
}, logoUrl: '' }));
|
|
90
|
+
}, logoUrl: '' })));
|
|
33
91
|
},
|
|
34
92
|
};
|
|
35
93
|
//# sourceMappingURL=stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../src/components/Sidebar/stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,IAAI,GAAyB;IACjC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../src/components/Sidebar/stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,IAAI,GAAyB;IACjC,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE;QACR,MAAM,EAAE;YACN,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,yBAAyB;SACvC;QACD,aAAa,EAAE;YACb,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,iBAAiB;SAC/B;QACD,cAAc,EAAE;YACd,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,kBAAkB;SAChC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,sBAAsB;SACpC;QACD,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;SAC1B;QACD,MAAM,EAAE;YACN,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,aAAa;SAC3B;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,UAAU;SACxB;KACF;IACD,IAAI,EAAE;QACJ,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,MAAM;gBACZ,EAAE,EAAE,WAAW;aAChB;YACD,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE;SAChC;QACD,aAAa,EAAE,WAAW;QAC1B,cAAc,EAAE,WAAW;QAC3B,KAAK,EAAE;YACL,SAAS,EAAE;gBACT,SAAS,EAAE,WAAW;gBACtB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,CAAC,WAAW,CAAC;aACvB;SACF;QACD,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,EAAE;KACd;CAC6B,CAAA;AAEhC,eAAe,IAAI,CAAA;AAInB,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,MAAM,EAAE,IAAI,CAAC,EAAE;QACb,OAAO,CACL,oBAAC,OAAO,oBACF,IAAI,IACR,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,MAAM;oBACZ,EAAE,EAAE,WAAW;iBAChB;gBACD,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE;aAChC,EACD,KAAK,EAAE;gBACL,SAAS,EAAE;oBACT,SAAS,EAAE,WAAW;oBACtB,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,KAAK;iBAChB;aACF,EACD,aAAa,EAAE,EAAE,EACjB,cAAc,EAAE,EAAE,EAClB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,EAC1B,MAAM,EAAE;gBACN,MAAM,EAAE;oBACN,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,YAAY;oBAClB,OAAO,EAAE,CAAC,WAAW,CAAC;iBACvB;aACF,EACD,OAAO,EAAE,EAAE,IACX,CACH,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface SidebarContainerProps {
|
|
2
2
|
sidebarOpen: boolean;
|
|
3
|
+
baseColor?: string;
|
|
3
4
|
}
|
|
4
5
|
export declare const SidebarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SidebarContainerProps>> & string;
|
|
5
6
|
export declare const SidebarScrollContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,WAAW,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,0PA2B5B,CAAA;AAED,eAAO,MAAM,sBAAsB,6NAMlC,CAAA;AAED,eAAO,MAAM,6BAA6B,6NA8BzC,CAAA;AAED,eAAO,MAAM,aAAa,6NAEzB,CAAA"}
|
|
@@ -7,13 +7,12 @@ export const SidebarContainer = styled.div `
|
|
|
7
7
|
position: relative;
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
color: white;
|
|
10
|
-
background: ${theme.colors.cyan50};
|
|
11
10
|
height: 100vh;
|
|
12
11
|
height: 100dvh;
|
|
13
12
|
padding: 16px 16px 0 16px;
|
|
14
13
|
width: min-content;
|
|
15
14
|
border-radius: ${({ sidebarOpen }) => sidebarOpen && '0 60px 0px 0;'};
|
|
16
|
-
|
|
15
|
+
background: ${({ baseColor }) => baseColor || theme.colors.cyan50};
|
|
17
16
|
/* Mantenha o estilo do container ao passar o mouse */
|
|
18
17
|
&:hover {
|
|
19
18
|
&::-webkit-scrollbar {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Sidebar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAOjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;;;;;;;;mBAW9C,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,IAAI,eAAe;gBACtD,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM;;;;;;;;;;;;;;;CAelE,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM/C,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BtD,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEtC,CAAA"}
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ export type PaginateProps = {
|
|
|
10
10
|
onChangePage: (page: number) => void
|
|
11
11
|
onChangeItemsPerPage: (itemsPerPage: number) => void
|
|
12
12
|
dropDownTop?: boolean
|
|
13
|
+
itemPerPageOptions?: number[]
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const Paginate = ({
|
|
@@ -18,7 +19,8 @@ export const Paginate = ({
|
|
|
18
19
|
onChangePage,
|
|
19
20
|
itemsPerPage,
|
|
20
21
|
onChangeItemsPerPage,
|
|
21
|
-
|
|
22
|
+
itemPerPageOptions = [],
|
|
23
|
+
dropDownTop,
|
|
22
24
|
}: PaginateProps) => {
|
|
23
25
|
// Se itemsPerPage for undefined, o valor default e 20
|
|
24
26
|
let itemsPerPageValue = itemsPerPage || 20
|
|
@@ -58,10 +60,10 @@ export const Paginate = ({
|
|
|
58
60
|
const minItem = (currentPage - 1) * itemsPerPageValue + 1
|
|
59
61
|
const maxItem = Math.min(currentPage * itemsPerPageValue, itemCount)
|
|
60
62
|
|
|
61
|
-
const
|
|
62
|
-
if (itemsPerPage)
|
|
63
|
+
const itemPerPageOptionsCopy = Array.from(itemPerPageOptions)
|
|
64
|
+
if (itemsPerPage) itemPerPageOptionsCopy.push(itemsPerPage)
|
|
63
65
|
|
|
64
|
-
const itemPerPageOptionsSorted = Array.from(new Set(
|
|
66
|
+
const itemPerPageOptionsSorted = Array.from(new Set(itemPerPageOptionsCopy)).sort((a, b) => a - b)
|
|
65
67
|
|
|
66
68
|
return (
|
|
67
69
|
<Container>
|
|
@@ -70,7 +72,7 @@ export const Paginate = ({
|
|
|
70
72
|
className={currentPage === 1 ? 'icon-disabled' : 'icon'}
|
|
71
73
|
src={chevronLeftSVG}
|
|
72
74
|
width="14px"
|
|
73
|
-
onClick={() => onChangePage(currentPage - 1)}
|
|
75
|
+
onClick={() => currentPage !== 1 && onChangePage(currentPage - 1)}
|
|
74
76
|
/>
|
|
75
77
|
{pages.map((page, index) => {
|
|
76
78
|
if (page === 'elipsis') {
|
|
@@ -86,17 +88,19 @@ export const Paginate = ({
|
|
|
86
88
|
className={currentPage === pageCount ? 'icon-disabled' : 'icon'}
|
|
87
89
|
src={chevronRightSVG}
|
|
88
90
|
width="14px"
|
|
89
|
-
onClick={() => onChangePage(currentPage + 1)}
|
|
91
|
+
onClick={() => currentPage !== pageCount && onChangePage(currentPage + 1)}
|
|
90
92
|
/>
|
|
91
93
|
</ul>
|
|
92
94
|
<div className="items-per-page-wrapper">
|
|
93
95
|
<div className="item-per-page">Itens por página</div>
|
|
94
96
|
<Select
|
|
97
|
+
className="select"
|
|
95
98
|
dropDownTop={dropDownTop !== false}
|
|
96
99
|
value={itemsPerPageValue.toString()}
|
|
97
100
|
onOptionChange={option => {
|
|
98
101
|
option && onChangeItemsPerPage(option.id)
|
|
99
102
|
}}
|
|
103
|
+
disabled={itemPerPageOptions.length <= 1}
|
|
100
104
|
options={itemPerPageOptionsSorted.map(count => ({
|
|
101
105
|
id: count,
|
|
102
106
|
text: count?.toString(),
|
|
@@ -15,14 +15,14 @@ const meta: Meta<PaginateProps> = {
|
|
|
15
15
|
itemsPerPage: 10,
|
|
16
16
|
onChangePage: fn(),
|
|
17
17
|
onChangeItemsPerPage: fn(),
|
|
18
|
+
dropDownTop: true,
|
|
18
19
|
},
|
|
19
|
-
}
|
|
20
|
+
} satisfies Meta<PaginateProps>
|
|
20
21
|
|
|
21
22
|
export default meta
|
|
22
23
|
|
|
23
24
|
const NewPaginate = (args: PaginateProps) => {
|
|
24
25
|
const [currentPage, setCurrentPage] = useState(args.currentPage)
|
|
25
|
-
const [itemCount, setItemCount] = useState(args.itemCount)
|
|
26
26
|
const [itemsPerPage, setItemsPerPage] = useState(args.itemsPerPage)
|
|
27
27
|
|
|
28
28
|
const handleChangePage = (page: number) => {
|
|
@@ -40,7 +40,7 @@ const NewPaginate = (args: PaginateProps) => {
|
|
|
40
40
|
<Paginate
|
|
41
41
|
{...args}
|
|
42
42
|
currentPage={currentPage}
|
|
43
|
-
itemCount={itemCount}
|
|
43
|
+
itemCount={args.itemCount}
|
|
44
44
|
itemsPerPage={itemsPerPage}
|
|
45
45
|
onChangePage={handleChangePage}
|
|
46
46
|
onChangeItemsPerPage={handleChangeItemsPerPage}
|
|
@@ -54,3 +54,9 @@ export const Default: StoryObj<PaginateProps> = {
|
|
|
54
54
|
return <NewPaginate {...args} />
|
|
55
55
|
},
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
export const Bottom: StoryObj<PaginateProps> = {
|
|
59
|
+
render: args => {
|
|
60
|
+
return <NewPaginate {...args} itemPerPageOptions={[10, 50, 100]} />
|
|
61
|
+
},
|
|
62
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components'
|
|
2
2
|
import { theme } from '../Themes'
|
|
3
|
-
import { chevronDownSVG } from '../../assets/icon'
|
|
4
3
|
export const Container = styled.div`
|
|
5
4
|
display: flex;
|
|
6
5
|
justify-content: space-between;
|
|
@@ -51,46 +50,14 @@ export const Container = styled.div`
|
|
|
51
50
|
.items-per-page-wrapper {
|
|
52
51
|
display: flex;
|
|
53
52
|
align-items: center;
|
|
54
|
-
|
|
53
|
+
width: min-content;
|
|
54
|
+
text-wrap: nowrap;
|
|
55
55
|
gap: 1rem;
|
|
56
56
|
font-family: 'Nunito Sans', sans-serif;
|
|
57
57
|
color: ${theme.colors.shade40};
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
background-color: ${theme.colors.shade05};
|
|
63
|
-
background-image: url(${chevronDownSVG});
|
|
64
|
-
background-repeat: no-repeat;
|
|
65
|
-
background-size: 1rem;
|
|
66
|
-
background-position: right 1rem top calc(50% + 1px);
|
|
67
|
-
border: 1px solid ${theme.colors.shade20};
|
|
68
|
-
color: ${theme.colors.shade40};
|
|
69
|
-
border-radius: 4px;
|
|
70
|
-
display: inline-block;
|
|
71
|
-
font: inherit;
|
|
72
|
-
outline: 0;
|
|
73
|
-
|
|
74
|
-
padding: 18px 48px 14px 16px;
|
|
75
|
-
|
|
76
|
-
margin: 0;
|
|
77
|
-
-webkit-box-sizing: border-box;
|
|
78
|
-
-moz-box-sizing: border-box;
|
|
79
|
-
box-sizing: border-box;
|
|
80
|
-
-webkit-appearance: none;
|
|
81
|
-
-moz-appearance: none; /* Firefox */
|
|
82
|
-
-webkit-appearance: none; /* Safari and Chrome */
|
|
83
|
-
appearance: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
select:hover {
|
|
87
|
-
background-color: ${theme.colors.shade10};
|
|
88
|
-
border: 1px solid ${theme.colors.shade20};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
select:focus {
|
|
92
|
-
background-color: ${theme.colors.shade10};
|
|
93
|
-
border: 1px solid ${theme.colors.shade30};
|
|
94
|
-
}
|
|
60
|
+
.select {
|
|
61
|
+
min-width: 100px;
|
|
95
62
|
}
|
|
96
63
|
`
|
|
@@ -6,7 +6,7 @@ import React, {
|
|
|
6
6
|
useImperativeHandle,
|
|
7
7
|
useMemo,
|
|
8
8
|
useRef,
|
|
9
|
-
useState
|
|
9
|
+
useState,
|
|
10
10
|
} from 'react'
|
|
11
11
|
import { chevronDownSVG } from '../../assets/icon'
|
|
12
12
|
import { IconWrapper } from '../IconWrapper'
|
|
@@ -46,6 +46,7 @@ const SelectFowardRef = <T extends { text: string; id: number; icon?: ReactNode
|
|
|
46
46
|
selectedOption,
|
|
47
47
|
value,
|
|
48
48
|
dropDownWidth,
|
|
49
|
+
disabled,
|
|
49
50
|
...props
|
|
50
51
|
}: PropsWithChildren<SelectProps<T>>,
|
|
51
52
|
ref: React.ForwardedRef<SelectRef>,
|
|
@@ -87,11 +88,12 @@ const SelectFowardRef = <T extends { text: string; id: number; icon?: ReactNode
|
|
|
87
88
|
return selectedOption.text
|
|
88
89
|
}
|
|
89
90
|
return ''
|
|
90
|
-
}, [value, selectedOption
|
|
91
|
+
}, [value, selectedOption])
|
|
91
92
|
|
|
92
93
|
return (
|
|
93
94
|
<SelectWrapper {...props} ref={wrapperRef}>
|
|
94
95
|
<Input
|
|
96
|
+
disabled={disabled}
|
|
95
97
|
leftIcon={leftIcon}
|
|
96
98
|
rightIcon={
|
|
97
99
|
<>
|
|
@@ -108,7 +110,7 @@ const SelectFowardRef = <T extends { text: string; id: number; icon?: ReactNode
|
|
|
108
110
|
label={label}
|
|
109
111
|
value={valueComputed}
|
|
110
112
|
readonly
|
|
111
|
-
onClick={() => setOpen(!open)}
|
|
113
|
+
onClick={() => !disabled && setOpen(!open)}
|
|
112
114
|
/>
|
|
113
115
|
{open && (
|
|
114
116
|
<DropdownWrapper>
|
|
@@ -62,7 +62,7 @@ const SidebarGroup = ({
|
|
|
62
62
|
groupOpen={groupOpen}
|
|
63
63
|
onClick={onClickHandler}
|
|
64
64
|
>
|
|
65
|
-
<IconWrapper src={icon} color={color} />
|
|
65
|
+
<IconWrapper src={icon} color={color} width="20px" />
|
|
66
66
|
{sidebarOpen && (
|
|
67
67
|
<span className="title">
|
|
68
68
|
<Paragraph size="medium" heavyBod={isCurrentGroup} color={disabled ? theme.colors.shade40 : 'white'}>
|
|
@@ -75,11 +75,11 @@ const SidebarGroup = ({
|
|
|
75
75
|
<IconWrapper
|
|
76
76
|
className={`icon ${groupOpen ? 'icon-rotate' : ''}`}
|
|
77
77
|
src={chevronDownSVG}
|
|
78
|
-
width="
|
|
78
|
+
width="20px"
|
|
79
79
|
color={theme.colors.shade30}
|
|
80
80
|
/>
|
|
81
81
|
) : (
|
|
82
|
-
<IconWrapper src={lockSVG} width="
|
|
82
|
+
<IconWrapper src={lockSVG} width="20px" color="white" />
|
|
83
83
|
))}
|
|
84
84
|
</SidebarGroupHeaderContainer>
|
|
85
85
|
{children}
|
|
@@ -17,7 +17,7 @@ export const SidebarGroupContainer = styled.div<SidebarGroupContainerProps>`
|
|
|
17
17
|
border-radius: 4px;
|
|
18
18
|
|
|
19
19
|
&:hover {
|
|
20
|
-
background-color:
|
|
20
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.wrapperTitle {
|
|
@@ -50,10 +50,10 @@ export const SidebarGroupHeaderContainer = styled.div<SidebarGroupContainerHeade
|
|
|
50
50
|
align-items: center;
|
|
51
51
|
min-height: ${({ groupOpen, sidebarOpen }) => (groupOpen && sidebarOpen ? '40px' : '40px')};
|
|
52
52
|
${({ groupOpen, sidebarOpen }) => groupOpen && sidebarOpen && 'border-bottom: 1px solid rgba(255, 255, 255, 0.1)'};
|
|
53
|
-
justify-content: ${sidebarOpen => (sidebarOpen ? 'space-between' : 'center')};
|
|
53
|
+
justify-content: ${({ sidebarOpen }) => (sidebarOpen ? 'space-between' : 'center')};
|
|
54
54
|
text-wrap: nowrap;
|
|
55
55
|
|
|
56
|
-
padding: 8px
|
|
56
|
+
padding: 8px 8px;
|
|
57
57
|
cursor: pointer;
|
|
58
58
|
height: 100%;
|
|
59
59
|
gap: 24px;
|
|
@@ -64,9 +64,7 @@ export const SidebarGroupHeaderContainer = styled.div<SidebarGroupContainerHeade
|
|
|
64
64
|
width: 100%;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
width: 20px;
|
|
69
|
-
}
|
|
67
|
+
|
|
70
68
|
`
|
|
71
69
|
|
|
72
70
|
export const LockedModal = styled.div`
|
|
@@ -3,6 +3,7 @@ import { IconWrapper } from '../../IconWrapper'
|
|
|
3
3
|
import { Paragraph } from '../../Paragraph'
|
|
4
4
|
import { Bullet, Container } from './styles'
|
|
5
5
|
import { theme } from '../../Themes'
|
|
6
|
+
import { lockSVG } from '../../../assets/icon'
|
|
6
7
|
|
|
7
8
|
export interface SidebarItemProps {
|
|
8
9
|
disabled?: boolean
|
|
@@ -46,21 +47,24 @@ const SidebarItem = ({
|
|
|
46
47
|
) : (
|
|
47
48
|
icon && (
|
|
48
49
|
<div className="icon">
|
|
49
|
-
<IconWrapper src={icon} color={color} />
|
|
50
|
+
<IconWrapper src={icon} color={color} width='20px' />
|
|
50
51
|
</div>
|
|
51
52
|
)
|
|
52
53
|
)}
|
|
53
54
|
{sidebarOpen && (
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
<>
|
|
56
|
+
<span className="title">
|
|
57
|
+
<Paragraph
|
|
58
|
+
size={!isInsideGroup ? 'medium' : 'small'}
|
|
59
|
+
/* eslint-disable-next-line no-nested-ternary */
|
|
60
|
+
color={disabled ? theme.colors.shade40 : !isInsideGroup ? 'white' : theme.colors.shade10}
|
|
61
|
+
heavyBod={isCurrentItem}
|
|
62
|
+
>
|
|
63
|
+
{title}
|
|
64
|
+
</Paragraph>
|
|
65
|
+
</span>
|
|
66
|
+
{disabled && <IconWrapper src={lockSVG} width="20px" color="white" />}
|
|
67
|
+
</>
|
|
64
68
|
)}
|
|
65
69
|
</Container>
|
|
66
70
|
)
|
|
@@ -18,9 +18,11 @@ export const Container = styled.div<SidebarItemContainerProps>`
|
|
|
18
18
|
color: ${({ disabled }) => (disabled ? 'rgba(255,255,255,0.4)' : '#fff')};
|
|
19
19
|
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
|
|
20
20
|
border-radius: ${({ isInsideGroup }) => !isInsideGroup && '4px'};
|
|
21
|
+
|
|
21
22
|
&:hover {
|
|
22
|
-
background-color:
|
|
23
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
&:not(:last-child) {
|
|
25
27
|
border-bottom: ${({ isInsideGroup }) => isInsideGroup && '1px solid rgba(255, 255, 255, 0.1)'};
|
|
26
28
|
}
|
|
@@ -8,11 +8,12 @@ export interface SidebarLogoProps {
|
|
|
8
8
|
logoOpacity?: number
|
|
9
9
|
setSidebarOpen: (value: boolean) => void
|
|
10
10
|
logoUrl: string
|
|
11
|
+
baseColor?: string
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
const SidebarLogo = ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl }: SidebarLogoProps) => {
|
|
14
|
+
const SidebarLogo = ({ sidebarOpen, setSidebarOpen, logoOpacity, logoUrl, baseColor }: SidebarLogoProps) => {
|
|
14
15
|
return (
|
|
15
|
-
<SidebarLogoContainer logoUrl={logoUrl} logoOpacity={logoOpacity} sidebarOpen={sidebarOpen}>
|
|
16
|
+
<SidebarLogoContainer logoUrl={logoUrl} logoOpacity={logoOpacity} sidebarOpen={sidebarOpen} baseColor={baseColor}>
|
|
16
17
|
<button type="button" onClick={() => setSidebarOpen(!sidebarOpen)} className="close" aria-label="Fechar menu">
|
|
17
18
|
<IconWrapper src={sidebarOpen ? chevronRightSVG : chevronLeftSVG} color="#fff" width="12px" height="12px" />
|
|
18
19
|
</button>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import styled from 'styled-components'
|
|
2
|
+
import { theme } from '../../Themes'
|
|
2
3
|
|
|
3
4
|
interface SidebarLogoContainerProps {
|
|
4
5
|
logoOpacity?: number
|
|
5
6
|
sidebarOpen: boolean
|
|
6
7
|
logoUrl: string
|
|
8
|
+
baseColor?: string
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const SidebarLogoContainer = styled.div<SidebarLogoContainerProps>`
|
|
@@ -18,7 +20,7 @@ export const SidebarLogoContainer = styled.div<SidebarLogoContainerProps>`
|
|
|
18
20
|
height: 40px;
|
|
19
21
|
|
|
20
22
|
background: url(${({ logoUrl }) => logoUrl});
|
|
21
|
-
background-size: ${({ sidebarOpen
|
|
23
|
+
background-size: ${({ sidebarOpen }) => (sidebarOpen ? `202px 40px` : '141px 28px')};
|
|
22
24
|
background-repeat: no-repeat;
|
|
23
25
|
background-position: -8px 0px;
|
|
24
26
|
|
|
@@ -37,7 +39,7 @@ export const SidebarLogoContainer = styled.div<SidebarLogoContainerProps>`
|
|
|
37
39
|
height: var(--height);
|
|
38
40
|
width: var(--width);
|
|
39
41
|
|
|
40
|
-
background:
|
|
42
|
+
background: ${({ baseColor }) => baseColor || theme.colors.cyan50};
|
|
41
43
|
color: #fff;
|
|
42
44
|
|
|
43
45
|
border-radius: 0 var(--width) var(--width) 0;
|
|
@@ -44,6 +44,7 @@ export interface SidebarProps {
|
|
|
44
44
|
groups: Record<string, SidebarGroupData>
|
|
45
45
|
logoUrl: string
|
|
46
46
|
logoOpacity?: number
|
|
47
|
+
baseColor?: string
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export const Sidebar = ({
|
|
@@ -55,22 +56,23 @@ export const Sidebar = ({
|
|
|
55
56
|
items,
|
|
56
57
|
logoOpacity,
|
|
57
58
|
groups,
|
|
59
|
+
baseColor,
|
|
58
60
|
}: SidebarProps) => {
|
|
59
61
|
const [sidebarOpen, setSidebarOpen] = useState(true)
|
|
60
|
-
|
|
61
62
|
const sidebarItemClickHandler = (itemId: string) => {
|
|
62
63
|
const item = items[itemId]
|
|
63
64
|
const link = item?.link
|
|
64
65
|
if (link) setLink(link)
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
console.log(baseColor)
|
|
67
68
|
return (
|
|
68
|
-
<SidebarContainer sidebarOpen={sidebarOpen}>
|
|
69
|
+
<SidebarContainer sidebarOpen={sidebarOpen} baseColor={baseColor}>
|
|
69
70
|
<SidebarLogo
|
|
70
71
|
logoUrl={logoUrl}
|
|
71
72
|
sidebarOpen={sidebarOpen}
|
|
72
73
|
setSidebarOpen={setSidebarOpen}
|
|
73
74
|
logoOpacity={logoOpacity}
|
|
75
|
+
baseColor={baseColor}
|
|
74
76
|
/>
|
|
75
77
|
<SidebarScrollWrapperContainer>
|
|
76
78
|
<SidebarScrollContainer>
|