@ldelia/react-media 0.2.5 → 0.2.7

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.
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './Timeline.css';
3
2
  export interface TimelineProps {
4
3
  duration: number;
5
4
  value: number;
@@ -32,7 +32,24 @@ const TickTimeCollectionDisplay_1 = __importDefault(require("./TickTimeCollectio
32
32
  const VaLueLineCanvas_1 = __importDefault(require("./VaLueLineCanvas"));
33
33
  const RangeSelectorCanvas_1 = __importDefault(require("./RangeSelectorCanvas"));
34
34
  const constants_1 = require("./constants");
35
- require("./Timeline.css");
35
+ const styled_components_1 = __importDefault(require("styled-components"));
36
+ const TimelineContainer = styled_components_1.default.div `
37
+ background-color: #f0f0f0;
38
+ border: 1px solid #c9c9c9;
39
+ height: 80px;
40
+ width: 100%;
41
+ max-width: 100%;
42
+ overflow-x: auto;
43
+ position: relative;
44
+ display: flex;
45
+ `;
46
+ const TimelineWrapper = styled_components_1.default.div `
47
+ position: absolute;
48
+ height: 100%;
49
+ display: flex;
50
+ flex-direction: row;
51
+ align-items: center;
52
+ `;
36
53
  exports.ZoomContext = react_1.default.createContext({
37
54
  blockOffset: 0,
38
55
  pixelsInSecond: 0,
@@ -75,8 +92,8 @@ const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], withTime
75
92
  const scrollPosition = value * zoomParams.pixelsInSecond - 300;
76
93
  timeLineWrapper.scrollLeft = Math.max(0, scrollPosition);
77
94
  }, [value, zoomParams]);
78
- return (react_1.default.createElement("div", { ref: timeLineContainerRef, className: `timeline-container ${className}` },
79
- react_1.default.createElement("div", { className: 'timeline-wrapper', style: { width: duration * zoomParams.pixelsInSecond + 'px' } },
95
+ return (react_1.default.createElement(TimelineContainer, { ref: timeLineContainerRef, className: className },
96
+ react_1.default.createElement(TimelineWrapper, { style: { width: duration * zoomParams.pixelsInSecond + 'px' } },
80
97
  react_1.default.createElement(exports.ZoomContext.Provider, { value: zoomParams },
81
98
  react_1.default.createElement(VaLueLineCanvas_1.default, { blockStartingTimes: withTimeBlocks ? blockStartingTimes : [], value: value }),
82
99
  react_1.default.createElement(RangeSelectorCanvas_1.default, { selectedRange: selectedRange, onChange: onChange, onRangeChange: onRangeChange }),
@@ -1,12 +1,34 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
29
+ const react_1 = __importStar(require("react"));
7
30
  const styled_components_1 = __importDefault(require("styled-components"));
8
31
  const index_1 = require("./index");
9
- const react_2 = require("react");
10
32
  const utils_1 = require("./utils/utils");
11
33
  const OverlayCanvas = styled_components_1.default.canvas `
12
34
  position: absolute;
@@ -16,17 +38,28 @@ const OverlayCanvas = styled_components_1.default.canvas `
16
38
  height: 100%;
17
39
  color: #c9c9c9;
18
40
  `;
41
+ const PreValueLine = styled_components_1.default.span `
42
+ position: absolute;
43
+ left: 0;
44
+ height: 100%;
45
+ `;
19
46
  const ValueLine = styled_components_1.default.span `
20
47
  position: absolute;
21
48
  width: 1px;
22
49
  height: 100%;
23
50
  background-color: #575757;
24
51
  `;
52
+ const PostValueLine = styled_components_1.default.span `
53
+ position: absolute;
54
+ height: 100%;
55
+ `;
25
56
  const VaLueLineCanvas = ({ blockStartingTimes = [], value, }) => {
26
- const canvasRef = (0, react_2.useRef)(null);
27
- const valueLineRef = (0, react_2.useRef)(null);
28
- const zoomContextValue = (0, react_2.useContext)(index_1.ZoomContext);
29
- const showBlocks = (0, react_2.useCallback)((canvas) => {
57
+ const canvasRef = (0, react_1.useRef)(null);
58
+ const preValueLineRef = (0, react_1.useRef)(null);
59
+ const valueLineRef = (0, react_1.useRef)(null);
60
+ const postValueLineRef = (0, react_1.useRef)(null);
61
+ const zoomContextValue = (0, react_1.useContext)(index_1.ZoomContext);
62
+ const showBlocks = (0, react_1.useCallback)((canvas) => {
30
63
  const blockHeight = 20;
31
64
  const context = canvas.getContext('2d');
32
65
  for (const blockStartingTime of blockStartingTimes) {
@@ -43,18 +76,25 @@ const VaLueLineCanvas = ({ blockStartingTimes = [], value, }) => {
43
76
  context.stroke();
44
77
  }
45
78
  }, [blockStartingTimes, zoomContextValue]);
46
- const showValueLine = (0, react_2.useCallback)(() => {
47
- const linePosition = (0, utils_1.secondsToPixel)(zoomContextValue, value);
79
+ const showValueLine = (0, react_1.useCallback)(() => {
80
+ const canvas = canvasRef.current;
81
+ const preValueLineElement = preValueLineRef.current;
48
82
  const valueLineElement = valueLineRef.current;
49
- const elementWidthCSSProperty = window
50
- .getComputedStyle(valueLineElement)
51
- .getPropertyValue('width')
52
- .replace(/[^-\d]/g, '');
53
- const elementWidth = parseInt(elementWidthCSSProperty);
54
- const linePositionAtValueLineMiddle = linePosition - elementWidth / 2;
55
- valueLineElement.style.left = linePositionAtValueLineMiddle + 'px';
83
+ const postValueLineElement = postValueLineRef.current;
84
+ const valueLineWidth = (0, utils_1.getComputedElementWidth)(valueLineElement);
85
+ const linePosition = (0, utils_1.secondsToPixel)(zoomContextValue, value);
86
+ const valueLinePositionBeginningConsideringWidth = linePosition - valueLineWidth / 2;
87
+ // configure preValueLineElement
88
+ preValueLineElement.style.width = (0, utils_1.numberToPxString)(valueLinePositionBeginningConsideringWidth);
89
+ // configure valueLineElement
90
+ valueLineElement.style.left = (0, utils_1.numberToPxString)(valueLinePositionBeginningConsideringWidth);
91
+ // configure postValueLineElement
92
+ const postValueLinePosition = valueLinePositionBeginningConsideringWidth + valueLineWidth;
93
+ const postValueLineWidth = canvas.width - postValueLinePosition;
94
+ postValueLineElement.style.left = (0, utils_1.numberToPxString)(postValueLinePosition);
95
+ postValueLineElement.style.width = (0, utils_1.numberToPxString)(postValueLineWidth);
56
96
  }, [value, zoomContextValue]);
57
- (0, react_2.useEffect)(() => {
97
+ (0, react_1.useEffect)(() => {
58
98
  const canvas = canvasRef.current;
59
99
  // https://stackoverflow.com/questions/8696631/canvas-drawings-like-lines-are-blurry
60
100
  canvas.width = canvas.offsetWidth;
@@ -64,6 +104,8 @@ const VaLueLineCanvas = ({ blockStartingTimes = [], value, }) => {
64
104
  }, [showBlocks, showValueLine]);
65
105
  return (react_1.default.createElement(react_1.default.Fragment, null,
66
106
  react_1.default.createElement(OverlayCanvas, { ref: canvasRef, className: 'media-timeline-value-line-canvas' }),
67
- react_1.default.createElement(ValueLine, { ref: valueLineRef, className: 'media-timeline-value-line' })));
107
+ react_1.default.createElement(PreValueLine, { ref: preValueLineRef, className: 'media-timeline-pre-value-line' }),
108
+ react_1.default.createElement(ValueLine, { ref: valueLineRef, className: 'media-timeline-value-line' }),
109
+ react_1.default.createElement(PostValueLine, { ref: postValueLineRef, className: 'media-timeline-post-value-line' })));
68
110
  };
69
111
  exports.default = VaLueLineCanvas;
@@ -1,3 +1,5 @@
1
1
  import { ZoomContextType } from '../index';
2
2
  export declare const secondsToPixel: (zoomContextValue: ZoomContextType, seconds: number) => number;
3
3
  export declare const pixelToSeconds: (zoomContextValue: ZoomContextType, pixel: number) => number;
4
+ export declare const getComputedElementWidth: (element: HTMLElement) => number;
5
+ export declare const numberToPxString: (number: number) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pixelToSeconds = exports.secondsToPixel = void 0;
3
+ exports.numberToPxString = exports.getComputedElementWidth = exports.pixelToSeconds = exports.secondsToPixel = void 0;
4
4
  const secondsToPixel = (zoomContextValue, seconds) => {
5
5
  return zoomContextValue.pixelsInSecond * seconds;
6
6
  };
@@ -10,3 +10,15 @@ const pixelToSeconds = (zoomContextValue, pixel) => {
10
10
  return Math.round((seconds + Number.EPSILON) * 100) / 100;
11
11
  };
12
12
  exports.pixelToSeconds = pixelToSeconds;
13
+ const getComputedElementWidth = (element) => {
14
+ const elementWidthCSSProperty = window
15
+ .getComputedStyle(element)
16
+ .getPropertyValue('width')
17
+ .replace(/[^-\d]/g, '');
18
+ return parseInt(elementWidthCSSProperty);
19
+ };
20
+ exports.getComputedElementWidth = getComputedElementWidth;
21
+ const numberToPxString = (number) => {
22
+ return `${number}px`;
23
+ };
24
+ exports.numberToPxString = numberToPxString;
@@ -5,4 +5,5 @@ export default _default;
5
5
  export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
6
6
  export declare const WithSelectedRange: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
7
7
  export declare const WithCustomClassName: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
8
- export declare const WithOutTimeBlocks: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
8
+ export declare const WithoutTimeBlocks: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
9
+ export declare const Minimalist: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WithOutTimeBlocks = exports.WithCustomClassName = exports.WithSelectedRange = exports.Default = void 0;
6
+ exports.Minimalist = exports.WithoutTimeBlocks = exports.WithCustomClassName = exports.WithSelectedRange = exports.Default = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const timeline_1 = require("../components/timeline");
9
9
  const styled_components_1 = __importDefault(require("styled-components"));
@@ -41,12 +41,20 @@ exports.WithCustomClassName.args = {
41
41
  duration: 305,
42
42
  value: 31,
43
43
  zoomLevel: 0,
44
- className: 'this-class-redefines-values',
44
+ className: 'this-class-redefines-styles',
45
45
  };
46
- exports.WithOutTimeBlocks = Template.bind({});
47
- exports.WithOutTimeBlocks.args = {
46
+ exports.WithoutTimeBlocks = Template.bind({});
47
+ exports.WithoutTimeBlocks.args = {
48
48
  duration: 305,
49
49
  value: 31,
50
50
  zoomLevel: 0,
51
51
  withTimeBlocks: false,
52
52
  };
53
+ exports.Minimalist = Template.bind({});
54
+ exports.Minimalist.args = {
55
+ duration: 305,
56
+ value: 31,
57
+ zoomLevel: 0,
58
+ withTimeBlocks: false,
59
+ className: 'minimalist',
60
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldelia/react-media",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "A React components collection for media-related features.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -3,8 +3,25 @@ import TickTimeCollectionDisplay from './TickTimeCollectionDisplay';
3
3
  import VaLueLineCanvas from './VaLueLineCanvas';
4
4
  import RangeSelectorCanvas from './RangeSelectorCanvas';
5
5
  import { zoomLevelConfigurations } from './constants';
6
+ import styled from 'styled-components';
6
7
 
7
- import './Timeline.css';
8
+ const TimelineContainer = styled.div`
9
+ background-color: #f0f0f0;
10
+ border: 1px solid #c9c9c9;
11
+ height: 80px;
12
+ width: 100%;
13
+ max-width: 100%;
14
+ overflow-x: auto;
15
+ position: relative;
16
+ display: flex;
17
+ `;
18
+ const TimelineWrapper = styled.div`
19
+ position: absolute;
20
+ height: 100%;
21
+ display: flex;
22
+ flex-direction: row;
23
+ align-items: center;
24
+ `;
8
25
 
9
26
  export interface TimelineProps {
10
27
  duration: number; // duration in seconds
@@ -88,12 +105,8 @@ export const Timeline: React.FC<TimelineProps> = ({
88
105
  }, [value, zoomParams]);
89
106
 
90
107
  return (
91
- <div
92
- ref={timeLineContainerRef}
93
- className={`timeline-container ${className}`}
94
- >
95
- <div
96
- className={'timeline-wrapper'}
108
+ <TimelineContainer ref={timeLineContainerRef} className={className}>
109
+ <TimelineWrapper
97
110
  style={{ width: duration * zoomParams.pixelsInSecond + 'px' }}
98
111
  >
99
112
  <ZoomContext.Provider value={zoomParams}>
@@ -110,7 +123,7 @@ export const Timeline: React.FC<TimelineProps> = ({
110
123
  <TickTimeCollectionDisplay tickTimes={blockStartingTimes} />
111
124
  )}
112
125
  </ZoomContext.Provider>
113
- </div>
114
- </div>
126
+ </TimelineWrapper>
127
+ </TimelineContainer>
115
128
  );
116
129
  };
@@ -1,9 +1,12 @@
1
- import React from 'react';
1
+ import React, { useCallback, useContext, useEffect, useRef } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import { ZoomContext, ZoomContextType } from './index';
5
- import { useCallback, useContext, useEffect, useRef } from 'react';
6
- import { secondsToPixel } from './utils/utils';
5
+ import {
6
+ getComputedElementWidth,
7
+ numberToPxString,
8
+ secondsToPixel,
9
+ } from './utils/utils';
7
10
 
8
11
  export interface VaLueLineCanvasProps {
9
12
  blockStartingTimes: number[];
@@ -18,6 +21,13 @@ const OverlayCanvas = styled.canvas`
18
21
  height: 100%;
19
22
  color: #c9c9c9;
20
23
  `;
24
+
25
+ const PreValueLine = styled.span`
26
+ position: absolute;
27
+ left: 0;
28
+ height: 100%;
29
+ `;
30
+
21
31
  const ValueLine = styled.span`
22
32
  position: absolute;
23
33
  width: 1px;
@@ -25,12 +35,21 @@ const ValueLine = styled.span`
25
35
  background-color: #575757;
26
36
  `;
27
37
 
38
+ const PostValueLine = styled.span`
39
+ position: absolute;
40
+ height: 100%;
41
+ `;
42
+
28
43
  const VaLueLineCanvas: React.FC<VaLueLineCanvasProps> = ({
29
44
  blockStartingTimes = [],
30
45
  value,
31
46
  }) => {
32
47
  const canvasRef = useRef(null);
48
+
49
+ const preValueLineRef = useRef(null);
33
50
  const valueLineRef = useRef(null);
51
+ const postValueLineRef = useRef(null);
52
+
34
53
  const zoomContextValue: ZoomContextType = useContext(ZoomContext);
35
54
 
36
55
  const showBlocks = useCallback(
@@ -61,17 +80,33 @@ const VaLueLineCanvas: React.FC<VaLueLineCanvasProps> = ({
61
80
  );
62
81
 
63
82
  const showValueLine = useCallback(() => {
64
- const linePosition: number = secondsToPixel(zoomContextValue, value);
83
+ const canvas: HTMLCanvasElement = canvasRef.current!;
65
84
 
85
+ const preValueLineElement: HTMLElement = preValueLineRef.current!;
66
86
  const valueLineElement: HTMLElement = valueLineRef.current!;
67
- const elementWidthCSSProperty: string = window
68
- .getComputedStyle(valueLineElement)
69
- .getPropertyValue('width')
70
- .replace(/[^-\d]/g, '');
71
- const elementWidth: number = parseInt(elementWidthCSSProperty);
72
- const linePositionAtValueLineMiddle: number =
73
- linePosition - elementWidth / 2;
74
- valueLineElement.style.left = linePositionAtValueLineMiddle + 'px';
87
+ const postValueLineElement: HTMLElement = postValueLineRef.current!;
88
+
89
+ const valueLineWidth: number = getComputedElementWidth(valueLineElement);
90
+ const linePosition: number = secondsToPixel(zoomContextValue, value);
91
+ const valueLinePositionBeginningConsideringWidth: number =
92
+ linePosition - valueLineWidth / 2;
93
+
94
+ // configure preValueLineElement
95
+ preValueLineElement.style.width = numberToPxString(
96
+ valueLinePositionBeginningConsideringWidth,
97
+ );
98
+
99
+ // configure valueLineElement
100
+ valueLineElement.style.left = numberToPxString(
101
+ valueLinePositionBeginningConsideringWidth,
102
+ );
103
+
104
+ // configure postValueLineElement
105
+ const postValueLinePosition =
106
+ valueLinePositionBeginningConsideringWidth + valueLineWidth;
107
+ const postValueLineWidth = canvas.width - postValueLinePosition;
108
+ postValueLineElement.style.left = numberToPxString(postValueLinePosition);
109
+ postValueLineElement.style.width = numberToPxString(postValueLineWidth);
75
110
  }, [value, zoomContextValue]);
76
111
 
77
112
  useEffect(() => {
@@ -91,10 +126,16 @@ const VaLueLineCanvas: React.FC<VaLueLineCanvasProps> = ({
91
126
  ref={canvasRef}
92
127
  className={'media-timeline-value-line-canvas'}
93
128
  />
94
- <ValueLine
95
- ref={valueLineRef}
96
- className={'media-timeline-value-line'}
97
- ></ValueLine>
129
+
130
+ <PreValueLine
131
+ ref={preValueLineRef}
132
+ className={'media-timeline-pre-value-line'}
133
+ />
134
+ <ValueLine ref={valueLineRef} className={'media-timeline-value-line'} />
135
+ <PostValueLine
136
+ ref={postValueLineRef}
137
+ className={'media-timeline-post-value-line'}
138
+ />
98
139
  </>
99
140
  );
100
141
  };
@@ -14,3 +14,15 @@ export const pixelToSeconds = (
14
14
  const seconds = pixel / zoomContextValue.pixelsInSecond;
15
15
  return Math.round((seconds + Number.EPSILON) * 100) / 100;
16
16
  };
17
+
18
+ export const getComputedElementWidth = (element: HTMLElement): number => {
19
+ const elementWidthCSSProperty: string = window
20
+ .getComputedStyle(element)
21
+ .getPropertyValue('width')
22
+ .replace(/[^-\d]/g, '');
23
+ return parseInt(elementWidthCSSProperty);
24
+ };
25
+
26
+ export const numberToPxString = (number: number): string => {
27
+ return `${number}px`;
28
+ };
@@ -1,3 +1,29 @@
1
- #storybook-root .this-class-redefines-values {
1
+ #storybook-root .this-class-redefines-styles {
2
2
  background-color: transparent;
3
3
  }
4
+
5
+ #storybook-root .minimalist {
6
+ background-color: transparent;
7
+ border: 0;
8
+ }
9
+
10
+ #storybook-root .minimalist > canvas {
11
+ color: transparent;
12
+ }
13
+
14
+ #storybook-root .minimalist > div > .media-timeline-pre-value-line {
15
+ height: 4px;
16
+ background-color: greenyellow;
17
+ }
18
+
19
+ #storybook-root .minimalist > div > .media-timeline-value-line {
20
+ height: 10px;
21
+ width: 10px;
22
+ background-color: greenyellow;
23
+ border-radius: 10px;
24
+ }
25
+
26
+ #storybook-root .minimalist > div > .media-timeline-post-value-line {
27
+ height: 4px;
28
+ background-color: rgba(10, 10, 10, 0.24);
29
+ }
@@ -45,13 +45,22 @@ WithCustomClassName.args = {
45
45
  duration: 305,
46
46
  value: 31,
47
47
  zoomLevel: 0,
48
- className: 'this-class-redefines-values',
48
+ className: 'this-class-redefines-styles',
49
49
  };
50
50
 
51
- export const WithOutTimeBlocks = Template.bind({});
52
- WithOutTimeBlocks.args = {
51
+ export const WithoutTimeBlocks = Template.bind({});
52
+ WithoutTimeBlocks.args = {
53
53
  duration: 305,
54
54
  value: 31,
55
55
  zoomLevel: 0,
56
56
  withTimeBlocks: false,
57
57
  };
58
+
59
+ export const Minimalist = Template.bind({});
60
+ Minimalist.args = {
61
+ duration: 305,
62
+ value: 31,
63
+ zoomLevel: 0,
64
+ withTimeBlocks: false,
65
+ className: 'minimalist',
66
+ };
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import './button.css';
3
- interface ButtonProps {
4
- /**
5
- * Is this the principal call to action on the page?
6
- */
7
- primary?: boolean;
8
- /**
9
- * What background color to use
10
- */
11
- backgroundColor?: string;
12
- /**
13
- * How large should the button be?
14
- */
15
- size?: 'small' | 'medium' | 'large';
16
- /**
17
- * Button contents
18
- */
19
- label: string;
20
- /**
21
- * Optional click handler
22
- */
23
- onClick?: () => void;
24
- }
25
- /**
26
- * Primary UI component for user interaction
27
- */
28
- export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => React.JSX.Element;
29
- export {};
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Button = void 0;
18
- const react_1 = __importDefault(require("react"));
19
- require("./button.css");
20
- /**
21
- * Primary UI component for user interaction
22
- */
23
- const Button = (_a) => {
24
- var { primary = false, size = 'medium', backgroundColor, label } = _a, props = __rest(_a, ["primary", "size", "backgroundColor", "label"]);
25
- const mode = primary
26
- ? 'storybook-button--primary'
27
- : 'storybook-button--secondary';
28
- return (react_1.default.createElement("button", Object.assign({ type: "button", className: ['storybook-button', `storybook-button--${size}`, mode].join(' '), style: { backgroundColor } }, props), label));
29
- };
30
- exports.Button = Button;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Small = exports.Large = exports.Secondary = exports.Primary = void 0;
4
- const test_1 = require("@storybook/test");
5
- const Button_1 = require("./Button");
6
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
7
- const meta = {
8
- title: 'Example/Button',
9
- component: Button_1.Button,
10
- parameters: {
11
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
12
- layout: 'centered',
13
- },
14
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
15
- tags: ['autodocs'],
16
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
17
- argTypes: {
18
- backgroundColor: { control: 'color' },
19
- },
20
- // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
21
- args: { onClick: (0, test_1.fn)() },
22
- };
23
- exports.default = meta;
24
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
25
- exports.Primary = {
26
- args: {
27
- primary: true,
28
- label: 'Button',
29
- },
30
- };
31
- exports.Secondary = {
32
- args: {
33
- label: 'Button',
34
- },
35
- };
36
- exports.Large = {
37
- args: {
38
- size: 'large',
39
- label: 'Button',
40
- },
41
- };
42
- exports.Small = {
43
- args: {
44
- size: 'small',
45
- label: 'Button',
46
- },
47
- };
@@ -1,15 +0,0 @@
1
- .timeline-container {
2
- background-color: #f0f0f0;
3
- border: 1px solid #c9c9c9;
4
- height: 80px;
5
- width: 100%;
6
- max-width: 100%;
7
- overflow-x: auto;
8
- position: relative;
9
- display: flex;
10
- }
11
-
12
- .timeline-wrapper {
13
- position: absolute;
14
- height: 100%;
15
- }