groundfloor-react-ui 1.0.0
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/README.md +20 -0
- package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
- package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
- package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
- package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
- package/assets/icons/app-logo.svg +3 -0
- package/assets/icons/arrow-down.svg +3 -0
- package/assets/icons/arrow-rotate.svg +1 -0
- package/assets/icons/arrow-up.svg +3 -0
- package/assets/icons/bell.svg +3 -0
- package/assets/icons/check.svg +3 -0
- package/assets/icons/checkmark.svg +3 -0
- package/assets/icons/chevron-down.svg +3 -0
- package/assets/icons/chevron-left.svg +3 -0
- package/assets/icons/chevron-right.svg +3 -0
- package/assets/icons/cloud-icon.svg +3 -0
- package/assets/icons/connection.svg +3 -0
- package/assets/icons/cross-icon.svg +3 -0
- package/assets/icons/door-internal-active.svg +1 -0
- package/assets/icons/edit-icon.svg +3 -0
- package/assets/icons/ellipses-horizontal.svg +3 -0
- package/assets/icons/ellipses.svg +3 -0
- package/assets/icons/email.svg +3 -0
- package/assets/icons/eye-hide-view.svg +1 -0
- package/assets/icons/eye-hide.svg +1 -0
- package/assets/icons/file-attach-white.svg +3 -0
- package/assets/icons/file-attach.svg +3 -0
- package/assets/icons/functional-equation-regular.svg +147 -0
- package/assets/icons/hamburger-menu.svg +3 -0
- package/assets/icons/heart.svg +18 -0
- package/assets/icons/image.svg +3 -0
- package/assets/icons/info.svg +3 -0
- package/assets/icons/jpg-icon.svg +3 -0
- package/assets/icons/magnifier.svg +3 -0
- package/assets/icons/menu-ellipse-two.svg +1 -0
- package/assets/icons/menu-ellipse.svg +53 -0
- package/assets/icons/pause-all.svg +1 -0
- package/assets/icons/pdf-icon.svg +3 -0
- package/assets/icons/pen-icon.svg +3 -0
- package/assets/icons/plus-outlined.svg +3 -0
- package/assets/icons/resume.svg +1 -0
- package/assets/icons/sign-icon.svg +3 -0
- package/assets/icons/star.svg +3 -0
- package/assets/icons/trash-icon.svg +59 -0
- package/assets/icons/triangle-down.svg +3 -0
- package/assets/icons/users.svg +11 -0
- package/assets/icons/view.svg +3 -0
- package/assets/icons/watcher.svg +3 -0
- package/assets/icons/zoom-in-white.svg +1 -0
- package/assets/styles/global.css +0 -0
- package/assets/styles/global.scss +0 -0
- package/components/Accordion/Accordion.js +114 -0
- package/components/Accordion/AccordionSB.js +168 -0
- package/components/Accordion/AccordionSBfooter.js +171 -0
- package/components/Accordion/index.js +4 -0
- package/components/ArrowBar/ArrowBar.js +293 -0
- package/components/ArrowBar/index.js +2 -0
- package/components/Avatar/Avatar.js +167 -0
- package/components/Avatar/AvatarSB.js +226 -0
- package/components/Avatar/AvatarSBfooter.js +226 -0
- package/components/Avatar/index.js +4 -0
- package/components/Banner/Banner.js +65 -0
- package/components/Banner/index.js +2 -0
- package/components/Breadcrumb/Breadcrumb.js +192 -0
- package/components/Breadcrumb/index.js +2 -0
- package/components/Button/PrimaryButton.js +125 -0
- package/components/Button/SecondaryButton.js +114 -0
- package/components/Button/TinyButton.js +94 -0
- package/components/Button/index.js +6 -0
- package/components/Cards/Card.js +48 -0
- package/components/Cards/CardRef.js +64 -0
- package/components/Cards/DocumentCard.js +221 -0
- package/components/Cards/index.js +5 -0
- package/components/Content/Content.js +51 -0
- package/components/Content/index.js +1 -0
- package/components/Divider/Divider.js +63 -0
- package/components/Divider/index.js +2 -0
- package/components/Drawer/Drawer.js +93 -0
- package/components/Drawer/index.js +2 -0
- package/components/ErrorBoundary/ErrorBoundary.js +44 -0
- package/components/ErrorBoundary/index.js +1 -0
- package/components/FilterChip/FilterChip.js +68 -0
- package/components/FilterChip/index.js +1 -0
- package/components/Footer/Footer.js +58 -0
- package/components/Footer/FooterContentLev3.js +96 -0
- package/components/Footer/index.js +2 -0
- package/components/Form/FormComponent.js +273 -0
- package/components/Form/HeaderComponent.js +39 -0
- package/components/Form/StyledComponent.js +323 -0
- package/components/Form/SubmitComponent.js +63 -0
- package/components/Form/index.js +4 -0
- package/components/GroupAvatars/GroupAvatars.js +143 -0
- package/components/GroupAvatars/index.js +1 -0
- package/components/GroupButtons/ButtonPopup.js +192 -0
- package/components/GroupButtons/GroupButtons.js +150 -0
- package/components/GroupButtons/GroupButtonsPopup.js +169 -0
- package/components/GroupButtons/index.js +3 -0
- package/components/GroupStatusCircle/GroupStatusCircle.js +135 -0
- package/components/GroupStatusCircle/index.js +1 -0
- package/components/Header/Header.js +58 -0
- package/components/Header/index.js +1 -0
- package/components/HyperLink/HyperLink.js +114 -0
- package/components/HyperLink/index.js +1 -0
- package/components/Icon/Icon.js +161 -0
- package/components/Icon/index.js +1 -0
- package/components/Images/Image.js +112 -0
- package/components/Images/index.js +2 -0
- package/components/Inputs/CheckBoxEditableInput.js +352 -0
- package/components/Inputs/CheckBoxInput.js +195 -0
- package/components/Inputs/CheckBoxInputMS.js +160 -0
- package/components/Inputs/DateSelect.js +411 -0
- package/components/Inputs/DropdownSelect.js +466 -0
- package/components/Inputs/DropzoneInput.js +335 -0
- package/components/Inputs/NumericInput.js +155 -0
- package/components/Inputs/RadioInput.js +205 -0
- package/components/Inputs/SearchInput.js +18 -0
- package/components/Inputs/Signature.js +278 -0
- package/components/Inputs/TextArea.js +196 -0
- package/components/Inputs/TextInput.js +182 -0
- package/components/Inputs/TextInputClicable.js +198 -0
- package/components/Inputs/TextInputClicableMS.js +255 -0
- package/components/Inputs/TimeInput.js +181 -0
- package/components/Inputs/ToggleSwitch.js +123 -0
- package/components/Inputs/index.js +13 -0
- package/components/Label/Label.js +48 -0
- package/components/Label/index.js +1 -0
- package/components/Loaders/Loader.js +179 -0
- package/components/Loaders/index.js +2 -0
- package/components/Modal/Modal.js +116 -0
- package/components/Modal/ModalComp.js +158 -0
- package/components/Modal/index.js +2 -0
- package/components/Overlay/Overlay.js +159 -0
- package/components/Overlay/index.js +1 -0
- package/components/Pagination/Pagination.js +83 -0
- package/components/Pagination/index.js +1 -0
- package/components/ProgressBar/ProgressBar.js +84 -0
- package/components/ProgressBar/index.js +1 -0
- package/components/ProgressSteps/ProgressSteps.js +121 -0
- package/components/ProgressSteps/index.js +1 -0
- package/components/Rating/Rating.js +264 -0
- package/components/Rating/index.js +1 -0
- package/components/SecondaryLink/DarkSecondaryLink.js +97 -0
- package/components/SecondaryLink/LightSecondaryLink.js +93 -0
- package/components/SecondaryLink/index.js +3 -0
- package/components/Sidebar/Navbar.js +328 -0
- package/components/Sidebar/Sidebar.js +180 -0
- package/components/Sidebar/index.js +3 -0
- package/components/StatusChip/PrimaryStatusChip.js +78 -0
- package/components/StatusChip/SecondaryStatusChip.js +78 -0
- package/components/StatusChip/SlimPrimaryStatusChip.js +92 -0
- package/components/StatusChip/SlimSecondaryStatusChip.js +93 -0
- package/components/StatusChip/index.js +6 -0
- package/components/StatusCircle/StatusCircle.js +64 -0
- package/components/StatusCircle/index.js +1 -0
- package/components/Tables/Table.js +156 -0
- package/components/Tables/index.js +1 -0
- package/components/Tooltip/Tooltip.js +479 -0
- package/components/Tooltip/index.js +1 -0
- package/components/Typography/Typography.js +78 -0
- package/components/Typography/index.js +2 -0
- package/components/constants/colors.js +33 -0
- package/components/constants/defaultStyle.js +781 -0
- package/components/constants/defaultThemeColor.js +15 -0
- package/components/constants/index.js +7 -0
- package/components/constants/utils.js +31 -0
- package/components/global/FontStyle.js +131 -0
- package/components/global/index.js +1 -0
- package/dist/index.es.js +2302 -0
- package/dist/index.js +2302 -0
- package/index.js +40 -0
- package/package.json +67 -0
- package/rollup.config.js +53 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import getDefaultStyles from '../constants/utils';
|
|
6
|
+
|
|
7
|
+
const StyledContainer = styled.div`
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
width: auto;
|
|
13
|
+
|
|
14
|
+
${({ size }) => css`height: ${size}px;`}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const StyledPercentage = styled.div`
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const StyledStar = styled.div`
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
${({ size }) =>
|
|
26
|
+
css`
|
|
27
|
+
width: ${size}px;
|
|
28
|
+
height: ${size}px;
|
|
29
|
+
`}
|
|
30
|
+
cursor: ${({ toggleSet }) => toggleSet ? 'pointer' : 'default'};
|
|
31
|
+
|
|
32
|
+
svg {
|
|
33
|
+
fill: black;
|
|
34
|
+
|
|
35
|
+
${({ size }) =>
|
|
36
|
+
size &&
|
|
37
|
+
css`
|
|
38
|
+
width: ${size}px;
|
|
39
|
+
height: ${size}px;
|
|
40
|
+
`}
|
|
41
|
+
|
|
42
|
+
${({ transform }) =>
|
|
43
|
+
transform &&
|
|
44
|
+
css`
|
|
45
|
+
transform: ${transform};
|
|
46
|
+
`}
|
|
47
|
+
|
|
48
|
+
path {
|
|
49
|
+
${({ color }) =>
|
|
50
|
+
color &&
|
|
51
|
+
css`
|
|
52
|
+
fill: ${color};
|
|
53
|
+
`}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const Star = ({ theme, toggleSet, slide, color, size, transform, ratingValue, starVal, hover, ...props }) => {
|
|
59
|
+
return (
|
|
60
|
+
<StyledStar
|
|
61
|
+
theme={theme}
|
|
62
|
+
ratingValue={ratingValue}
|
|
63
|
+
starVal={starVal}
|
|
64
|
+
hover={hover}
|
|
65
|
+
toggleSet={toggleSet}
|
|
66
|
+
color={color}
|
|
67
|
+
size={size}
|
|
68
|
+
transform={transform}
|
|
69
|
+
{...props}>
|
|
70
|
+
<svg width="24px" height="24px" viewBox="0 0 24 24" id="star_filled" data-name="star filled" xmlns="http://www.w3.org/2000/svg">
|
|
71
|
+
<defs>
|
|
72
|
+
<clipPath id="starFilled">
|
|
73
|
+
<path id="Star" d="M10,15,4.122,18.09l1.123-6.545L.489,6.91l6.572-.955L10,0l2.939,5.955,6.572.955-4.755,4.635,1.123,6.545Z" transform="translate(2 3)" stroke="#000" strokeMiterlimit="10" strokeWidth="1.5" />
|
|
74
|
+
</clipPath>
|
|
75
|
+
</defs>
|
|
76
|
+
<rect x="0" y="0" fill="rgb(217,217,217)" width="100%" height="100%" clipPath="url(#starFilled)" />
|
|
77
|
+
<rect x={slide} y="0" fill={color} width="100%" height="100%" clipPath="url(#starFilled)" />
|
|
78
|
+
</svg>
|
|
79
|
+
</StyledStar>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getStarArray(value, maxRange) {
|
|
84
|
+
//Convert the value from the actual range to the 0-5 range for the stars
|
|
85
|
+
let newVal = value * 5 / maxRange;
|
|
86
|
+
const starArr = [];
|
|
87
|
+
const valueStars = newVal;
|
|
88
|
+
//create array of 1 element each element has the value to fill the star
|
|
89
|
+
//convert the value to fill the star into the value to pass to the svg
|
|
90
|
+
//base on the way the svg is donethe range is:
|
|
91
|
+
//slide '-24' 0% 0
|
|
92
|
+
// slide '-12' 50% 0.5
|
|
93
|
+
// slide '0' 100% 1
|
|
94
|
+
for (let i = 0; i < 5; i++) {
|
|
95
|
+
if (newVal - 1 >= 0) {
|
|
96
|
+
starArr.push('0');
|
|
97
|
+
} else if (newVal - 1 < 0 && newVal - 1 > -1) {
|
|
98
|
+
const tmpVal = ((newVal * 24) - 24).toString();
|
|
99
|
+
starArr.push(tmpVal);
|
|
100
|
+
} else {
|
|
101
|
+
starArr.push('-24');
|
|
102
|
+
}
|
|
103
|
+
newVal = newVal - 1;
|
|
104
|
+
}
|
|
105
|
+
return { array: starArr, value: valueStars };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function getPercentage(value, maxRange) {
|
|
109
|
+
//Convert the value from the actual range to the 0-5 range for the stars
|
|
110
|
+
let newVal = value * 100 / maxRange;
|
|
111
|
+
return newVal;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const Rating = ({
|
|
115
|
+
theme,
|
|
116
|
+
type,
|
|
117
|
+
customStylesContainer,
|
|
118
|
+
customStylesStar,
|
|
119
|
+
customStylesPercentage,
|
|
120
|
+
color,
|
|
121
|
+
size,
|
|
122
|
+
handleClick,
|
|
123
|
+
transform,
|
|
124
|
+
maxRange,
|
|
125
|
+
value,
|
|
126
|
+
toggleStar,
|
|
127
|
+
toggleSet,
|
|
128
|
+
identifier,
|
|
129
|
+
...props }) => {
|
|
130
|
+
|
|
131
|
+
const [starArr, setStarArr] = useState(undefined);
|
|
132
|
+
const [starVal, setStarVal] = useState(undefined);
|
|
133
|
+
const [percentage, setPercentage] = useState(undefined);
|
|
134
|
+
const [hover, setHover] = useState(undefined);
|
|
135
|
+
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setStarArr(getStarArray(value, maxRange).array);
|
|
138
|
+
setStarVal(getStarArray(value, maxRange).value);
|
|
139
|
+
setPercentage(getPercentage(value, maxRange));
|
|
140
|
+
}, [value, maxRange]);
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* When hover the stars the actual value is ovveridden by the value of the
|
|
144
|
+
* hover star, but it go back to the original value if no click
|
|
145
|
+
* Also assume that if the original value is not 0 a previous rating was done already
|
|
146
|
+
* therefore cannot give less than 1 star
|
|
147
|
+
*/
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (hover) {
|
|
150
|
+
setStarArr(getStarArray(hover, maxRange).array);
|
|
151
|
+
} else {
|
|
152
|
+
setStarArr(getStarArray(value, maxRange).array);
|
|
153
|
+
setStarVal(getStarArray(value, maxRange).value);
|
|
154
|
+
setPercentage(getPercentage(value, maxRange));
|
|
155
|
+
}
|
|
156
|
+
}, [hover]);
|
|
157
|
+
|
|
158
|
+
const stars =
|
|
159
|
+
<>
|
|
160
|
+
{starArr?.map((val, i) => {
|
|
161
|
+
const ratingValue = (i + 1) * 20;
|
|
162
|
+
return (
|
|
163
|
+
<Star
|
|
164
|
+
ratingValue={ratingValue}
|
|
165
|
+
starVal={starVal}
|
|
166
|
+
hover={hover}
|
|
167
|
+
toggleSet={toggleSet}
|
|
168
|
+
onClick={toggleSet ? () => handleClick(ratingValue) : null}
|
|
169
|
+
onMouseEnter={toggleSet ? () => { setHover(ratingValue); } : null}
|
|
170
|
+
onMouseLeave={toggleSet ? () => { setHover(null); } : null}
|
|
171
|
+
slide={val}
|
|
172
|
+
color={color}
|
|
173
|
+
className={'star'}
|
|
174
|
+
size={size}
|
|
175
|
+
transform={transform}
|
|
176
|
+
key={identifier?.concat(i)}
|
|
177
|
+
customStyles={customStylesStar}
|
|
178
|
+
/>
|
|
179
|
+
)
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
</>
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<StyledContainer theme={theme} customStyles={customStylesContainer} type={type} size={size} {...props} className={'container'} >
|
|
186
|
+
{toggleStar ? stars :
|
|
187
|
+
<StyledPercentage theme={theme} type={type} customStyles={customStylesPercentage}>{percentage}%</StyledPercentage>}
|
|
188
|
+
</StyledContainer>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
Rating.propTypes = {
|
|
193
|
+
/**
|
|
194
|
+
* Theme props
|
|
195
|
+
*/
|
|
196
|
+
theme: PropTypes.object,
|
|
197
|
+
/**
|
|
198
|
+
* Custom style object for container
|
|
199
|
+
*/
|
|
200
|
+
customStylesContainer: PropTypes.object,
|
|
201
|
+
/**
|
|
202
|
+
* Custom style object for start
|
|
203
|
+
*/
|
|
204
|
+
customStylesStar: PropTypes.object,
|
|
205
|
+
/**
|
|
206
|
+
* Custom style object for percentage
|
|
207
|
+
*/
|
|
208
|
+
customStylesPercentage: PropTypes.object,
|
|
209
|
+
/**
|
|
210
|
+
* type of component to define styling
|
|
211
|
+
*/
|
|
212
|
+
type: PropTypes.string,
|
|
213
|
+
/**
|
|
214
|
+
* color of the star when rated
|
|
215
|
+
*/
|
|
216
|
+
color: PropTypes.string,
|
|
217
|
+
/**
|
|
218
|
+
* size of the star
|
|
219
|
+
*/
|
|
220
|
+
size: PropTypes.number,
|
|
221
|
+
/**
|
|
222
|
+
* object to translate the icon if required
|
|
223
|
+
*/
|
|
224
|
+
transform: PropTypes.object,
|
|
225
|
+
/**
|
|
226
|
+
* Function to manage the click of the star
|
|
227
|
+
*/
|
|
228
|
+
handleClick: PropTypes.func,
|
|
229
|
+
/**
|
|
230
|
+
* Value to define the max range. The min is always 0
|
|
231
|
+
*/
|
|
232
|
+
maxRange: PropTypes.number,
|
|
233
|
+
/**
|
|
234
|
+
* Value of the rating
|
|
235
|
+
*/
|
|
236
|
+
value: PropTypes.number,
|
|
237
|
+
/**
|
|
238
|
+
* If true the component display starts, else a number in percentage
|
|
239
|
+
*/
|
|
240
|
+
toggleStar: PropTypes.bool,
|
|
241
|
+
/**
|
|
242
|
+
* If true the user can click on the stars and set a new rating value
|
|
243
|
+
*/
|
|
244
|
+
toggleSet: PropTypes.bool,
|
|
245
|
+
/**
|
|
246
|
+
* String to use as key for the mapping
|
|
247
|
+
*/
|
|
248
|
+
identifier: PropTypes.string,
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
Rating.defaultProps = {
|
|
252
|
+
theme: defaultStyles,
|
|
253
|
+
customStylesContainer: null,
|
|
254
|
+
customStylesStar: null,
|
|
255
|
+
customStylesPercentage: null,
|
|
256
|
+
type: 'star',
|
|
257
|
+
maxRange: 100,
|
|
258
|
+
value: 0,
|
|
259
|
+
identifier: 'ratingKey',
|
|
260
|
+
toggleStar: true,
|
|
261
|
+
toggleSet: false,
|
|
262
|
+
color: '#F7B001'
|
|
263
|
+
}
|
|
264
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Rating';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Primary UI component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const buttonDisabledBg = '#BBC4CF';
|
|
11
|
+
|
|
12
|
+
const StyledButton = styled.button`
|
|
13
|
+
background: ${({ disabled, theme, bgVariant }) => disabled ? buttonDisabledBg : theme.variant[bgVariant]};
|
|
14
|
+
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
15
|
+
padding: 6px 17px;
|
|
16
|
+
border: 1px solid ${({ theme, bgVariant }) => theme.variant[bgVariant]};
|
|
17
|
+
border-radius: 999px;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
line-height: 17px;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
width: ${({ block }) => block ? '100%' : 'auto'};
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
|
|
25
|
+
&:disabled {
|
|
26
|
+
color: #929EAC;
|
|
27
|
+
background: ${buttonDisabledBg};
|
|
28
|
+
border: 1px solid ${buttonDisabledBg};
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
|
|
31
|
+
svg>path{
|
|
32
|
+
fill: #929EAC;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
* {
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const DarkSecondaryLink = ({ block, style, variant, bgVariant, disabled, ...props }) => {
|
|
42
|
+
const theme = useTheme() || defaultThemeColor;
|
|
43
|
+
return (
|
|
44
|
+
<StyledButton
|
|
45
|
+
block={block}
|
|
46
|
+
variant={variant}
|
|
47
|
+
bgVariant={bgVariant}
|
|
48
|
+
type="button"
|
|
49
|
+
style={style}
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
{props.children}
|
|
54
|
+
</StyledButton>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
DarkSecondaryLink.propTypes = {
|
|
59
|
+
/**
|
|
60
|
+
* Type of Button. primary-1, 2, error, etc.
|
|
61
|
+
*/
|
|
62
|
+
variant: PropTypes.string,
|
|
63
|
+
/**
|
|
64
|
+
* Color background. primary-1, 2, error, etc.
|
|
65
|
+
*/
|
|
66
|
+
bgVariant: PropTypes.string,
|
|
67
|
+
/**
|
|
68
|
+
* Is the button disabled?
|
|
69
|
+
*/
|
|
70
|
+
disabled: PropTypes.bool,
|
|
71
|
+
/**
|
|
72
|
+
* Optional click handler
|
|
73
|
+
*/
|
|
74
|
+
block: PropTypes.bool,
|
|
75
|
+
/**
|
|
76
|
+
* Optional click handler
|
|
77
|
+
*/
|
|
78
|
+
onClick: PropTypes.func,
|
|
79
|
+
/**
|
|
80
|
+
* Theme object
|
|
81
|
+
*/
|
|
82
|
+
theme: PropTypes.object,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
StyledButton.defaultProps = {
|
|
86
|
+
theme: defaultThemeColor,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
DarkSecondaryLink.defaultProps = {
|
|
90
|
+
theme: defaultThemeColor,
|
|
91
|
+
variant: 'primary-2',
|
|
92
|
+
bgVariant: 'neutral-4',
|
|
93
|
+
block: false,
|
|
94
|
+
disabled: false,
|
|
95
|
+
onClick: undefined,
|
|
96
|
+
};
|
|
97
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Primary UI component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const buttonDisabledBg = '#BBC4CF';
|
|
11
|
+
|
|
12
|
+
const StyledButton = styled.button`
|
|
13
|
+
background: ${({ disabled, theme }) => disabled ? buttonDisabledBg : theme.bgColor};
|
|
14
|
+
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
15
|
+
padding: 6px 17px;
|
|
16
|
+
border: 1px solid ${({ theme, borderVariant }) => theme.variant[borderVariant]};
|
|
17
|
+
border-radius: 999px;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
line-height: 17px;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
width: ${({ block }) => block ? '100%' : 'auto'};
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
|
|
25
|
+
&:disabled {
|
|
26
|
+
color: #929EAC;
|
|
27
|
+
background: ${buttonDisabledBg};
|
|
28
|
+
border: 1px solid ${buttonDisabledBg};
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
|
|
31
|
+
svg>path{
|
|
32
|
+
fill: #929EAC;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export const LightSecondaryLink = ({ block, style, variant, borderVariant, disabled, ...props }) => {
|
|
38
|
+
const theme = useTheme() || defaultThemeColor;
|
|
39
|
+
return (
|
|
40
|
+
<StyledButton
|
|
41
|
+
block={block}
|
|
42
|
+
variant={variant}
|
|
43
|
+
borderVariant={borderVariant}
|
|
44
|
+
type="button"
|
|
45
|
+
style={style}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
{...props}
|
|
48
|
+
>
|
|
49
|
+
{props.children}
|
|
50
|
+
</StyledButton>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
LightSecondaryLink.propTypes = {
|
|
55
|
+
/**
|
|
56
|
+
* Color text. primary-1, 2, error, etc.
|
|
57
|
+
*/
|
|
58
|
+
variant: PropTypes.string,
|
|
59
|
+
/**
|
|
60
|
+
* Color border. primary-1, 2, error, etc.
|
|
61
|
+
*/
|
|
62
|
+
borderVariant: PropTypes.string,
|
|
63
|
+
/**
|
|
64
|
+
* Is the button disabled?
|
|
65
|
+
*/
|
|
66
|
+
disabled: PropTypes.bool,
|
|
67
|
+
/**
|
|
68
|
+
* Optional click handler
|
|
69
|
+
*/
|
|
70
|
+
block: PropTypes.bool,
|
|
71
|
+
/**
|
|
72
|
+
* Optional click handler
|
|
73
|
+
*/
|
|
74
|
+
onClick: PropTypes.func,
|
|
75
|
+
/**
|
|
76
|
+
* Theme object
|
|
77
|
+
*/
|
|
78
|
+
theme: PropTypes.object,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
StyledButton.defaultProps = {
|
|
82
|
+
theme: defaultThemeColor,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
LightSecondaryLink.defaultProps = {
|
|
86
|
+
theme: defaultThemeColor,
|
|
87
|
+
variant: 'primary-2',
|
|
88
|
+
borderVariant: 'neutral-3',
|
|
89
|
+
block: false,
|
|
90
|
+
disabled: false,
|
|
91
|
+
onClick: undefined,
|
|
92
|
+
};
|
|
93
|
+
|