@soul-refiner/design-system 1.7.12 → 1.7.14

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.
@@ -8,10 +8,11 @@ export interface AudioEpisodeCardProps {
8
8
  image: string;
9
9
  logo?: React.ReactElement;
10
10
  numRating: number;
11
+ purchaseText?: string;
11
12
  rating: number;
12
13
  subtitle: string;
13
14
  supportLabel?: string;
14
15
  sx?: string;
15
16
  title: string;
16
17
  }
17
- export declare const AudioEpisodeCard: ({ actions, actionDropdown, content, cta, href, image, logo, numRating, rating, subtitle, supportLabel, sx, title, }: AudioEpisodeCardProps) => React.JSX.Element;
18
+ export declare const AudioEpisodeCard: ({ actions, actionDropdown, content, cta, href, image, logo, numRating, purchaseText, rating, subtitle, supportLabel, sx, title, }: AudioEpisodeCardProps) => React.JSX.Element;
@@ -2,18 +2,23 @@
2
2
  import React from 'react';
3
3
  import Image from 'next/image';
4
4
  import styled from 'styled-components';
5
+ import { PurchaseTextWrapper } from '../card';
5
6
  import { Box, H, P, Rate } from '../../';
6
- export const AudioEpisodeCard = ({ actions, actionDropdown, content, cta, href, image, logo, numRating, rating, subtitle, supportLabel, sx, title, }) => {
7
+ import { CartFilled } from '../../../icons/shopping/cart_filled';
8
+ export const AudioEpisodeCard = ({ actions, actionDropdown, content, cta, href, image, logo, numRating, purchaseText, rating, subtitle, supportLabel, sx, title, }) => {
7
9
  const hasLogo = !!logo;
8
10
  return (React.createElement(Wrapper, { "$sx": sx, href: href },
9
11
  React.createElement(Figure, null,
10
12
  actionDropdown && React.createElement(DropdownWrapper, null, actionDropdown),
13
+ purchaseText && (React.createElement(PurchaseTextWrapper, { className: "not-hover" },
14
+ React.createElement(CartFilled, { color: "yellow-5", size: 24 }),
15
+ React.createElement(P, { "$bold": true, "$color": "white" }, purchaseText))),
11
16
  React.createElement(Image, { alt: "", className: "thumbnail", height: 228, quality: 100, src: image, width: 228 }),
12
17
  React.createElement(Figcaption, null,
13
18
  React.createElement(Box, { "$display": "block", className: "hidden" }, cta),
14
19
  React.createElement(Box, { "$align": "center", "$dir": "row", "$gap": 16 },
15
20
  logo,
16
- React.createElement(Box, { "$dir": "column" },
21
+ React.createElement(Box, { "$dir": "column", "$gap": 4 },
17
22
  React.createElement(H, { "$color": "grey-2", "$semiBold": true, "$fontSize": hasLogo ? 18 : 16 }, title),
18
23
  React.createElement(P, { "$color": "grey-4", "$fontSize": 12, "$lineHeight": 16 }, subtitle)),
19
24
  supportLabel && (React.createElement(P, { className: "not-hover", "$color": "grey-4", "$fontSize": 12, "$lineHeight": 16, sx: "margin-left: auto; align-self: flex-end; margin-bottom: 2.5px;" }, supportLabel))),
@@ -39,6 +44,10 @@ const Wrapper = styled.a `
39
44
  figure {
40
45
  transition: width 0.3s;
41
46
  width: 213px;
47
+
48
+ img {
49
+ box-shadow: var(--elevation-3);
50
+ }
42
51
  }
43
52
 
44
53
  .hidden {
@@ -77,6 +86,10 @@ const Wrapper = styled.a `
77
86
  rgba(255, 255, 255, 0.85) 55%,
78
87
  rgba(255, 255, 255, 0.1) 80%
79
88
  );
89
+
90
+ img {
91
+ box-shadow: none;
92
+ }
80
93
  }
81
94
 
82
95
  figcaption {
@@ -97,6 +110,7 @@ const Figure = styled.figure `
97
110
  position: relative;
98
111
  z-index: -1;
99
112
  width: 100%;
113
+ height: 225px;
100
114
  aspect-ratio: 228 / 228;
101
115
  }
102
116
  `;
@@ -13,4 +13,5 @@ export type CardProps = (ActionCardProps | AudioEpisodeCardProps | FeatureCardPr
13
13
  type: CardType;
14
14
  };
15
15
  export declare const Card: ({ type, ...rest }: CardProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
16
+ export declare const PurchaseTextWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("../atoms/box").BoxProps, never>> & Omit<({ $display, sx, ...args }: import("../atoms/box").BoxProps) => React.JSX.Element, keyof React.Component<any, {}, any>>;
16
17
  export {};
@@ -1,5 +1,7 @@
1
1
  'use client';
2
2
  import React from 'react';
3
+ import styled from 'styled-components';
4
+ import { Box } from '../atoms/box';
3
5
  import { ActionCard } from './action';
4
6
  import { AudioEpisodeCard } from './audio';
5
7
  import { FeatureCard } from './feature';
@@ -23,3 +25,11 @@ export const Card = ({ type = 'regular', ...rest }) => {
23
25
  };
24
26
  return lookup[type];
25
27
  };
28
+ export const PurchaseTextWrapper = styled(Box) `
29
+ position: absolute;
30
+ top: 16px;
31
+ left: 16px;
32
+ width: calc(100% - 32px);
33
+ gap: 8px;
34
+ align-items: center;
35
+ `;
@@ -8,10 +8,11 @@ export interface VideoEpisodeCardProps {
8
8
  image: string;
9
9
  logo?: React.ReactElement;
10
10
  numRating: number;
11
+ purchaseText?: string;
11
12
  rating: number;
12
13
  subtitle: string;
13
14
  supportLabel?: string;
14
15
  sx?: string;
15
16
  title: string;
16
17
  }
17
- export declare const VideoEpisodeCard: ({ actions, actionDropdown, content, cta, href, image, logo, numRating, rating, subtitle, supportLabel, sx, title, }: VideoEpisodeCardProps) => React.JSX.Element;
18
+ export declare const VideoEpisodeCard: ({ actions, actionDropdown, content, cta, href, image, logo, numRating, purchaseText, rating, subtitle, supportLabel, sx, title, }: VideoEpisodeCardProps) => React.JSX.Element;
@@ -2,18 +2,23 @@
2
2
  import React from 'react';
3
3
  import Image from 'next/image';
4
4
  import styled from 'styled-components';
5
+ import { PurchaseTextWrapper } from '../card';
5
6
  import { Box, H, P, Rate } from '../../';
6
- export const VideoEpisodeCard = ({ actions, actionDropdown, content, cta, href, image, logo, numRating, rating, subtitle, supportLabel, sx, title, }) => {
7
+ import { CartFilled } from '../../../icons/shopping/cart_filled';
8
+ export const VideoEpisodeCard = ({ actions, actionDropdown, content, cta, href, image, logo, numRating, purchaseText, rating, subtitle, supportLabel, sx, title, }) => {
7
9
  const hasLogo = !!logo;
8
10
  return (React.createElement(Wrapper, { "$sx": sx, href: href },
9
11
  React.createElement(Figure, null,
10
12
  actionDropdown && React.createElement(DropdownWrapper, null, actionDropdown),
13
+ purchaseText && (React.createElement(PurchaseTextWrapper, { className: "not-hover" },
14
+ React.createElement(CartFilled, { color: "yellow-5", size: 24 }),
15
+ React.createElement(P, { "$bold": true, "$color": "white" }, purchaseText))),
11
16
  React.createElement(Image, { alt: "", className: "thumbnail", height: 213, quality: 100, src: image, width: 379 }),
12
17
  React.createElement(Figcaption, null,
13
18
  React.createElement(Box, { "$display": "block", className: "hidden" }, cta),
14
19
  React.createElement(Box, { "$align": "center", "$dir": "row", "$gap": 16 },
15
20
  logo,
16
- React.createElement(Box, { "$dir": "column" },
21
+ React.createElement(Box, { "$dir": "column", "$gap": 4 },
17
22
  React.createElement(H, { "$color": "grey-2", "$semiBold": true, "$fontSize": hasLogo ? 18 : 16 }, title),
18
23
  React.createElement(P, { "$color": "grey-4", "$fontSize": 12, "$lineHeight": 16 }, subtitle)),
19
24
  supportLabel && (React.createElement(P, { className: "not-hover", "$color": "grey-4", "$fontSize": 12, "$lineHeight": 16, sx: "margin-left: auto; align-self: flex-end; margin-bottom: 2.5px;" }, supportLabel))),
@@ -40,6 +45,10 @@ const Wrapper = styled.a `
40
45
  figure {
41
46
  transition: width 0.3s;
42
47
  width: 379px;
48
+
49
+ img {
50
+ box-shadow: var(--elevation-3);
51
+ }
43
52
  }
44
53
 
45
54
  .hidden {
@@ -72,6 +81,10 @@ const Wrapper = styled.a `
72
81
  rgba(255, 255, 255, 0.85) 55%,
73
82
  rgba(255, 255, 255, 0.1) 80%
74
83
  );
84
+
85
+ img {
86
+ box-shadow: none;
87
+ }
75
88
  }
76
89
 
77
90
  figcaption {
@@ -94,7 +107,7 @@ const Figure = styled.figure `
94
107
  z-index: -1;
95
108
  width: 100%;
96
109
  aspect-ratio: 379 / 213;
97
- height: 228px;
110
+ height: 225px;
98
111
  border-radius: 16px;
99
112
  }
100
113
  `;
@@ -8,10 +8,11 @@ export interface WrittenEpisodeCardProps {
8
8
  image: string;
9
9
  logo?: React.ReactElement;
10
10
  numRating: number;
11
+ purchaseText?: string;
11
12
  rating: number;
12
13
  subtitle: string;
13
14
  supportLabel?: string;
14
15
  sx?: string;
15
16
  title: string;
16
17
  }
17
- export declare const WrittenEpisodeCard: ({ actions, actionDropdown, content, cta, href, image, logo, numRating, rating, subtitle, supportLabel, sx, title, }: WrittenEpisodeCardProps) => React.JSX.Element;
18
+ export declare const WrittenEpisodeCard: ({ actions, actionDropdown, content, cta, href, image, logo, numRating, purchaseText, rating, subtitle, supportLabel, sx, title, }: WrittenEpisodeCardProps) => React.JSX.Element;
@@ -2,18 +2,23 @@
2
2
  import React from 'react';
3
3
  import Image from 'next/image';
4
4
  import styled from 'styled-components';
5
+ import { PurchaseTextWrapper } from '../card';
5
6
  import { Box, H, P, Rate } from '../../';
6
- export const WrittenEpisodeCard = ({ actions, actionDropdown, content, cta, href, image, logo, numRating, rating, subtitle, supportLabel, sx, title, }) => {
7
+ import { CartFilled } from '../../../icons/shopping/cart_filled';
8
+ export const WrittenEpisodeCard = ({ actions, actionDropdown, content, cta, href, image, logo, numRating, purchaseText, rating, subtitle, supportLabel, sx, title, }) => {
7
9
  const hasLogo = !!logo;
8
10
  return (React.createElement(Wrapper, { "$sx": sx, href: href },
9
11
  React.createElement(Figure, null,
10
12
  actionDropdown && React.createElement(DropdownWrapper, null, actionDropdown),
13
+ purchaseText && (React.createElement(PurchaseTextWrapper, { className: "not-hover" },
14
+ React.createElement(CartFilled, { color: "yellow-5", size: 24, sx: "flex-shrink: 0;" }),
15
+ React.createElement(P, { "$bold": true, "$color": "white" }, purchaseText))),
11
16
  React.createElement(Image, { alt: "", className: "thumbnail", height: 228, quality: 100, src: image, width: 176 }),
12
17
  React.createElement(Figcaption, null,
13
18
  React.createElement(Box, { "$display": "block", className: "hidden" }, cta),
14
19
  React.createElement(Box, { "$align": "center", "$dir": "row", "$gap": 16 },
15
20
  logo,
16
- React.createElement(Box, { "$dir": "column" },
21
+ React.createElement(Box, { "$dir": "column", "$gap": 4 },
17
22
  React.createElement(H, { "$color": "grey-2", "$semiBold": true, "$fontSize": hasLogo ? 18 : 16 }, title),
18
23
  React.createElement(P, { "$color": "grey-4", "$fontSize": 12, "$lineHeight": 16 }, subtitle)),
19
24
  supportLabel && (React.createElement(P, { className: "not-hover", "$color": "grey-4", "$fontSize": 12, "$lineHeight": 16, sx: "margin-left: auto; align-self: flex-end; margin-bottom: 2.5px;" }, supportLabel))),
@@ -32,13 +37,17 @@ const Wrapper = styled.a `
32
37
  position: relative;
33
38
  z-index: 1;
34
39
  user-select: none;
35
- width: 149px;
40
+ aspect-ratio: 149 / 275;
36
41
  height: 288px;
37
42
  transition: transform 0.3s;
38
43
 
39
44
  figure {
40
45
  transition: width 0.3s;
41
46
  width: 149px;
47
+
48
+ img {
49
+ box-shadow: var(--elevation-3);
50
+ }
42
51
  }
43
52
 
44
53
  .hidden {
@@ -77,6 +86,10 @@ const Wrapper = styled.a `
77
86
  rgba(255, 255, 255, 0.85) 55%,
78
87
  rgba(255, 255, 255, 0.1) 80%
79
88
  );
89
+
90
+ img {
91
+ box-shadow: none;
92
+ }
80
93
  }
81
94
 
82
95
  figcaption {
@@ -97,7 +110,7 @@ const Figure = styled.figure `
97
110
  position: relative;
98
111
  z-index: -1;
99
112
  width: 100%;
100
- height: 228px;
113
+ height: 225px;
101
114
  aspect-ratio: 228 / 326;
102
115
  }
103
116
  `;
@@ -24,22 +24,41 @@ export const Post = ({ actions, author, authorActive, authorHref, authorImage, a
24
24
  else if (event.key === 'ArrowRight') {
25
25
  handleIncrement();
26
26
  }
27
+ else if (event.key === 'Escape' || event.key === 'Enter') {
28
+ setCurr(-1);
29
+ }
27
30
  };
28
- if (typeof document !== 'undefined') {
31
+ if (typeof document !== 'undefined' && !!images?.length) {
29
32
  document.addEventListener('keydown', handleKeyEvent);
30
33
  }
31
34
  return () => {
32
- document.removeEventListener('keydown', handleKeyEvent);
35
+ images?.length &&
36
+ document.removeEventListener('keydown', handleKeyEvent);
33
37
  };
34
38
  }, []);
35
39
  const _actions = React.Children.toArray(actions);
36
40
  const _comments = React.Children.toArray(children);
37
41
  const handleImageLoad = (event) => {
38
42
  const { naturalHeight, naturalWidth } = event.target;
39
- setModalContentSize({
40
- x: `${naturalWidth}px`,
41
- y: `${naturalHeight}px`,
42
- });
43
+ let x = `${naturalWidth}px`;
44
+ let y = `${naturalHeight}px`;
45
+ // if natural size is smaller than window height and width
46
+ if (window?.innerHeight < naturalHeight &&
47
+ window?.innerWidth < naturalWidth) {
48
+ x = `${Math.floor((window.innerHeight * 0.95 * naturalWidth) / naturalHeight)}px`;
49
+ y = `${Math.round((window.innerWidth * 0.95 * naturalHeight) / naturalWidth)}px`;
50
+ // just smaller than height
51
+ }
52
+ else if (window?.innerHeight < naturalHeight) {
53
+ x = `${Math.floor((window.innerHeight * 0.95 * naturalWidth) / naturalHeight)}px`;
54
+ y = '95vh';
55
+ // just smaller than width
56
+ }
57
+ else if (window?.innerWidth < naturalWidth) {
58
+ x = '95vw';
59
+ y = `${Math.round((window.innerWidth * 0.95 * naturalHeight) / naturalWidth)}px`;
60
+ }
61
+ setModalContentSize({ x, y });
43
62
  };
44
63
  const handleIncrement = () => {
45
64
  setCurr((prev) => {
@@ -62,7 +81,7 @@ export const Post = ({ actions, author, authorActive, authorHref, authorImage, a
62
81
  });
63
82
  };
64
83
  return (React.createElement(Wrapper, { id: id },
65
- curr > -1 && !!images?.[curr] && (React.createElement(Modal, { controlledOpen: true, onChange: (open) => !open && setCurr(-1) },
84
+ curr > -1 && !!images?.[curr] && (React.createElement(Modal, { alwaysRender: false, controlledOpen: true, onChange: (open) => !open && setCurr(-1) },
66
85
  React.createElement(Modal.Content, { sx: `
67
86
  position: relative;
68
87
  height: ${modalContentSize.y};
@@ -71,7 +90,7 @@ export const Post = ({ actions, author, authorActive, authorHref, authorImage, a
71
90
  ` },
72
91
  React.createElement(NavArrow, { "$side": "left", "$visible": curr !== 0, onClick: handleDecrement },
73
92
  React.createElement(ChevronLeft, { color: "white", size: 48 })),
74
- React.createElement(Image, { alt: "", fill: true, quality: 100, onLoad: handleImageLoad, priority: true, sizes: "100vw", src: images[curr], style: { objectFit: 'contain' } }),
93
+ React.createElement(Image, { alt: "", fill: true, quality: 100, onLoad: handleImageLoad, priority: true, sizes: "100vw", src: images[curr], style: { objectFit: 'cover' } }),
75
94
  React.createElement(NavArrow, { "$side": "right", "$visible": curr !== images.length - 1, onClick: handleIncrement },
76
95
  React.createElement(ChevronRight, { color: "white", size: 48 }))))),
77
96
  React.createElement(Header, null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "1.7.12",
3
+ "version": "1.7.14",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {