@nuskin/foundation-ui-components 1.9.1 → 1.9.2
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
CHANGED
|
@@ -7,7 +7,7 @@ type NsLargeCardProps = {
|
|
|
7
7
|
subtitle?: string;
|
|
8
8
|
intro: string;
|
|
9
9
|
icon?: NsIconNameType;
|
|
10
|
-
buttonVariant
|
|
10
|
+
buttonVariant?: 'text' | 'outlined' | 'contained';
|
|
11
11
|
backgroundImageUrl: string;
|
|
12
12
|
backgroundImageAlt: string;
|
|
13
13
|
cardLink: { href: string; title: string };
|
|
@@ -9,7 +9,7 @@ type NsMediumCardProps = {
|
|
|
9
9
|
icon?: NsIconNameType;
|
|
10
10
|
backgroundImageUrl: string;
|
|
11
11
|
backgroundImageAlt: string;
|
|
12
|
-
buttonVariant
|
|
12
|
+
buttonVariant?: 'text' | 'outlined' | 'contained';
|
|
13
13
|
cardLink: { href: string; title: string };
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -5,6 +5,7 @@ import { NsTypography, NsLink, NsIcon } from '..';
|
|
|
5
5
|
interface CarousalControlProps {
|
|
6
6
|
next(): void;
|
|
7
7
|
prev(): void;
|
|
8
|
+
viewAllLabel: string;
|
|
8
9
|
viewAllUrl: string;
|
|
9
10
|
}
|
|
10
11
|
/*
|
|
@@ -14,21 +15,24 @@ const Wrapper = styled.div`
|
|
|
14
15
|
display: flex;
|
|
15
16
|
justify-content: flex-end;
|
|
16
17
|
padding: 0 30px;
|
|
17
|
-
margin:
|
|
18
|
+
margin: 30px 20px;
|
|
18
19
|
`;
|
|
19
20
|
const InnerWrapper = styled.div`
|
|
20
21
|
display: flex;
|
|
21
|
-
width: 220px;
|
|
22
22
|
gap: 20px;
|
|
23
23
|
align-items: center;
|
|
24
24
|
`;
|
|
25
|
-
const CarousalControl = ({ next, prev, viewAllUrl }: CarousalControlProps) => {
|
|
25
|
+
const CarousalControl = ({ next, prev, viewAllUrl, viewAllLabel }: CarousalControlProps) => {
|
|
26
26
|
return (
|
|
27
27
|
<Wrapper>
|
|
28
28
|
<InnerWrapper>
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
29
|
+
{viewAllUrl ? (
|
|
30
|
+
<NsLink href={viewAllUrl} underlineOnHover={false}>
|
|
31
|
+
<NsTypography decoration="underline" variant={'h5'}>
|
|
32
|
+
{viewAllLabel}
|
|
33
|
+
</NsTypography>
|
|
34
|
+
</NsLink>
|
|
35
|
+
) : null}
|
|
32
36
|
<IconWrapper onClick={prev} className="carousal-prev-button">
|
|
33
37
|
<NsIcon name="arrowLeft" />
|
|
34
38
|
</IconWrapper>
|
|
@@ -21,11 +21,20 @@ const SlickContainer = styled(Box)(() => {
|
|
|
21
21
|
interface CarousalProps<T = any> {
|
|
22
22
|
entries: T[];
|
|
23
23
|
renderEntry(entry: T, index: number): ReactNode;
|
|
24
|
-
allEntryLink
|
|
24
|
+
allEntryLink?: string;
|
|
25
|
+
allEntryLabel?: string;
|
|
25
26
|
settings: any;
|
|
27
|
+
showControlButtons?: boolean;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
export default function NsCarousal({
|
|
30
|
+
export default function NsCarousal({
|
|
31
|
+
entries,
|
|
32
|
+
renderEntry,
|
|
33
|
+
allEntryLink = '',
|
|
34
|
+
settings,
|
|
35
|
+
allEntryLabel = 'View All',
|
|
36
|
+
showControlButtons = true,
|
|
37
|
+
}: CarousalProps) {
|
|
29
38
|
const sliderRef = useRef();
|
|
30
39
|
const prev = useCallback(() => {
|
|
31
40
|
if (sliderRef.current) {
|
|
@@ -41,9 +50,12 @@ export default function NsCarousal({ entries, renderEntry, allEntryLink, setting
|
|
|
41
50
|
}, [sliderRef]);
|
|
42
51
|
return (
|
|
43
52
|
<SlickContainer className="brand-carousal">
|
|
44
|
-
|
|
53
|
+
{showControlButtons ? (
|
|
54
|
+
<CarousalControl prev={prev} next={next} viewAllUrl={allEntryLink} viewAllLabel={allEntryLabel} />
|
|
55
|
+
) : null}
|
|
45
56
|
<Slider {...{ ...defaultCarousalSettings, ...settings }} ref={sliderRef as any}>
|
|
46
57
|
{entries.map((entry, index) => {
|
|
58
|
+
|
|
47
59
|
return renderEntry(entry, index);
|
|
48
60
|
})}
|
|
49
61
|
</Slider>
|
|
@@ -12,6 +12,13 @@ export default {
|
|
|
12
12
|
title: 'Components/Containers/NsCarousal/Brand',
|
|
13
13
|
component: NsCarousal,
|
|
14
14
|
argTypes: {},
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<div style={{ width: 800 }}>
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
15
22
|
} as MetaStory;
|
|
16
23
|
|
|
17
24
|
export const Default: Story = {
|