@soul-refiner/design-system 1.1.0 → 1.1.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.
@@ -62,10 +62,10 @@ export const MeetingCard = ({ href, image, sx, title, actions, course, startDate
62
62
  startTime,
63
63
  " - ",
64
64
  endTime)),
65
- React.createElement(Box, { "$align": "center", "$gap": 20 },
65
+ React.createElement(Box, { "$align": "center", "$gap": 20, sx: "max-width: 264px;" },
66
66
  React.createElement(Pin, { color: "grey-6" }),
67
67
  React.createElement(P, { as: "span", "$color": "grey-3", "$lineHeight": 20, "$fontSize": 14 }, location))),
68
- React.createElement(Box, { "$display": "flex", "$dir": "row", "$gap": 8, sx: "margin-top: 16px; width: 100%;" }, React.Children.toArray(actions)))));
68
+ React.createElement(Box, { "$display": "flex", "$dir": "row", "$gap": 8, sx: "margin-top: 32px; width: 100%;" }, React.Children.toArray(actions)))));
69
69
  };
70
70
  const Wrapper = styled.div `
71
71
  min-width: 312px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const useClickOutside: (ref: React.Ref<HTMLElement>, cb: (...args: any[]) => unknown) => void;
@@ -1,10 +0,0 @@
1
- 'use client';
2
- import { useEventListener } from './event-listenter';
3
- export const useClickOutside = (ref, cb) => {
4
- useEventListener('click', (e) => {
5
- if (ref?.current == null ||
6
- ref?.current?.contains(e.target))
7
- return;
8
- cb(e);
9
- }, document);
10
- };
@@ -1 +0,0 @@
1
- export declare const useEventListener: (eventType: string, callback: (...args: any[]) => unknown, element?: Window & typeof globalThis) => void;
@@ -1,15 +0,0 @@
1
- 'use client';
2
- import React from 'react';
3
- export const useEventListener = (eventType, callback, element = window) => {
4
- const callbackRef = React.useRef(callback);
5
- React.useEffect(() => {
6
- callbackRef.current = callback;
7
- }, [callback]);
8
- React.useEffect(() => {
9
- if (element == null)
10
- return;
11
- const handler = (e) => callbackRef.current(e);
12
- element.addEventListener(eventType, handler);
13
- return () => element.removeEventListener(eventType, handler);
14
- }, [eventType, element]);
15
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const useHover: (ref: React.Ref<HTMLElement>) => boolean;
@@ -1,9 +0,0 @@
1
- 'use client';
2
- import React from 'react';
3
- import { useEventListener } from './event-listenter';
4
- export const useHover = (ref) => {
5
- const [hovered, setHovered] = React.useState(false);
6
- useEventListener('mouseover', () => setHovered(true), ref?.current);
7
- useEventListener('mouseout', () => setHovered(false), ref?.current);
8
- return hovered;
9
- };
@@ -1,4 +0,0 @@
1
- export { useClickOutside } from './click-outside';
2
- export { useEventListener } from './event-listenter';
3
- export { useHover } from './hover';
4
- export { useWindowSize } from './window-size';
@@ -1,4 +0,0 @@
1
- export { useClickOutside } from './click-outside';
2
- export { useEventListener } from './event-listenter';
3
- export { useHover } from './hover';
4
- export { useWindowSize } from './window-size';
@@ -1,4 +0,0 @@
1
- export declare const useWindowSize: () => {
2
- width: number;
3
- height: number;
4
- };
@@ -1,13 +0,0 @@
1
- 'use client';
2
- import React from 'react';
3
- import { useEventListener } from './event-listenter';
4
- export const useWindowSize = () => {
5
- const [windowSize, setWindowSize] = React.useState({
6
- width: window.innerWidth,
7
- height: window.innerHeight,
8
- });
9
- useEventListener('resize', () => {
10
- setWindowSize({ width: window.innerWidth, height: window.innerHeight });
11
- });
12
- return windowSize;
13
- };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- interface PlaylistItemProps {
3
- duration: number;
4
- onClick: () => void;
5
- progress?: number;
6
- shortDescription: string;
7
- thumbnail: string;
8
- title: string;
9
- }
10
- export declare const PlaylistItem: ({ duration, onClick, progress, shortDescription, thumbnail, title, }: PlaylistItemProps) => React.JSX.Element;
11
- export {};
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import Image from 'next/image';
3
- import styled from 'styled-components';
4
- import { Box } from '../../atoms/box';
5
- import { SecToDuration } from '../../atoms/seconds_to_duration';
6
- import { P } from '../../atoms/typography';
7
- import { PlaySolid } from '../../../icons/audio_video';
8
- export const PlaylistItem = ({ duration, onClick, progress = 0, shortDescription, thumbnail, title, }) => {
9
- return (React.createElement(Wrapper, { onClick: onClick },
10
- React.createElement(PlaySolid, { color: "white", size: 16, sx: "position: absolute; left: 8px; bottom: 4px;" }),
11
- React.createElement(Image, { alt: `thumbnail for ${title}`, height: 75, src: thumbnail, width: 133 }),
12
- React.createElement(ProgressBar, { progressPercent: progress / duration }),
13
- React.createElement(Box, { "$dir": "column", "$gap": 4, sx: "margin-left: 16px; margin-right: auto; flex: 0 1 auto; flex-basis: content;" },
14
- React.createElement(P, { "$color": "grey-10", "$semiBold": true }, title),
15
- React.createElement(P, { "$color": "grey-9", "$fontSize": 14, "$lineHeight": 20, "$textClampLines": 2, sx: "max-width: min(500px, 75%);" }, shortDescription)),
16
- React.createElement(P, { "$color": "grey-8", "$fontSize": 14, "$lineHeight": 20, sx: "flex-shrink: 0;" },
17
- React.createElement(SecToDuration, { seconds: duration }))));
18
- };
19
- const Wrapper = styled.div `
20
- width: 100%;
21
- flex: 0 1 auto;
22
- display: flex;
23
- align-items: center;
24
- position: relative;
25
- box-sizing: border-box;
26
- cursor: pointer;
27
- `;
28
- const ProgressBar = ({ progressPercent }) => (React.createElement(ProgressBarSvg, { viewBox: "0 0 133 2", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
29
- React.createElement("rect", { width: 133 * progressPercent, height: "2", fill: "var(--color-primary-blue-2)" }),
30
- React.createElement("rect", { x: 133 * progressPercent, width: 133 - 133 * progressPercent, height: "2", fill: "var(--color-grey-8)" })));
31
- const ProgressBarSvg = styled.svg `
32
- width: 133px;
33
- position: absolute;
34
- bottom: 0px;
35
- left: 0px;
36
- `;
@@ -1 +0,0 @@
1
- export declare const abbrTimeBeforeDate: (date: Date) => string;
@@ -1,26 +0,0 @@
1
- export const abbrTimeBeforeDate = (date) => {
2
- const now = new Date();
3
- const diff = now.getTime() - date.getTime();
4
- if (diff < 60000) {
5
- // under 1 min
6
- return 'Just now';
7
- }
8
- else if (diff < 3600000) {
9
- // under one hour
10
- const minutes = Math.floor(diff / 60000);
11
- return `${minutes} ${minutes === 1 ? 'min' : 'mins'}`;
12
- }
13
- else if (diff < 86400000) {
14
- // under one day
15
- const hours = Math.floor(diff / 3600000);
16
- return `${hours} ${hours === 1 ? 'hour' : 'hours'}`;
17
- }
18
- else if (diff < 604800000) {
19
- // under one week
20
- const days = Math.floor(diff / 86400000);
21
- return `${days} ${days === 1 ? 'day' : 'days'}`;
22
- }
23
- else {
24
- return date.toDateString().slice(4);
25
- }
26
- };