groundfloor-react-ui 1.0.18 → 1.0.21
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/components/Accordion/Accordion.js +83 -33
- package/components/Accordion/AccordionSB.js +50 -54
- package/components/Accordion/AccordionSBfooter.js +51 -55
- package/components/ArrowBar/ArrowBar.js +6 -23
- package/components/Avatar/Avatar.js +49 -45
- package/components/Avatar/AvatarSB.js +121 -92
- package/components/Avatar/AvatarSBfooter.js +113 -92
- package/components/Banner/Banner.js +40 -35
- package/components/Breadcrumb/Breadcrumb.js +178 -163
- package/components/Button/PrimaryButton.js +15 -8
- package/components/Button/SecondaryButton.js +11 -9
- package/components/Cards/Card.js +25 -30
- package/components/Cards/CardRef.js +41 -34
- package/components/Cards/DocumentCard.js +83 -89
- package/components/Divider/Divider.js +23 -30
- package/components/Drawer/Drawer.js +46 -55
- package/components/FilterChip/FilterChip.js +34 -32
- package/components/Form/HeaderComponent.js +57 -27
- package/components/GroupAvatars/GroupAvatars.js +12 -16
- package/components/GroupButtons/GroupButtonsPopup.js +3 -9
- package/components/Images/Image.js +16 -21
- package/components/Inputs/CheckBoxInput.js +71 -33
- package/components/Inputs/DateSelect.js +22 -17
- package/components/Inputs/DropdownSelect.js +86 -30
- package/components/Inputs/DropzoneInput.js +83 -68
- package/components/Inputs/NumericInput.js +66 -63
- package/components/Inputs/PasswordInput.js +36 -27
- package/components/Inputs/RadioInput.js +55 -29
- package/components/Inputs/Signature.js +88 -38
- package/components/Inputs/TextArea.js +24 -40
- package/components/Inputs/TextInput.js +43 -28
- package/components/Inputs/TimeInput.js +92 -107
- package/components/Inputs/ToggleSwitch.js +87 -59
- package/components/Modal/ModalComp.js +61 -37
- package/components/Pagination/Pagination.js +30 -54
- package/components/ProgressBar/ProgressBar.js +57 -40
- package/components/Rating/Rating.js +8 -14
- package/components/Sidebar/Navbar.js +196 -170
- package/components/Tables/Table.js +56 -34
- package/components/Tooltip/Tooltip.js +135 -141
- package/components/Typography/Typography.js +9 -10
- package/components/constants/defaultStyle.js +38 -41
- package/dist/index.es.js +675 -596
- package/dist/index.js +660 -581
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import styled, { css, useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
|
|
@@ -8,185 +8,200 @@ import defaultThemeColor from '../constants/defaultThemeColor';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const StyledBreadcrumb = styled.div`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* Hide scrollbar for IE, Edge and Firefox */
|
|
35
|
-
&-ms-overflow-style: none; /* IE and Edge */
|
|
36
|
-
scrollbar-width: none; /* Firefox */
|
|
37
|
-
`
|
|
11
|
+
background: transparent;
|
|
12
|
+
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
13
|
+
font-size: ${({ isPrimary }) => (isPrimary ? '16px' : '14px')};
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
|
|
17
|
+
${({ isWrap }) => {
|
|
18
|
+
if (isWrap) {
|
|
19
|
+
return css`
|
|
20
|
+
width: ${({ block }) => (block ? 'auto' : 'fit-content')};
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
visibility: visible;
|
|
23
|
+
`;
|
|
24
|
+
} else {
|
|
25
|
+
return css`
|
|
26
|
+
border: 1px solid transparent;
|
|
27
|
+
overflow-x: auto;
|
|
28
|
+
overflow-y: hidden;
|
|
29
|
+
visibility: ${({ isBreadcrumbVisible }) =>
|
|
30
|
+
isBreadcrumbVisible ? 'visible' : 'hidden'};
|
|
31
|
+
/* Hide scrollbar for Chrome, Safari and Opera */
|
|
32
|
+
&::-webkit-scrollbar {
|
|
33
|
+
display: none;
|
|
38
34
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
/* Hide scrollbar for IE, Edge and Firefox */
|
|
36
|
+
&-ms-overflow-style: none; /* IE and Edge */
|
|
37
|
+
scrollbar-width: none; /* Firefox */
|
|
38
|
+
`;
|
|
43
39
|
}
|
|
40
|
+
}};
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
.breadcrumb-icon svg path {
|
|
43
|
+
fill: ${({ theme, variant }) => theme.variant[variant]};
|
|
44
|
+
}
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
.breadcrumb-icon-separator svg path {
|
|
47
|
+
fill: ${({ theme, variantSeparator }) => theme.variant[variantSeparator]};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.breadcrumb-icon-separator {
|
|
51
|
+
margin: 0 ${({ isPrimary }) => (isPrimary ? '12px' : '7px')};
|
|
52
|
+
}
|
|
52
53
|
`;
|
|
53
54
|
|
|
54
55
|
const StyledCombo = styled.div`
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-wrap: nowrap;
|
|
57
58
|
`;
|
|
58
59
|
|
|
59
60
|
const StyledItem = styled.div`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
cursor: ${({ href }) => (href ? 'pointer' : 'default')};
|
|
62
|
+
list-style: none;
|
|
63
|
+
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
max-width: 15ch;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
text-decoration: ${({ href }) => (href ? 'underline' : 'none')};
|
|
72
|
+
}
|
|
72
73
|
`;
|
|
73
74
|
|
|
74
|
-
export const Breadcrumb = ({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
export const Breadcrumb = ({
|
|
76
|
+
wrap,
|
|
77
|
+
block,
|
|
78
|
+
style,
|
|
79
|
+
variant,
|
|
80
|
+
variantSeparator,
|
|
81
|
+
appLogo,
|
|
82
|
+
separator,
|
|
83
|
+
items,
|
|
84
|
+
onClick,
|
|
85
|
+
isPrimary,
|
|
86
|
+
...props
|
|
87
|
+
}) => {
|
|
88
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
89
|
+
|
|
90
|
+
const breadcrumbRef = useRef(null);
|
|
91
|
+
|
|
92
|
+
const [isBreadcrumbVisible, setIsBreadcrumbVisible] = useState(undefined);
|
|
93
|
+
|
|
94
|
+
const handleWindowResize = () => {
|
|
95
|
+
if (
|
|
96
|
+
breadcrumbRef?.current?.scrollWidth < breadcrumbRef?.current?.offsetWidth
|
|
97
|
+
) {
|
|
98
|
+
setIsBreadcrumbVisible(true);
|
|
99
|
+
} else {
|
|
100
|
+
setIsBreadcrumbVisible(false);
|
|
87
101
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<StyledBreadcrumb
|
|
116
|
-
isWrap={wrap}
|
|
117
|
-
ref={!wrap ? breadcrumbRef : null}
|
|
118
|
-
isBreadcrumbVisible={isBreadcrumbVisible}
|
|
119
|
-
block={block}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
handleWindowResize();
|
|
106
|
+
}, [items]);
|
|
107
|
+
|
|
108
|
+
//On component mount add event listener
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!wrap) {
|
|
111
|
+
// Monitor the width of the viewPort to adjust the text of the arrow accordingly
|
|
112
|
+
window.addEventListener('resize', handleWindowResize);
|
|
113
|
+
return () => window.removeEventListener('resize', handleWindowResize);
|
|
114
|
+
}
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
117
|
+
const list = items
|
|
118
|
+
? items.map((item, i) => {
|
|
119
|
+
return (
|
|
120
|
+
<StyledCombo key={item.label}>
|
|
121
|
+
{i === 0 && !appLogo ? null : (
|
|
122
|
+
<div className='breadcrumb-icon-separator'>{separator}</div>
|
|
123
|
+
)}
|
|
124
|
+
<StyledItem
|
|
125
|
+
theme={activeTheme}
|
|
126
|
+
onClick={() => {
|
|
127
|
+
if (item.href) onClick(item.href);
|
|
128
|
+
}}
|
|
120
129
|
variant={variant}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
)
|
|
130
|
+
href={item.href}
|
|
131
|
+
title={item.label}
|
|
132
|
+
>
|
|
133
|
+
{/* If label longer than 15chs trim it by css */}
|
|
134
|
+
{item.label}
|
|
135
|
+
</StyledItem>
|
|
136
|
+
</StyledCombo>
|
|
137
|
+
);
|
|
138
|
+
})
|
|
139
|
+
: null;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<StyledBreadcrumb
|
|
143
|
+
theme={activeTheme}
|
|
144
|
+
isWrap={wrap}
|
|
145
|
+
ref={!wrap ? breadcrumbRef : null}
|
|
146
|
+
isBreadcrumbVisible={isBreadcrumbVisible}
|
|
147
|
+
block={block}
|
|
148
|
+
variant={variant}
|
|
149
|
+
variantSeparator={variantSeparator}
|
|
150
|
+
style={style}
|
|
151
|
+
isPrimary={isPrimary}
|
|
152
|
+
{...props}
|
|
153
|
+
>
|
|
154
|
+
{appLogo && <div className='breadcrumb-icon'>{appLogo}</div>}
|
|
155
|
+
{list}
|
|
156
|
+
</StyledBreadcrumb>
|
|
157
|
+
);
|
|
130
158
|
};
|
|
131
159
|
|
|
132
160
|
Breadcrumb.propTypes = {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* If true bigger font and margin, if false it means secondary breadcrum with smaller font and less margin
|
|
171
|
-
*/
|
|
172
|
-
isPrimary: PropTypes.bool,
|
|
161
|
+
/**
|
|
162
|
+
* Color of text. primary-1, 2, error, etc.
|
|
163
|
+
*/
|
|
164
|
+
variant: PropTypes.string,
|
|
165
|
+
/**
|
|
166
|
+
* Color of separator. primary-1, 2, error, etc.
|
|
167
|
+
*/
|
|
168
|
+
variantSeparator: PropTypes.string,
|
|
169
|
+
/**
|
|
170
|
+
* Click handler
|
|
171
|
+
*/
|
|
172
|
+
onClick: PropTypes.func,
|
|
173
|
+
/**
|
|
174
|
+
* Optional Icon element with app icon
|
|
175
|
+
*/
|
|
176
|
+
appLogo: PropTypes.any,
|
|
177
|
+
/**
|
|
178
|
+
* Optional Icon element with separator icon
|
|
179
|
+
*/
|
|
180
|
+
separator: PropTypes.any,
|
|
181
|
+
/**
|
|
182
|
+
* List of the elements of breadcramb
|
|
183
|
+
*/
|
|
184
|
+
items: PropTypes.array,
|
|
185
|
+
/**
|
|
186
|
+
* Optional width selector
|
|
187
|
+
*/
|
|
188
|
+
block: PropTypes.bool,
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* If true wrap items when shrink else hide
|
|
192
|
+
*/
|
|
193
|
+
wrap: PropTypes.bool,
|
|
194
|
+
/**
|
|
195
|
+
* If true bigger font and margin, if false it means secondary breadcrum with smaller font and less margin
|
|
196
|
+
*/
|
|
197
|
+
isPrimary: PropTypes.bool,
|
|
173
198
|
};
|
|
174
199
|
|
|
175
|
-
StyledBreadcrumb.defaultProps = {
|
|
176
|
-
theme: defaultThemeColor,
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
StyledItem.defaultProps = {
|
|
180
|
-
theme: defaultThemeColor,
|
|
181
|
-
}
|
|
182
|
-
|
|
183
200
|
Breadcrumb.defaultProps = {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
};
|
|
192
|
-
|
|
201
|
+
variant: 'neutral-2',
|
|
202
|
+
variantSeparator: 'neutral-3',
|
|
203
|
+
block: false,
|
|
204
|
+
onClick: undefined,
|
|
205
|
+
wrap: false,
|
|
206
|
+
isPrimary: true,
|
|
207
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
import { Loader } from '../Loaders';
|
|
6
5
|
import getDefaultStyles, { hexToRGB } from '../constants/utils';
|
|
6
|
+
import { Loader } from '../Loaders';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Primary UI component for user interaction
|
|
@@ -26,23 +26,22 @@ const sizes = {
|
|
|
26
26
|
|
|
27
27
|
const buttonDisabledBg = ({ theme, variant }) =>
|
|
28
28
|
hexToRGB(theme.variant[variant], 0.6);
|
|
29
|
-
const fontColor = defaultThemeColor.bgColor;
|
|
30
29
|
|
|
31
30
|
const StyledButton = styled.button`
|
|
32
31
|
background: ${({ theme, variant }) => theme.variant[variant]};
|
|
33
|
-
color: ${
|
|
32
|
+
color: ${({ theme }) => theme.bgColor};
|
|
34
33
|
padding: ${({ size }) => sizes[size].padding};
|
|
35
34
|
border: 1px solid ${({ theme, variant }) => theme.variant[variant]};
|
|
36
35
|
border-radius: 5px;
|
|
37
36
|
font-size: ${({ size }) => sizes[size].fontSize};
|
|
38
37
|
display: flex;
|
|
39
|
-
outline: none;
|
|
40
38
|
align-items: center;
|
|
41
39
|
width: ${({ block }) => (block ? '100%' : 'auto')};
|
|
42
40
|
cursor: pointer;
|
|
43
41
|
line-height: 18px;
|
|
42
|
+
outline: none;
|
|
44
43
|
&:disabled {
|
|
45
|
-
color: ${
|
|
44
|
+
color: ${({ theme }) => theme.bgColor};
|
|
46
45
|
background: ${buttonDisabledBg};
|
|
47
46
|
border: 1px solid ${buttonDisabledBg};
|
|
48
47
|
cursor: not-allowed;
|
|
@@ -57,6 +56,7 @@ const StyledButton = styled.button`
|
|
|
57
56
|
${({ btnStyle }) => btnStyle}
|
|
58
57
|
`;
|
|
59
58
|
|
|
59
|
+
|
|
60
60
|
export const PrimaryButton = ({
|
|
61
61
|
btnStyle,
|
|
62
62
|
block,
|
|
@@ -66,8 +66,11 @@ export const PrimaryButton = ({
|
|
|
66
66
|
disabled,
|
|
67
67
|
isLoading,
|
|
68
68
|
type,
|
|
69
|
+
theme,
|
|
69
70
|
...props
|
|
70
71
|
}) => {
|
|
72
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
73
|
+
|
|
71
74
|
return (
|
|
72
75
|
<StyledButton
|
|
73
76
|
block={block}
|
|
@@ -76,6 +79,7 @@ export const PrimaryButton = ({
|
|
|
76
79
|
type={type}
|
|
77
80
|
style={style}
|
|
78
81
|
size={size}
|
|
82
|
+
theme={theme}
|
|
79
83
|
disabled={disabled}
|
|
80
84
|
btnStyle={btnStyle}
|
|
81
85
|
{...props}
|
|
@@ -89,7 +93,10 @@ export const PrimaryButton = ({
|
|
|
89
93
|
alignItems: 'center',
|
|
90
94
|
}}
|
|
91
95
|
>
|
|
92
|
-
<Loader
|
|
96
|
+
<Loader
|
|
97
|
+
customStyles={{ 'background-color': activeTheme.bgColor }}
|
|
98
|
+
size={16}
|
|
99
|
+
/>
|
|
93
100
|
</div>
|
|
94
101
|
)}
|
|
95
102
|
{props.children}
|
|
@@ -131,7 +138,7 @@ PrimaryButton.propTypes = {
|
|
|
131
138
|
*/
|
|
132
139
|
type: PropTypes.string,
|
|
133
140
|
/**
|
|
134
|
-
*
|
|
141
|
+
* custom style of button
|
|
135
142
|
*/
|
|
136
143
|
btnStyle: PropTypes.object,
|
|
137
144
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
import getDefaultStyles from '../constants/utils';
|
|
@@ -24,8 +24,6 @@ const sizes = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const buttonDisabledBg = '#BBC4CF';
|
|
28
|
-
const fontColor = defaultThemeColor.primary['primary-1'];
|
|
29
27
|
|
|
30
28
|
const StyledButton = styled.button`
|
|
31
29
|
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
@@ -35,14 +33,14 @@ const StyledButton = styled.button`
|
|
|
35
33
|
font-size: ${({ size }) => sizes[size].fontSize};
|
|
36
34
|
border-radius: 5px;
|
|
37
35
|
display: flex;
|
|
38
|
-
outline: none;
|
|
39
36
|
align-items: center;
|
|
37
|
+
outline: none;
|
|
40
38
|
width: ${({ block }) => (block ? '100%' : 'auto')};
|
|
41
39
|
cursor: pointer;
|
|
42
40
|
line-height: 18px;
|
|
43
41
|
&:disabled {
|
|
44
42
|
color: #929eac;
|
|
45
|
-
border: 1px solid ${
|
|
43
|
+
border: 1px solid ${({ theme }) => theme.neutral['neutral-3']};
|
|
46
44
|
cursor: not-allowed;
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -63,10 +61,10 @@ export const SecondaryButton = ({
|
|
|
63
61
|
variant,
|
|
64
62
|
disabled,
|
|
65
63
|
type,
|
|
64
|
+
theme,
|
|
66
65
|
...props
|
|
67
66
|
}) => {
|
|
68
|
-
const
|
|
69
|
-
|
|
67
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
70
68
|
return (
|
|
71
69
|
<StyledButton
|
|
72
70
|
block={block}
|
|
@@ -78,6 +76,7 @@ export const SecondaryButton = ({
|
|
|
78
76
|
type={type}
|
|
79
77
|
btnStyle={btnStyle}
|
|
80
78
|
isLoading={isLoading}
|
|
79
|
+
theme={theme}
|
|
81
80
|
{...props}
|
|
82
81
|
>
|
|
83
82
|
{isLoading && (
|
|
@@ -89,8 +88,11 @@ export const SecondaryButton = ({
|
|
|
89
88
|
alignItems: 'center',
|
|
90
89
|
}}
|
|
91
90
|
>
|
|
92
|
-
<Loader
|
|
93
|
-
|
|
91
|
+
<Loader
|
|
92
|
+
theme={theme}
|
|
93
|
+
customStyles={{ 'background-color': activeTheme.variant[variant] }}
|
|
94
|
+
size={16}
|
|
95
|
+
/> </div>
|
|
94
96
|
)}
|
|
95
97
|
{props.children}{' '}
|
|
96
98
|
</StyledButton>
|
package/components/Cards/Card.js
CHANGED
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
5
|
|
|
7
6
|
const CardWrapper = styled.div`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
color: ${({ activeTheme }) => activeTheme.textColor};
|
|
8
|
+
padding-top: 25px;
|
|
9
|
+
padding-bottom: 25px;
|
|
10
|
+
padding-left: 32px;
|
|
11
|
+
padding-right: 32px;
|
|
12
|
+
background-color: ${({ activeTheme }) => activeTheme.bgColor};
|
|
13
|
+
width: inherit;
|
|
14
|
+
height: inherit;
|
|
15
|
+
border-radius: 5px;
|
|
16
|
+
box-shadow: 0px 5px 37px rgba(56, 66, 100, 0.0880136);
|
|
17
|
+
border-color: ${({ activeTheme }) => activeTheme.border};
|
|
18
|
+
|
|
19
|
+
// custom styles
|
|
20
|
+
${({ customStyles }) => customStyles}
|
|
15
21
|
`;
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
23
|
+
export const Card = ({ type, header, content, ...props }) => {
|
|
24
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
20
25
|
|
|
21
|
-
export const Card = ({type,header,content,...props}) => {
|
|
22
26
|
return (
|
|
23
|
-
<CardWrapper
|
|
27
|
+
<CardWrapper activeTheme={activeTheme} {...props}>
|
|
24
28
|
{header}
|
|
25
29
|
{content}
|
|
26
30
|
</CardWrapper>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
29
33
|
|
|
30
34
|
Card.propTypes = {
|
|
31
35
|
/**
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
type: PropTypes.string,
|
|
35
|
-
/**
|
|
36
|
-
* header of the card
|
|
36
|
+
* header of the card
|
|
37
37
|
*/
|
|
38
38
|
header: PropTypes.any,
|
|
39
39
|
/**
|
|
40
40
|
* the content of the card
|
|
41
|
-
|
|
41
|
+
*/
|
|
42
42
|
content: PropTypes.any,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
Card.defaultProps = {
|
|
46
|
-
type: 'card',
|
|
47
|
-
}
|
|
48
|
-
|
|
43
|
+
};
|