@ldelia/react-media 0.2.4 → 0.2.6
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/dist/components/timeline/Timeline.d.ts +17 -0
- package/dist/components/timeline/Timeline.js +99 -0
- package/dist/components/timeline/index.d.ts +1 -16
- package/dist/components/timeline/index.js +14 -74
- package/dist/stories/timeline.stories.d.ts +7 -3
- package/dist/stories/timeline.stories.js +16 -1
- package/package.json +1 -1
- package/src/components/timeline/Timeline.tsx +19 -9
- package/dist/stories/Button.d.ts +0 -29
- package/dist/stories/Button.js +0 -30
- package/dist/stories/Button.stories.js +0 -47
- package/src/components/timeline/Timeline.css +0 -15
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TimelineProps {
|
|
3
|
+
duration: number;
|
|
4
|
+
value: number;
|
|
5
|
+
zoomLevel?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
selectedRange?: number[];
|
|
8
|
+
withTimeBlocks?: boolean;
|
|
9
|
+
onChange?: (value: number) => void;
|
|
10
|
+
onRangeChange?: (value: number[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export type ZoomContextType = {
|
|
13
|
+
blockOffset: number;
|
|
14
|
+
pixelsInSecond: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const ZoomContext: React.Context<ZoomContextType>;
|
|
17
|
+
export declare const Timeline: React.FC<TimelineProps>;
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Timeline = exports.ZoomContext = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const TickTimeCollectionDisplay_1 = __importDefault(require("./TickTimeCollectionDisplay"));
|
|
32
|
+
const VaLueLineCanvas_1 = __importDefault(require("./VaLueLineCanvas"));
|
|
33
|
+
const RangeSelectorCanvas_1 = __importDefault(require("./RangeSelectorCanvas"));
|
|
34
|
+
const constants_1 = require("./constants");
|
|
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
|
+
`;
|
|
50
|
+
exports.ZoomContext = react_1.default.createContext({
|
|
51
|
+
blockOffset: 0,
|
|
52
|
+
pixelsInSecond: 0,
|
|
53
|
+
});
|
|
54
|
+
const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], withTimeBlocks = true, onChange = () => { }, onRangeChange = () => { }, className = '', }) => {
|
|
55
|
+
const timeLineContainerRef = (0, react_1.useRef)(null);
|
|
56
|
+
let zoomLevelValue = zoomLevel ? zoomLevel : 0;
|
|
57
|
+
if (zoomLevelValue < 0 || zoomLevelValue >= constants_1.zoomLevelConfigurations.length) {
|
|
58
|
+
console.warn('Invalid value for property zoomLevel.');
|
|
59
|
+
zoomLevelValue = 0;
|
|
60
|
+
}
|
|
61
|
+
if (value < 0 || value > duration) {
|
|
62
|
+
console.warn('Invalid value.');
|
|
63
|
+
}
|
|
64
|
+
if (!(selectedRange.length === 0 || selectedRange.length === 2)) {
|
|
65
|
+
selectedRange = [];
|
|
66
|
+
console.warn('The selected range must contain only two values.');
|
|
67
|
+
}
|
|
68
|
+
if (selectedRange.length === 2 &&
|
|
69
|
+
!(0 <= selectedRange[0] &&
|
|
70
|
+
selectedRange[0] < selectedRange[1] &&
|
|
71
|
+
selectedRange[1] <= duration)) {
|
|
72
|
+
selectedRange = [];
|
|
73
|
+
console.warn('The selected range is inconsistent.');
|
|
74
|
+
}
|
|
75
|
+
const zoomParams = (0, react_1.useMemo)(() => {
|
|
76
|
+
return {
|
|
77
|
+
blockOffset: constants_1.zoomLevelConfigurations[zoomLevelValue][0],
|
|
78
|
+
pixelsInSecond: constants_1.zoomLevelConfigurations[zoomLevelValue][1],
|
|
79
|
+
};
|
|
80
|
+
}, [zoomLevelValue]);
|
|
81
|
+
let blockStartingTimes = [0];
|
|
82
|
+
const blockCounts = Math.ceil(duration / zoomParams.blockOffset);
|
|
83
|
+
for (let i = 1; i < blockCounts; i++) {
|
|
84
|
+
blockStartingTimes.push(blockStartingTimes[blockStartingTimes.length - 1] +
|
|
85
|
+
zoomParams.blockOffset);
|
|
86
|
+
}
|
|
87
|
+
(0, react_1.useEffect)(() => {
|
|
88
|
+
const timeLineWrapper = timeLineContainerRef.current;
|
|
89
|
+
const scrollPosition = value * zoomParams.pixelsInSecond - 300;
|
|
90
|
+
timeLineWrapper.scrollLeft = Math.max(0, scrollPosition);
|
|
91
|
+
}, [value, zoomParams]);
|
|
92
|
+
return (react_1.default.createElement(TimelineContainer, { ref: timeLineContainerRef, className: className },
|
|
93
|
+
react_1.default.createElement(TimelineWrapper, { style: { width: duration * zoomParams.pixelsInSecond + 'px' } },
|
|
94
|
+
react_1.default.createElement(exports.ZoomContext.Provider, { value: zoomParams },
|
|
95
|
+
react_1.default.createElement(VaLueLineCanvas_1.default, { blockStartingTimes: withTimeBlocks ? blockStartingTimes : [], value: value }),
|
|
96
|
+
react_1.default.createElement(RangeSelectorCanvas_1.default, { selectedRange: selectedRange, onChange: onChange, onRangeChange: onRangeChange }),
|
|
97
|
+
withTimeBlocks && (react_1.default.createElement(TickTimeCollectionDisplay_1.default, { tickTimes: blockStartingTimes }))))));
|
|
98
|
+
};
|
|
99
|
+
exports.Timeline = Timeline;
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface TimelineProps {
|
|
3
|
-
duration: number;
|
|
4
|
-
value: number;
|
|
5
|
-
zoomLevel?: number;
|
|
6
|
-
className?: string;
|
|
7
|
-
selectedRange?: number[];
|
|
8
|
-
onChange?: (value: number) => void;
|
|
9
|
-
onRangeChange?: (value: number[]) => void;
|
|
10
|
-
}
|
|
11
|
-
export type ZoomContextType = {
|
|
12
|
-
blockOffset: number;
|
|
13
|
-
pixelsInSecond: number;
|
|
14
|
-
};
|
|
15
|
-
export declare const ZoomContext: React.Context<ZoomContextType>;
|
|
16
|
-
export declare const Timeline: React.FC<TimelineProps>;
|
|
1
|
+
export * from './Timeline';
|
|
@@ -1,77 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const react_2 = require("react");
|
|
10
|
-
const TickTimeCollectionDisplay_1 = __importDefault(require("./TickTimeCollectionDisplay"));
|
|
11
|
-
const VaLueLineCanvas_1 = __importDefault(require("./VaLueLineCanvas"));
|
|
12
|
-
const RangeSelectorCanvas_1 = __importDefault(require("./RangeSelectorCanvas"));
|
|
13
|
-
const constants_1 = require("./constants");
|
|
14
|
-
const TimelineContainer = styled_components_1.default.div `
|
|
15
|
-
background-color: #f0f0f0;
|
|
16
|
-
border: 1px solid #c9c9c9;
|
|
17
|
-
height: 80px;
|
|
18
|
-
width: 100%;
|
|
19
|
-
max-width: 100%;
|
|
20
|
-
overflow-x: auto;
|
|
21
|
-
position: relative;
|
|
22
|
-
display: flex;
|
|
23
|
-
`;
|
|
24
|
-
const TimelineWrapper = styled_components_1.default.div `
|
|
25
|
-
position: absolute;
|
|
26
|
-
height: 100%;
|
|
27
|
-
`;
|
|
28
|
-
exports.ZoomContext = react_1.default.createContext({
|
|
29
|
-
blockOffset: 0,
|
|
30
|
-
pixelsInSecond: 0,
|
|
31
|
-
});
|
|
32
|
-
const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], onChange = () => { }, onRangeChange = () => { }, className = '', }) => {
|
|
33
|
-
const timeLineContainerRef = (0, react_2.useRef)(null);
|
|
34
|
-
let zoomLevelValue = zoomLevel ? zoomLevel : 0;
|
|
35
|
-
if (zoomLevelValue < 0 || zoomLevelValue >= constants_1.zoomLevelConfigurations.length) {
|
|
36
|
-
console.warn('Invalid value for property zoomLevel.');
|
|
37
|
-
zoomLevelValue = 0;
|
|
38
|
-
}
|
|
39
|
-
if (value < 0 || value > duration) {
|
|
40
|
-
console.warn('Invalid value.');
|
|
41
|
-
}
|
|
42
|
-
if (!(selectedRange.length === 0 || selectedRange.length === 2)) {
|
|
43
|
-
selectedRange = [];
|
|
44
|
-
console.warn('The selected range must contain only two values.');
|
|
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]; } };
|
|
45
7
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const zoomParams = (0, react_2.useMemo)(() => {
|
|
54
|
-
return {
|
|
55
|
-
blockOffset: constants_1.zoomLevelConfigurations[zoomLevelValue][0],
|
|
56
|
-
pixelsInSecond: constants_1.zoomLevelConfigurations[zoomLevelValue][1],
|
|
57
|
-
};
|
|
58
|
-
}, [zoomLevelValue]);
|
|
59
|
-
let blockStartingTimes = [0];
|
|
60
|
-
const blockCounts = Math.ceil(duration / zoomParams.blockOffset);
|
|
61
|
-
for (let i = 1; i < blockCounts; i++) {
|
|
62
|
-
blockStartingTimes.push(blockStartingTimes[blockStartingTimes.length - 1] +
|
|
63
|
-
zoomParams.blockOffset);
|
|
64
|
-
}
|
|
65
|
-
(0, react_2.useEffect)(() => {
|
|
66
|
-
const timeLineWrapper = timeLineContainerRef.current;
|
|
67
|
-
const scrollPosition = value * zoomParams.pixelsInSecond - 300;
|
|
68
|
-
timeLineWrapper.scrollLeft = Math.max(0, scrollPosition);
|
|
69
|
-
}, [value, zoomParams]);
|
|
70
|
-
return (react_1.default.createElement(TimelineContainer, { ref: timeLineContainerRef, className: className },
|
|
71
|
-
react_1.default.createElement(TimelineWrapper, { style: { width: duration * zoomParams.pixelsInSecond + 'px' } },
|
|
72
|
-
react_1.default.createElement(exports.ZoomContext.Provider, { value: zoomParams },
|
|
73
|
-
react_1.default.createElement(VaLueLineCanvas_1.default, { blockStartingTimes: blockStartingTimes, value: value }),
|
|
74
|
-
react_1.default.createElement(RangeSelectorCanvas_1.default, { selectedRange: selectedRange, onChange: onChange, onRangeChange: onRangeChange }),
|
|
75
|
-
react_1.default.createElement(TickTimeCollectionDisplay_1.default, { tickTimes: blockStartingTimes })))));
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
76
15
|
};
|
|
77
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Timeline"), exports);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { TimelineProps } from '../components/timeline';
|
|
2
|
-
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
import './timeline.stories.custom.css';
|
|
4
|
+
declare const _default: Meta;
|
|
3
5
|
export default _default;
|
|
4
|
-
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react
|
|
5
|
-
export declare const WithSelectedRange: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react
|
|
6
|
+
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
|
|
7
|
+
export declare const WithSelectedRange: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
|
|
8
|
+
export declare const WithCustomClassName: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
|
|
9
|
+
export declare const WithOutTimeBlocks: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
|
|
@@ -3,10 +3,11 @@ 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.WithSelectedRange = exports.Default = void 0;
|
|
6
|
+
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"));
|
|
10
|
+
require("./timeline.stories.custom.css");
|
|
10
11
|
const StyledTimeline = (0, styled_components_1.default)(timeline_1.Timeline) `
|
|
11
12
|
.media-timeline-value-line {
|
|
12
13
|
background-color: red;
|
|
@@ -35,3 +36,17 @@ exports.WithSelectedRange.args = {
|
|
|
35
36
|
zoomLevel: 0,
|
|
36
37
|
selectedRange: [20, 30],
|
|
37
38
|
};
|
|
39
|
+
exports.WithCustomClassName = Template.bind({});
|
|
40
|
+
exports.WithCustomClassName.args = {
|
|
41
|
+
duration: 305,
|
|
42
|
+
value: 31,
|
|
43
|
+
zoomLevel: 0,
|
|
44
|
+
className: 'this-class-redefines-values',
|
|
45
|
+
};
|
|
46
|
+
exports.WithOutTimeBlocks = Template.bind({});
|
|
47
|
+
exports.WithOutTimeBlocks.args = {
|
|
48
|
+
duration: 305,
|
|
49
|
+
value: 31,
|
|
50
|
+
zoomLevel: 0,
|
|
51
|
+
withTimeBlocks: false,
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -3,8 +3,22 @@ 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
|
-
|
|
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
|
+
`;
|
|
8
22
|
|
|
9
23
|
export interface TimelineProps {
|
|
10
24
|
duration: number; // duration in seconds
|
|
@@ -88,12 +102,8 @@ export const Timeline: React.FC<TimelineProps> = ({
|
|
|
88
102
|
}, [value, zoomParams]);
|
|
89
103
|
|
|
90
104
|
return (
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
className={`timeline-container ${className}`}
|
|
94
|
-
>
|
|
95
|
-
<div
|
|
96
|
-
className={'timeline-wrapper'}
|
|
105
|
+
<TimelineContainer ref={timeLineContainerRef} className={className}>
|
|
106
|
+
<TimelineWrapper
|
|
97
107
|
style={{ width: duration * zoomParams.pixelsInSecond + 'px' }}
|
|
98
108
|
>
|
|
99
109
|
<ZoomContext.Provider value={zoomParams}>
|
|
@@ -110,7 +120,7 @@ export const Timeline: React.FC<TimelineProps> = ({
|
|
|
110
120
|
<TickTimeCollectionDisplay tickTimes={blockStartingTimes} />
|
|
111
121
|
)}
|
|
112
122
|
</ZoomContext.Provider>
|
|
113
|
-
</
|
|
114
|
-
</
|
|
123
|
+
</TimelineWrapper>
|
|
124
|
+
</TimelineContainer>
|
|
115
125
|
);
|
|
116
126
|
};
|
package/dist/stories/Button.d.ts
DELETED
|
@@ -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 {};
|
package/dist/stories/Button.js
DELETED
|
@@ -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
|
-
}
|