@soul-refiner/design-system 0.2.116 → 0.2.117

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.
@@ -33,6 +33,7 @@ const Wrapper = styled.a `
33
33
 
34
34
  figure {
35
35
  max-width: 228px;
36
+ width: max-content;
36
37
  }
37
38
 
38
39
  .hidden {
@@ -40,6 +41,9 @@ const Wrapper = styled.a `
40
41
  }
41
42
 
42
43
  &:hover {
44
+ padding: 4px;
45
+ transform: translate(-4px, -4px);
46
+
43
47
  .hidden {
44
48
  display: flex;
45
49
 
@@ -36,6 +36,9 @@ const Wrapper = styled.a `
36
36
  }
37
37
 
38
38
  &:hover {
39
+ padding: 4px;
40
+ transform: translate(-4px, -4px);
41
+
39
42
  .hidden {
40
43
  display: flex;
41
44
  }
@@ -69,6 +72,7 @@ const Wrapper = styled.a `
69
72
  `;
70
73
  const Figure = styled.figure `
71
74
  max-width: 410px;
75
+ width: max-content;
72
76
  margin: 0px;
73
77
  border-radius: 16px;
74
78
 
@@ -76,7 +80,8 @@ const Figure = styled.figure `
76
80
  position: relative;
77
81
  z-index: -1;
78
82
  width: 100%;
79
- aspect-ratio: 410 / 239;
83
+ aspect-ratio: 379 / 275;
84
+ height: 228px;
80
85
  border-radius: 16px;
81
86
  }
82
87
  `;
@@ -33,6 +33,7 @@ const Wrapper = styled.a `
33
33
 
34
34
  figure {
35
35
  max-width: 228px;
36
+ width: max-content;
36
37
  }
37
38
 
38
39
  .hidden {
@@ -40,6 +41,9 @@ const Wrapper = styled.a `
40
41
  }
41
42
 
42
43
  &:hover {
44
+ padding: 4px;
45
+ transform: translate(-4px, -4px);
46
+
43
47
  .hidden {
44
48
  display: flex;
45
49
 
@@ -86,6 +90,7 @@ const Figure = styled.figure `
86
90
  position: relative;
87
91
  z-index: -1;
88
92
  width: 100%;
93
+ height: 228px;
89
94
  aspect-ratio: 228 / 326;
90
95
  }
91
96
  `;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface CardCarouselProps extends React.PropsWithChildren {
3
+ onScrollEnd?: () => void;
4
+ scrollTriggerDistance?: number;
5
+ scrollDistance?: number;
6
+ sx?: string;
7
+ }
8
+ export declare const CardCarousel: ({ children, onScrollEnd, scrollTriggerDistance, scrollDistance, sx, }: CardCarouselProps) => React.JSX.Element;
@@ -0,0 +1,84 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import styled from 'styled-components';
4
+ import { ChevronLeft, ChevronRight } from '../../../../icons';
5
+ const DEFAULT_SCROLL_TRIGGER_DISTANCE = 11;
6
+ const DEFAULT_SCROLL_DISTANCE = 450;
7
+ export const CardCarousel = ({ children, onScrollEnd, scrollTriggerDistance = DEFAULT_SCROLL_TRIGGER_DISTANCE, scrollDistance = DEFAULT_SCROLL_DISTANCE, sx, }) => {
8
+ const ref = React.useRef(null);
9
+ const handleScroll = (event) => {
10
+ const target = event.target;
11
+ const scrollDistance = target.scrollWidth - target.scrollLeft;
12
+ if (scrollDistance - target.clientWidth < scrollTriggerDistance &&
13
+ onScrollEnd) {
14
+ onScrollEnd();
15
+ }
16
+ };
17
+ const onNavigateRight = () => {
18
+ if (ref.current) {
19
+ const amount = ref.current.scrollLeft + scrollDistance;
20
+ ref.current.scrollLeft = amount;
21
+ }
22
+ };
23
+ const onNavigateLeft = () => {
24
+ if (ref.current) {
25
+ const amount = ref.current.scrollLeft - scrollDistance;
26
+ ref.current.scrollLeft = amount < 0 ? 0 : amount;
27
+ }
28
+ };
29
+ return (React.createElement(Wrapper, { "$sx": sx },
30
+ React.createElement(Button, { className: "carousel-navigation", onClick: onNavigateLeft, "$side": "left" },
31
+ React.createElement(ChevronLeft, { color: "white", size: 48 })),
32
+ React.createElement(Inner, { onScroll: handleScroll, ref: ref }, children),
33
+ React.createElement(Button, { className: "carousel-navigation", onClick: onNavigateRight, "$side": "right" },
34
+ React.createElement(ChevronRight, { color: "white", size: 48 }))));
35
+ };
36
+ const Wrapper = styled.div `
37
+ position: relative;
38
+ height: 288px;
39
+
40
+ &:hover .carousel-navigation {
41
+ display: block;
42
+ }
43
+
44
+ ${({ $sx }) => ($sx ? $sx : '')}
45
+ `;
46
+ const Inner = styled.div `
47
+ overflow-x: scroll;
48
+ overflow-y: show;
49
+ display: flex;
50
+ gap: 24px;
51
+ flex-flow: row nowrap;
52
+ scroll-behavior: smooth;
53
+ padding-right: 32px;
54
+
55
+ &::-webkit-scrollbar {
56
+ width: 0px;
57
+ height: 0px;
58
+ }
59
+ `;
60
+ const Button = styled.button `
61
+ position: absolute;
62
+ z-index: 25;
63
+ top: 0px;
64
+ height: 100%;
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ outline: none;
69
+ border: none;
70
+ background: rgba(8, 8, 9, 0.5);
71
+ padding: 0px 16px;
72
+ cursor: pointer;
73
+
74
+ display: none;
75
+
76
+ ${({ $side }) => $side === 'left'
77
+ ? `
78
+ left: 0px;
79
+ border-radius: 0px 16px 16px 0px;
80
+ `
81
+ : `
82
+ right: 0px;
83
+ border-radius: 16px 0px 0px 16px;`};
84
+ `;
@@ -0,0 +1,2 @@
1
+ export { CardCarousel } from './card';
2
+ export type { CardCarouselProps } from './card';
@@ -0,0 +1 @@
1
+ export { CardCarousel } from './card';
@@ -0,0 +1,2 @@
1
+ export { CardCarousel } from './card';
2
+ export type { CardCarouselProps } from './card';
@@ -0,0 +1 @@
1
+ export { CardCarousel } from './card';
@@ -1,5 +1,7 @@
1
1
  export { Accordion } from './accordion';
2
2
  export type { AccordionProps, AccordionItemProps } from './accordion';
3
+ export { CardCarousel } from './carousel';
4
+ export type { CardCarouselProps } from './carousel';
3
5
  export { Comment } from './comment';
4
6
  export type { CommentProps } from './comment';
5
7
  export { Drawer } from './drawer';
@@ -1,4 +1,5 @@
1
1
  export { Accordion } from './accordion';
2
+ export { CardCarousel } from './carousel';
2
3
  export { Comment } from './comment';
3
4
  export { Drawer } from './drawer';
4
5
  export { Message } from './message';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.116",
3
+ "version": "0.2.117",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {