@nuskin/foundation-ui-components 1.31.0 → 1.32.1-td-849.1
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/package.json +1 -1
- package/src/common/autocomplete/NsAutocomplete.tsx +56 -130
- package/src/common/card/NsAwardCard.tsx +5 -3
- package/src/common/card/NsBrandCard.tsx +3 -1
- package/src/common/card/NsCheckoutCard.tsx +22 -8
- package/src/common/card/NsHeroCardLevel1.tsx +10 -2
- package/src/common/card/NsHeroCardLevel2.tsx +13 -5
- package/src/common/card/NsIconText.tsx +12 -5
- package/src/common/card/NsLargeCard.tsx +11 -3
- package/src/common/card/NsMediumCard.tsx +10 -2
- package/src/common/card/NsPost.tsx +9 -8
- package/src/common/card/NsSmallFullCard.tsx +17 -9
- package/src/common/card/NsXLargeCard.tsx +12 -4
package/package.json
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
import React, { PropsWithChildren, ReactElement, useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Autocomplete,
|
|
5
|
+
AutocompleteRenderInputParams,
|
|
6
|
+
Popper,
|
|
7
|
+
} from '@mui/material';
|
|
4
8
|
|
|
5
9
|
import { LineLoader } from './helper/LineLoader';
|
|
6
10
|
import { RecentClearAll } from './helper/RecentClearAll';
|
|
7
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
renderGroupBy,
|
|
13
|
+
renderGroupName,
|
|
14
|
+
renderOptionLabel,
|
|
15
|
+
} from './helper/renderGroupName';
|
|
8
16
|
import { SeeMoreButton } from './helper/SeeMoreButton';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
import {
|
|
18
|
+
StyledPopper,
|
|
19
|
+
StyledTextField,
|
|
20
|
+
} from './NsAutocomplete.styled';
|
|
21
|
+
import {
|
|
22
|
+
ComponentBoxProps,
|
|
23
|
+
NsAutocompleteProps,
|
|
24
|
+
OptionsProps,
|
|
25
|
+
} from './types.d';
|
|
12
26
|
|
|
13
|
-
const LISTBOX_PADDING = 8;
|
|
14
27
|
const noop = () => {};
|
|
15
|
-
const OuterElementContext = React.createContext({});
|
|
16
|
-
|
|
17
28
|
const NsAutocomplete = ({
|
|
18
29
|
id = 'custom_autocomplete_dropdown',
|
|
19
30
|
options,
|
|
@@ -33,10 +44,10 @@ const NsAutocomplete = ({
|
|
|
33
44
|
value,
|
|
34
45
|
isFilterEnabled = true,
|
|
35
46
|
fullWidth,
|
|
36
|
-
onKeypress
|
|
37
|
-
}: PropsWithChildren<NsAutocompleteProps>):
|
|
38
|
-
const listboxRef = useRef<any | null>(null);
|
|
47
|
+
onKeypress,
|
|
48
|
+
}: PropsWithChildren<NsAutocompleteProps>):ReactElement => {
|
|
39
49
|
const [scrollTopPosition, setScrollTopPosition] = useState(0);
|
|
50
|
+
const listboxRef = useRef<HTMLUListElement | null>(null);
|
|
40
51
|
|
|
41
52
|
useEffect(() => {
|
|
42
53
|
if (listboxRef.current && options.length > 0) {
|
|
@@ -44,13 +55,6 @@ const NsAutocomplete = ({
|
|
|
44
55
|
}
|
|
45
56
|
}, [options, scrollTopPosition]);
|
|
46
57
|
|
|
47
|
-
const OuterElementType = React.forwardRef((props: any, ref) => {
|
|
48
|
-
const outerProps = React.useContext(OuterElementContext);
|
|
49
|
-
return <ul ref={ref} {...props} {...outerProps} />;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
OuterElementType.displayName = 'OuterElementType';
|
|
53
|
-
|
|
54
58
|
const renderInput = (params: AutocompleteRenderInputParams) => (
|
|
55
59
|
<StyledTextField
|
|
56
60
|
{...(params as any)}
|
|
@@ -73,132 +77,54 @@ const NsAutocomplete = ({
|
|
|
73
77
|
</li>
|
|
74
78
|
);
|
|
75
79
|
|
|
76
|
-
const
|
|
77
|
-
const { data, index, style } = props;
|
|
78
|
-
const dataSet = data[index];
|
|
79
|
-
const option = dataSet?.[1];
|
|
80
|
-
const inlineStyle = {
|
|
81
|
-
top: (style.top as number) + LISTBOX_PADDING,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
if (Object.hasOwn(dataSet, 'group')) {
|
|
85
|
-
return (
|
|
86
|
-
<ListSubheader key={dataSet.key} component="div" style={inlineStyle}>
|
|
87
|
-
{dataSet.group}
|
|
88
|
-
</ListSubheader>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
80
|
+
const renderListBoxComponent = ({ children, ...rest }: ComponentBoxProps): React.JSX.Element => {
|
|
92
81
|
return (
|
|
93
|
-
<
|
|
94
|
-
{
|
|
95
|
-
|
|
82
|
+
<ul
|
|
83
|
+
aria-labelledby={rest['aria-labelledby']}
|
|
84
|
+
onMouseDown={rest.onMouseDown}
|
|
85
|
+
role={rest.role}
|
|
86
|
+
id={rest.id}
|
|
87
|
+
className={rest.className}
|
|
88
|
+
ref={listboxRef}
|
|
89
|
+
>
|
|
90
|
+
<RecentClearAll
|
|
91
|
+
show={clear?.show ?? false}
|
|
92
|
+
text={clear?.text ?? 'Clear All'}
|
|
93
|
+
onClick={clear?.onClear ?? noop}
|
|
94
|
+
testId="autocomplete-clear-id"
|
|
95
|
+
recentSearchText={clear?.recentSearchText ?? 'Your Recent Searches'}
|
|
96
|
+
/>
|
|
97
|
+
{children}
|
|
98
|
+
<SeeMoreButton
|
|
99
|
+
onSeeMore={seeMore?.onSeeMore}
|
|
100
|
+
show={seeMore?.show}
|
|
101
|
+
text={seeMore?.text}
|
|
102
|
+
options={options}
|
|
103
|
+
setScrollTopPosition={setScrollTopPosition}
|
|
104
|
+
listboxRef={listboxRef}
|
|
105
|
+
/>
|
|
106
|
+
</ul>
|
|
96
107
|
);
|
|
97
108
|
};
|
|
98
|
-
|
|
99
|
-
const useResetCache = (data: any) => {
|
|
100
|
-
const ref = React.useRef<VariableSizeList>(null);
|
|
101
|
-
React.useEffect(() => {
|
|
102
|
-
if (ref.current != null) {
|
|
103
|
-
ref.current.resetAfterIndex(0, true);
|
|
104
|
-
}
|
|
105
|
-
}, [data]);
|
|
106
|
-
return ref;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const ListboxComponent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLElement>>(
|
|
110
|
-
function ListboxComponent(props, ref) {
|
|
111
|
-
const { children, ...other } = props;
|
|
112
|
-
const itemData: React.ReactElement[] = [];
|
|
113
|
-
(children as React.ReactElement[]).forEach(
|
|
114
|
-
(item: React.ReactElement & { children?: React.ReactElement[] }) => {
|
|
115
|
-
itemData.push(item);
|
|
116
|
-
itemData.push(...(item.children || []));
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
const theme = useTheme();
|
|
121
|
-
const smUp = useMediaQuery(theme.breakpoints.up('sm'), {
|
|
122
|
-
noSsr: true,
|
|
123
|
-
});
|
|
124
|
-
const itemCount = itemData.length;
|
|
125
|
-
const itemSize = smUp ? 36 : 48;
|
|
126
|
-
|
|
127
|
-
const getChildSize = (child: React.ReactElement) => {
|
|
128
|
-
if (Object.hasOwn(child, 'group')) {
|
|
129
|
-
return 48;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return itemSize;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const getHeight = () => {
|
|
136
|
-
if (itemCount > 8) {
|
|
137
|
-
return 8 * itemSize;
|
|
138
|
-
}
|
|
139
|
-
return itemData.map(getChildSize).reduce((a, b) => a + b, 0);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const gridRef = useResetCache(itemCount);
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<>
|
|
146
|
-
<RecentClearAll
|
|
147
|
-
show={clear?.show ?? false}
|
|
148
|
-
text={clear?.text ?? 'Clear All'}
|
|
149
|
-
onClick={clear?.onClear ?? noop}
|
|
150
|
-
testId="autocomplete-clear-id"
|
|
151
|
-
recentSearchText={clear?.recentSearchText ?? 'Your Recent Searches'}
|
|
152
|
-
/>
|
|
153
|
-
<div ref={ref}>
|
|
154
|
-
<OuterElementContext.Provider value={other}>
|
|
155
|
-
<VariableSizeList
|
|
156
|
-
itemData={itemData}
|
|
157
|
-
height={getHeight() + 2 * LISTBOX_PADDING}
|
|
158
|
-
width="100%"
|
|
159
|
-
ref={gridRef}
|
|
160
|
-
outerElementType={OuterElementType}
|
|
161
|
-
innerElementType="ul"
|
|
162
|
-
itemSize={(index) => getChildSize(itemData[index])}
|
|
163
|
-
overscanCount={5}
|
|
164
|
-
itemCount={itemCount}
|
|
165
|
-
>
|
|
166
|
-
{renderRow}
|
|
167
|
-
</VariableSizeList>
|
|
168
|
-
</OuterElementContext.Provider>
|
|
169
|
-
</div>
|
|
170
|
-
<SeeMoreButton
|
|
171
|
-
onSeeMore={seeMore?.onSeeMore}
|
|
172
|
-
show={seeMore?.show}
|
|
173
|
-
text={seeMore?.text}
|
|
174
|
-
options={options}
|
|
175
|
-
setScrollTopPosition={setScrollTopPosition}
|
|
176
|
-
listboxRef={listboxRef}
|
|
177
|
-
/>
|
|
178
|
-
</>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
|
|
183
109
|
return (
|
|
184
110
|
<>
|
|
185
111
|
<LineLoader show={loading ?? false} />
|
|
186
112
|
<Autocomplete
|
|
187
|
-
|
|
113
|
+
openOnFocus
|
|
188
114
|
id={id}
|
|
189
|
-
|
|
115
|
+
disablePortal
|
|
190
116
|
className={className}
|
|
117
|
+
options={options}
|
|
191
118
|
loading={loading}
|
|
192
119
|
noOptionsText={noOptionsText}
|
|
193
|
-
PopperComponent={fullWidth ? StyledPopper : Popper}
|
|
194
|
-
ListboxComponent={ListboxComponent}
|
|
195
|
-
options={options}
|
|
196
120
|
groupBy={renderGroupBy}
|
|
197
121
|
getOptionLabel={renderOptionLabel}
|
|
198
|
-
renderOption={
|
|
199
|
-
renderGroup={(params) => params as any}
|
|
200
|
-
onChange={onChange}
|
|
122
|
+
renderOption={renderOption as any}
|
|
201
123
|
renderInput={renderInput}
|
|
124
|
+
PopperComponent={fullWidth ? StyledPopper : Popper} // TODO:https://code.tls.nuskin.io/ns-am/content-foundation/nuskin-app/-/jobs/1355817
|
|
125
|
+
ListboxComponent={renderListBoxComponent}
|
|
126
|
+
renderGroup={renderGroupName}
|
|
127
|
+
onChange={onChange}
|
|
202
128
|
onInputChange={onInputChange}
|
|
203
129
|
value={value}
|
|
204
130
|
onFocus={onFocus ?? noop}
|
|
@@ -13,6 +13,7 @@ type NsAwardCardProps = {
|
|
|
13
13
|
mediaOutlet: string;
|
|
14
14
|
backgroundImageDetail: BynderImageDataType;
|
|
15
15
|
className?: string;
|
|
16
|
+
fontColor?: 'primary' | 'secondary';
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const CardContainer = styled(Box)`
|
|
@@ -49,18 +50,19 @@ export default function NsAwardCard({
|
|
|
49
50
|
mediaOutlet,
|
|
50
51
|
backgroundImageDetail,
|
|
51
52
|
className,
|
|
53
|
+
fontColor,
|
|
52
54
|
}: NsAwardCardProps): ReactElement {
|
|
53
55
|
return (
|
|
54
56
|
<CardContainer className={className} role="award-card" component="div" data-testid="award-card">
|
|
55
57
|
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
56
58
|
<div className="content">
|
|
57
|
-
<NsTypography weight="normal" className="title" variant="h5">
|
|
59
|
+
<NsTypography weight="normal" className="title" variant="h5" color={fontColor}>
|
|
58
60
|
{title}
|
|
59
61
|
</NsTypography>
|
|
60
|
-
<NsTypography className="content-text" variant="body-l">
|
|
62
|
+
<NsTypography className="content-text" variant="body-l" color={fontColor}>
|
|
61
63
|
{awardName}
|
|
62
64
|
</NsTypography>
|
|
63
|
-
<NsTypography className="content-text" variant="body-l">
|
|
65
|
+
<NsTypography className="content-text" variant="body-l" color={fontColor}>
|
|
64
66
|
{mediaOutlet}
|
|
65
67
|
</NsTypography>
|
|
66
68
|
</div>
|
|
@@ -18,6 +18,7 @@ type NsBrandCardProps = {
|
|
|
18
18
|
size?: 'small' | 'large';
|
|
19
19
|
button?: NsCardButton;
|
|
20
20
|
className?: string;
|
|
21
|
+
fontColor?: 'primary' | 'secondary';
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ size }) => {
|
|
@@ -67,6 +68,7 @@ export default function NsBrandCard({
|
|
|
67
68
|
button,
|
|
68
69
|
size,
|
|
69
70
|
className,
|
|
71
|
+
fontColor,
|
|
70
72
|
}: NsBrandCardProps): ReactElement {
|
|
71
73
|
return (
|
|
72
74
|
<CardContainer className={className} role="brand-card" component="div" data-testid="brand-card" size={size}>
|
|
@@ -76,7 +78,7 @@ export default function NsBrandCard({
|
|
|
76
78
|
</NsBrandWrapper>
|
|
77
79
|
</NsBgCard>
|
|
78
80
|
{title ? (
|
|
79
|
-
<NsTypography variant="h3" className="brand-title">
|
|
81
|
+
<NsTypography variant="h3" className="brand-title" color={fontColor}>
|
|
80
82
|
{title}
|
|
81
83
|
</NsTypography>
|
|
82
84
|
) : null}
|
|
@@ -11,6 +11,7 @@ type NsCheckoutCardProps = {
|
|
|
11
11
|
linkText: string;
|
|
12
12
|
url: string;
|
|
13
13
|
className?: string;
|
|
14
|
+
fontColor?: 'primary' | 'secondary';
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const CardContainer = styled(Box)`
|
|
@@ -18,12 +19,12 @@ const CardContainer = styled(Box)`
|
|
|
18
19
|
display: flex;
|
|
19
20
|
max-width: 345px;
|
|
20
21
|
height: auto;
|
|
21
|
-
border: 2px solid #
|
|
22
|
+
border: 2px solid #b2b2b2;
|
|
22
23
|
border-radius: 2px;
|
|
23
24
|
.left-bar {
|
|
24
25
|
width: 4px;
|
|
25
26
|
height: auto;
|
|
26
|
-
background-color: #
|
|
27
|
+
background-color: #22d55c;
|
|
27
28
|
}
|
|
28
29
|
.content {
|
|
29
30
|
display: flex;
|
|
@@ -44,7 +45,7 @@ const CardContainer = styled(Box)`
|
|
|
44
45
|
font-weight: 400;
|
|
45
46
|
}
|
|
46
47
|
.action-link {
|
|
47
|
-
color: #
|
|
48
|
+
color: #7123d9;
|
|
48
49
|
font-size: 14px;
|
|
49
50
|
font-weight: 700;
|
|
50
51
|
letter-spacing: 0.7;
|
|
@@ -57,9 +58,22 @@ const CardContainer = styled(Box)`
|
|
|
57
58
|
cursor: pointer;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
.primary {
|
|
62
|
+
color: #fff;
|
|
63
|
+
}
|
|
64
|
+
.secondary {
|
|
65
|
+
color: #000;
|
|
66
|
+
}
|
|
60
67
|
`;
|
|
61
|
-
|
|
62
|
-
export default function NsCheckoutCard({
|
|
68
|
+
|
|
69
|
+
export default function NsCheckoutCard({
|
|
70
|
+
title,
|
|
71
|
+
icon,
|
|
72
|
+
linkText,
|
|
73
|
+
url,
|
|
74
|
+
className,
|
|
75
|
+
fontColor,
|
|
76
|
+
}: NsCheckoutCardProps): ReactElement {
|
|
63
77
|
const [dropdownIcon, setDropdownIcon] = useState(false);
|
|
64
78
|
const handleClick = () => {
|
|
65
79
|
setDropdownIcon(!dropdownIcon);
|
|
@@ -73,9 +87,9 @@ export default function NsCheckoutCard({ title, icon, linkText, url, className }
|
|
|
73
87
|
<NsIcon name={icon} />
|
|
74
88
|
</span>
|
|
75
89
|
<div className="text-content">
|
|
76
|
-
<article className=
|
|
77
|
-
<article className=
|
|
78
|
-
<NsLink className=
|
|
90
|
+
<article className={`title ${fontColor}`}>{title}</article>
|
|
91
|
+
<article className={`address ${fontColor}`}>Address</article>
|
|
92
|
+
<NsLink className={`action-link ${fontColor}`} href={url}>
|
|
79
93
|
{linkText}
|
|
80
94
|
</NsLink>
|
|
81
95
|
</div>
|
|
@@ -15,6 +15,7 @@ type NsHeroCardLevel1Props = {
|
|
|
15
15
|
button?: NsCardButton;
|
|
16
16
|
className?: string;
|
|
17
17
|
imagePosition?: 'top' | 'bottom';
|
|
18
|
+
fontColor?: 'primary' | 'secondary';
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePosition }) => {
|
|
@@ -54,6 +55,12 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePositio
|
|
|
54
55
|
fontSize: '18px',
|
|
55
56
|
marginBottom: '20px',
|
|
56
57
|
},
|
|
58
|
+
'.primary': {
|
|
59
|
+
color: '#fff',
|
|
60
|
+
},
|
|
61
|
+
'.secondary': {
|
|
62
|
+
color: '#000',
|
|
63
|
+
},
|
|
57
64
|
'.action-link': {
|
|
58
65
|
marginTop: '10px',
|
|
59
66
|
},
|
|
@@ -83,13 +90,14 @@ export default function NsHeroCardLevel1({
|
|
|
83
90
|
button,
|
|
84
91
|
className,
|
|
85
92
|
imagePosition = 'top',
|
|
93
|
+
fontColor,
|
|
86
94
|
}: NsHeroCardLevel1Props): ReactElement {
|
|
87
95
|
return (
|
|
88
96
|
<CardContainer className={className} data-testid="hero-card-level-1" imagePosition={imagePosition}>
|
|
89
97
|
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
90
98
|
<div className="content">
|
|
91
|
-
<article className=
|
|
92
|
-
<article className=
|
|
99
|
+
<article className={`body-title ${fontColor}`}>{cardTitle}</article>
|
|
100
|
+
<article className={`body-text ${fontColor}`}>{cardDescription}</article>
|
|
93
101
|
{button ? <CardButton {...button} /> : null}
|
|
94
102
|
</div>
|
|
95
103
|
</CardContainer>
|
|
@@ -15,6 +15,7 @@ type NsHeroCardLevel2Props = {
|
|
|
15
15
|
backgroundImageDetail: BynderImageDataType;
|
|
16
16
|
button?: NsCardButton;
|
|
17
17
|
className?: string;
|
|
18
|
+
fontColor?: 'primary' | 'secondary';
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const CardContainer = styled(Box)`
|
|
@@ -55,12 +56,18 @@ const CardContainer = styled(Box)`
|
|
|
55
56
|
font-weight: 700;
|
|
56
57
|
margin-bottom: 5px;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
.primary {
|
|
60
|
+
color: #fff;
|
|
61
|
+
}
|
|
62
|
+
.secondary {
|
|
63
|
+
color: #000;
|
|
64
|
+
}
|
|
65
|
+
@media (max-width: 768px) {
|
|
59
66
|
.content {
|
|
60
67
|
padding: 5%;
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
|
-
|
|
70
|
+
`;
|
|
64
71
|
|
|
65
72
|
const NsHeroCardLevel2 = ({
|
|
66
73
|
brandName,
|
|
@@ -69,16 +76,17 @@ const NsHeroCardLevel2 = ({
|
|
|
69
76
|
backgroundImageDetail,
|
|
70
77
|
button,
|
|
71
78
|
className,
|
|
79
|
+
fontColor,
|
|
72
80
|
}: NsHeroCardLevel2Props): ReactElement => {
|
|
73
81
|
return (
|
|
74
82
|
<CardContainer className={className} data-testid="hero-card-level-2">
|
|
75
83
|
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
76
84
|
<div className="content">
|
|
77
85
|
<div className="brand-container">
|
|
78
|
-
<article>{brandName}</article>
|
|
86
|
+
<article className={fontColor}>{brandName}</article>
|
|
79
87
|
</div>
|
|
80
|
-
<article className=
|
|
81
|
-
<article className=
|
|
88
|
+
<article className={`body-title ${fontColor}`}>{cardTitle}</article>
|
|
89
|
+
<article className={`body-text ${fontColor}`}>{cardDescription}</article>
|
|
82
90
|
<div>{button ? <CardButton {...button} /> : null}</div>
|
|
83
91
|
</div>
|
|
84
92
|
</CardContainer>
|
|
@@ -7,6 +7,7 @@ type NsIconTextProps = {
|
|
|
7
7
|
text: string;
|
|
8
8
|
body: string;
|
|
9
9
|
className?: string;
|
|
10
|
+
fontColor?: 'primary' | 'secondary';
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
const CardContainer = styled(Box)`
|
|
@@ -18,7 +19,7 @@ const CardContainer = styled(Box)`
|
|
|
18
19
|
overflow: hidden;
|
|
19
20
|
height: auto;
|
|
20
21
|
max-width: 222px;
|
|
21
|
-
background-color: #
|
|
22
|
+
background-color: #f5f5f5;
|
|
22
23
|
padding: 20px;
|
|
23
24
|
justify-content: center;
|
|
24
25
|
gap: 30px;
|
|
@@ -29,7 +30,7 @@ const CardContainer = styled(Box)`
|
|
|
29
30
|
.divider {
|
|
30
31
|
width: 182px;
|
|
31
32
|
height: 1px;
|
|
32
|
-
background: #
|
|
33
|
+
background: #b2b2b2;
|
|
33
34
|
}
|
|
34
35
|
.title {
|
|
35
36
|
font-size: 26px;
|
|
@@ -40,6 +41,12 @@ const CardContainer = styled(Box)`
|
|
|
40
41
|
font-weight: 400;
|
|
41
42
|
font-size: 14px;
|
|
42
43
|
}
|
|
44
|
+
.primary {
|
|
45
|
+
color: #fff;
|
|
46
|
+
}
|
|
47
|
+
.secondary {
|
|
48
|
+
color: #000;
|
|
49
|
+
}
|
|
43
50
|
`;
|
|
44
51
|
|
|
45
52
|
const Icon = (): ReactElement => {
|
|
@@ -145,13 +152,13 @@ const Icon = (): ReactElement => {
|
|
|
145
152
|
</div>
|
|
146
153
|
);
|
|
147
154
|
};
|
|
148
|
-
const NsIconText = ({ text, body, className }: NsIconTextProps) => {
|
|
155
|
+
const NsIconText = ({ text, body, className, fontColor }: NsIconTextProps) => {
|
|
149
156
|
return (
|
|
150
157
|
<CardContainer className={className} data-testid="icon-text-card">
|
|
151
158
|
<Icon />
|
|
152
|
-
<article className=
|
|
159
|
+
<article className={`title ${fontColor}`}>{text}</article>
|
|
153
160
|
<div className="divider"></div>
|
|
154
|
-
<article className=
|
|
161
|
+
<article className={`text ${fontColor}`}>{body}</article>
|
|
155
162
|
</CardContainer>
|
|
156
163
|
);
|
|
157
164
|
};
|
|
@@ -16,6 +16,7 @@ type NsLargeCardProps = {
|
|
|
16
16
|
isHorizontal?: boolean;
|
|
17
17
|
button?: NsCardButton;
|
|
18
18
|
className?: string;
|
|
19
|
+
fontColor?: 'primary' | 'secondary';
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal, matches }) => {
|
|
@@ -62,6 +63,12 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
62
63
|
fontWeight: '400',
|
|
63
64
|
marginTop: '10px',
|
|
64
65
|
},
|
|
66
|
+
'.primary': {
|
|
67
|
+
color: '#fff',
|
|
68
|
+
},
|
|
69
|
+
'.secondary': {
|
|
70
|
+
color: '#000',
|
|
71
|
+
},
|
|
65
72
|
'.cta': {
|
|
66
73
|
marginTop: '10px',
|
|
67
74
|
},
|
|
@@ -79,6 +86,7 @@ export default function NsLargeCard({
|
|
|
79
86
|
isHorizontal,
|
|
80
87
|
button,
|
|
81
88
|
className,
|
|
89
|
+
fontColor,
|
|
82
90
|
}: NsLargeCardProps): ReactElement {
|
|
83
91
|
return (
|
|
84
92
|
<CardContainer
|
|
@@ -90,9 +98,9 @@ export default function NsLargeCard({
|
|
|
90
98
|
>
|
|
91
99
|
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
92
100
|
<div className="content">
|
|
93
|
-
<article className=
|
|
94
|
-
<article className=
|
|
95
|
-
<article className=
|
|
101
|
+
<article className={`subtitle ${fontColor}`}>{subtitle}</article>
|
|
102
|
+
<article className={`title ${fontColor}`}>{title}</article>
|
|
103
|
+
<article className={`subtitle ${fontColor}`}>{intro}</article>
|
|
96
104
|
{button ? <CardButton {...button} /> : null}
|
|
97
105
|
</div>
|
|
98
106
|
</CardContainer>
|
|
@@ -18,6 +18,7 @@ type NsMediumCardProps = {
|
|
|
18
18
|
className?: string;
|
|
19
19
|
fluid?: boolean;
|
|
20
20
|
showArrowWithButtonText?: boolean;
|
|
21
|
+
fontColor?: 'primary' | 'secondary';
|
|
21
22
|
};
|
|
22
23
|
const textVariantButton = {
|
|
23
24
|
padding: '0 0 4px',
|
|
@@ -63,6 +64,12 @@ const CardContainer = styled(Box)<{ fluid: boolean; variant: string }>(({ fluid,
|
|
|
63
64
|
fontSize: '20px',
|
|
64
65
|
marginTop: '10px',
|
|
65
66
|
},
|
|
67
|
+
'.primary': {
|
|
68
|
+
color: '#fff',
|
|
69
|
+
},
|
|
70
|
+
'.secondary': {
|
|
71
|
+
color: '#000',
|
|
72
|
+
},
|
|
66
73
|
'.cta': {
|
|
67
74
|
marginTop: 'auto',
|
|
68
75
|
...textVariantCssModification,
|
|
@@ -79,6 +86,7 @@ export default function NsMediumCard({
|
|
|
79
86
|
className,
|
|
80
87
|
fluid,
|
|
81
88
|
showArrowWithButtonText = false,
|
|
89
|
+
fontColor,
|
|
82
90
|
}: NsMediumCardProps): ReactElement {
|
|
83
91
|
return (
|
|
84
92
|
<CardContainer
|
|
@@ -91,10 +99,10 @@ export default function NsMediumCard({
|
|
|
91
99
|
>
|
|
92
100
|
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
93
101
|
<div className="content">
|
|
94
|
-
<NsTypography variant="h5" color=
|
|
102
|
+
<NsTypography variant="h5" color={fontColor} className="title" weight={titleFontWeight}>
|
|
95
103
|
{title}
|
|
96
104
|
</NsTypography>
|
|
97
|
-
<article className=
|
|
105
|
+
<article className={`subtitle mt-3 mb-5 ${fontColor}`}>{subtitle}</article>
|
|
98
106
|
{button ? <CardButton {...button} showArrowWithText={showArrowWithButtonText} /> : null}
|
|
99
107
|
</div>
|
|
100
108
|
</CardContainer>
|
|
@@ -11,6 +11,7 @@ type NsPostProps = {
|
|
|
11
11
|
body: string;
|
|
12
12
|
backgroundImageDetail: BynderImageDataType;
|
|
13
13
|
className?: string;
|
|
14
|
+
fontColor?: 'primary' | 'secondary';
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const CardContainer = styled(Box)`
|
|
@@ -26,7 +27,7 @@ const CardContainer = styled(Box)`
|
|
|
26
27
|
.image {
|
|
27
28
|
height: 180px;
|
|
28
29
|
overflow: hidden;
|
|
29
|
-
object-fit: contain
|
|
30
|
+
object-fit: contain;
|
|
30
31
|
}
|
|
31
32
|
.content {
|
|
32
33
|
padding: 20px;
|
|
@@ -34,7 +35,7 @@ const CardContainer = styled(Box)`
|
|
|
34
35
|
flex-direction: column;
|
|
35
36
|
min-height: 92px;
|
|
36
37
|
max-height: 92px;
|
|
37
|
-
justify-content: space-around
|
|
38
|
+
justify-content: space-around;
|
|
38
39
|
}
|
|
39
40
|
.body-title {
|
|
40
41
|
font-size: 18px;
|
|
@@ -44,7 +45,7 @@ const CardContainer = styled(Box)`
|
|
|
44
45
|
-webkit-line-clamp: 1;
|
|
45
46
|
overflow: hidden;
|
|
46
47
|
text-overflow: ellipsis;
|
|
47
|
-
margin: 0
|
|
48
|
+
margin: 0;
|
|
48
49
|
}
|
|
49
50
|
.body-text {
|
|
50
51
|
font-size: 12px;
|
|
@@ -54,20 +55,20 @@ const CardContainer = styled(Box)`
|
|
|
54
55
|
-webkit-line-clamp: 1;
|
|
55
56
|
overflow: hidden;
|
|
56
57
|
text-overflow: ellipsis;
|
|
57
|
-
color: #
|
|
58
|
-
margin: 0
|
|
58
|
+
color: #8c8c8c;
|
|
59
|
+
margin: 0;
|
|
59
60
|
}
|
|
60
61
|
`;
|
|
61
62
|
|
|
62
|
-
const NsPost = ({ text, body, backgroundImageDetail, className }: NsPostProps): ReactElement => {
|
|
63
|
+
const NsPost = ({ text, body, backgroundImageDetail, className, fontColor }: NsPostProps): ReactElement => {
|
|
63
64
|
return (
|
|
64
65
|
<CardContainer className={className} data-testid="post-card">
|
|
65
66
|
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
66
67
|
<article className="content">
|
|
67
|
-
<h2 className=
|
|
68
|
+
<h2 className={`body-title ${fontColor}`} title={text}>
|
|
68
69
|
{text}
|
|
69
70
|
</h2>
|
|
70
|
-
<p className=
|
|
71
|
+
<p className={`body-text ${fontColor}`} title={body?.substring(0, 80)}>
|
|
71
72
|
{body}
|
|
72
73
|
</p>
|
|
73
74
|
</article>
|
|
@@ -14,6 +14,7 @@ type NsSmallFullCardProps = {
|
|
|
14
14
|
backgroundImageDetail: BynderImageDataType;
|
|
15
15
|
button?: NsCardButton;
|
|
16
16
|
className?: string;
|
|
17
|
+
fontColor?: 'primary' | 'secondary';
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
const CardContainer = styled(Box)`
|
|
@@ -26,7 +27,7 @@ const CardContainer = styled(Box)`
|
|
|
26
27
|
.image {
|
|
27
28
|
width: 100%;
|
|
28
29
|
height: 100%;
|
|
29
|
-
object-fit: cover
|
|
30
|
+
object-fit: cover;
|
|
30
31
|
}
|
|
31
32
|
.gradientOverlay {
|
|
32
33
|
position: absolute;
|
|
@@ -34,7 +35,7 @@ const CardContainer = styled(Box)`
|
|
|
34
35
|
left: 0;
|
|
35
36
|
width: 100%;
|
|
36
37
|
height: 100%;
|
|
37
|
-
background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
|
|
38
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
|
|
38
39
|
}
|
|
39
40
|
.content {
|
|
40
41
|
position: absolute;
|
|
@@ -42,27 +43,33 @@ const CardContainer = styled(Box)`
|
|
|
42
43
|
width: 100%;
|
|
43
44
|
padding: 40px 40px 25px 30px;
|
|
44
45
|
display: flex;
|
|
45
|
-
flex-direction: column
|
|
46
|
+
flex-direction: column;
|
|
46
47
|
}
|
|
47
48
|
.subtitle {
|
|
48
49
|
color: #fff;
|
|
49
50
|
font-size: 11px;
|
|
50
51
|
font-weight: 400;
|
|
51
|
-
margin-top: auto
|
|
52
|
+
margin-top: auto;
|
|
52
53
|
}
|
|
53
54
|
.title {
|
|
54
55
|
color: #fff;
|
|
55
56
|
font-size: 26px;
|
|
56
57
|
font-weight: 400;
|
|
57
|
-
margin-top: 20px
|
|
58
|
+
margin-top: 20px;
|
|
58
59
|
}
|
|
59
60
|
.cta {
|
|
60
61
|
margin-top: 20px;
|
|
61
62
|
max-width: 208px;
|
|
62
63
|
border-radius: 4px;
|
|
63
|
-
overflow: hidden
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
}
|
|
66
|
+
.primary {
|
|
67
|
+
color: #fff;
|
|
68
|
+
}
|
|
69
|
+
.secondary {
|
|
70
|
+
color: #000;
|
|
64
71
|
}
|
|
65
|
-
|
|
72
|
+
`;
|
|
66
73
|
|
|
67
74
|
export default function NsSmallFullCard({
|
|
68
75
|
title,
|
|
@@ -70,14 +77,15 @@ export default function NsSmallFullCard({
|
|
|
70
77
|
backgroundImageDetail,
|
|
71
78
|
button,
|
|
72
79
|
className,
|
|
80
|
+
fontColor,
|
|
73
81
|
}: NsSmallFullCardProps): ReactElement {
|
|
74
82
|
return (
|
|
75
83
|
<CardContainer className={className} role="small-full-card" component="div" data-testid="small-full-card">
|
|
76
84
|
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
77
85
|
<div className="gradientOverlay"></div>
|
|
78
86
|
<div className="content">
|
|
79
|
-
<article className=
|
|
80
|
-
<article className=
|
|
87
|
+
<article className={`subtitle ${fontColor}`}>{subtitle}</article>
|
|
88
|
+
<article className={`title ${fontColor}`}>{title}</article>
|
|
81
89
|
{button ? <CardButton {...button} /> : null}
|
|
82
90
|
</div>
|
|
83
91
|
</CardContainer>
|
|
@@ -14,6 +14,7 @@ type NsXLargeCardProps = {
|
|
|
14
14
|
backgroundImageDetail: BynderImageDataType;
|
|
15
15
|
button?: NsCardButton;
|
|
16
16
|
className?: string;
|
|
17
|
+
fontColor?: 'primary' | 'secondary';
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
const CardContainer = styled(Box)`
|
|
@@ -33,7 +34,7 @@ const CardContainer = styled(Box)`
|
|
|
33
34
|
left: 0;
|
|
34
35
|
width: 100%;
|
|
35
36
|
height: 100%;
|
|
36
|
-
background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
|
|
37
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
|
|
37
38
|
}
|
|
38
39
|
.content {
|
|
39
40
|
position: absolute;
|
|
@@ -55,10 +56,16 @@ const CardContainer = styled(Box)`
|
|
|
55
56
|
font-weight: 400;
|
|
56
57
|
margin-top: 20px;
|
|
57
58
|
}
|
|
59
|
+
.primary {
|
|
60
|
+
color: #fff;
|
|
61
|
+
}
|
|
62
|
+
.secondary {
|
|
63
|
+
color: #000;
|
|
64
|
+
}
|
|
58
65
|
.cta {
|
|
59
66
|
margin-top: 20px;
|
|
60
67
|
}
|
|
61
|
-
|
|
68
|
+
`;
|
|
62
69
|
|
|
63
70
|
export default function NsXLargeCard({
|
|
64
71
|
title,
|
|
@@ -66,14 +73,15 @@ export default function NsXLargeCard({
|
|
|
66
73
|
backgroundImageDetail,
|
|
67
74
|
button,
|
|
68
75
|
className,
|
|
76
|
+
fontColor,
|
|
69
77
|
}: NsXLargeCardProps): ReactElement {
|
|
70
78
|
return (
|
|
71
79
|
<CardContainer className={className} role="x-large-card" component="div" data-testid="x-large-card">
|
|
72
80
|
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
73
81
|
<div className="gradientOverlay"></div>
|
|
74
82
|
<div className="content">
|
|
75
|
-
<article className=
|
|
76
|
-
<article className=
|
|
83
|
+
<article className={`subtitle ${fontColor}`}>{subtitle}</article>
|
|
84
|
+
<article className={`title ${fontColor}`}>{title}</article>
|
|
77
85
|
{button ? <CardButton {...button} /> : null}
|
|
78
86
|
</div>
|
|
79
87
|
</CardContainer>
|