Skip to content

Commit 222e367

Browse files
authored
add gh-pages, storybook ci/cd (#1)
* [feature/gh-pages] modify storybook cli * [feature/gh-pages] modify target branch * [feature/gh-pages] modify storybook config * [feature/gh-pages] modify cli * [feature/gh-pages] modify github-actions env * [feature/gh-pages] modify storybook config path * [feature/gh-pages] remove example ignore * [feature/gh-pages] modify path * [feature/gh-pages] modify gitignored * [feature/gh-pages] update readme * [feature/gh-pages] fix github-action target branch
1 parent b043ae6 commit 222e367

File tree

10 files changed

+112
-7
lines changed

10 files changed

+112
-7
lines changed

.github/workflows/deploy-storybook.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
87
jobs:
98
build:
109

@@ -23,14 +22,14 @@ jobs:
2322
node-version: ${{ matrix.node-version }}
2423

2524
- name: npm install packages
26-
run: npm i
25+
run: npm install
2726

2827
- name: build storybook
2928
run: npm run build:storybook
3029

3130
- name: deploy storybook
3231
uses: peaceiris/[email protected]
3332
env:
34-
PERSONAL_TOKEN: ${{ secrets.ACTIONS_DEPLOY_KEY }}
33+
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
3534
PUBLISH_BRANCH: gh-pages
3635
PUBLISH_DIR: ./storybook-static

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.vscode
33
# .git*
44

5-
example
65
node_modules
76
dist
87
storybook-static

.storybook/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ import { withInfo } from '@storybook/addon-info';
44

55
addDecorator(withInfo);
66
addParameters({ info: { inline: true } });
7-
configure(require.context('../example', true, /\.story\.tsx$/), module);
7+
configure(require.context('../', true, /\.story\.tsx$/), module);

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[download-image]: http://img.shields.io/npm/dm/react-sequence-player.svg?style=flat
1111
[download-url]: http://www.npmjs.com/package/react-sequence-player
1212

13+
- <a href="https://kimcoder.github.io/react-sequence-player/?path=/story/sequenceplayer--default">Live Demo</a>
1314
- Image Sequence Player for ReactJS.
1415
- Selectable Navgation Styles.
1516
- <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Images/Implementing_image_sprites_in_CSS" target="_blank">What is Image Sprite?</a><br><br>

example/default.story.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as React from 'react';
2+
import { storiesOf } from '@storybook/react';
3+
import SequencePlayer from '../src/SequencePlayer';
4+
import SampleImage from './sample.png';
5+
6+
storiesOf('SequencePlayer', module)
7+
.add('default', () => {
8+
const playerRef = React.useRef<any>(null);
9+
10+
const handleControl = (action: string) => () => {
11+
switch (action) {
12+
case 'play': playerRef.current.play(); break;
13+
case 'pause': playerRef.current.pause(); break;
14+
case 'resume': playerRef.current.resume(); break;
15+
case 'reverse': playerRef.current.reverse(); break;
16+
}
17+
};
18+
19+
return (
20+
<div>
21+
<button onClick={handleControl('play')}>PLAY</button>
22+
<button onClick={handleControl('pause')}>PAUSE</button>
23+
<button onClick={handleControl('resume')}>RESUME</button>
24+
<button onClick={handleControl('reverse')}>REVERSE PLAY</button>
25+
<br/><br/>
26+
<SequencePlayer
27+
image={SampleImage}
28+
data={[
29+
{ x: 0, y: 0 },
30+
{ x: -183, y: 0 },
31+
{ x: -366, y: 0 },
32+
{ x: -545, y: 0 },
33+
{ x: -732, y: 0 },
34+
{ x: 0, y: -172 },
35+
{ x: -183, y: -172 },
36+
{ x: -366, y: -172 },
37+
{ x: -549, y: -172 },
38+
{ x: -732, y: -172 },
39+
{ x: 0, y: -338 },
40+
{ x: -183, y: -339 },
41+
{ x: -363, y: -338 },
42+
{ x: -549, y: -338 }
43+
]}
44+
playerSize={{ width: 183, height: 168 }}
45+
imageSize={{ width: 918, height: 506 }}
46+
ref={playerRef}
47+
logging={true}
48+
/>
49+
</div>
50+
);
51+
});

example/delay.story.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as React from 'react';
2+
import { storiesOf } from '@storybook/react';
3+
import SequencePlayer from '../src/SequencePlayer';
4+
import SampleImage from './sample.png';
5+
6+
storiesOf('SequencePlayer', module)
7+
.add('custom delay, 300', () => {
8+
const playerRef = React.useRef<any>(null);
9+
10+
const handleControl = (action: string) => () => {
11+
switch (action) {
12+
case 'play': playerRef.current.play(); break;
13+
case 'pause': playerRef.current.pause(); break;
14+
case 'resume': playerRef.current.resume(); break;
15+
case 'reverse': playerRef.current.reverse(); break;
16+
}
17+
};
18+
19+
return (
20+
<div>
21+
<button onClick={handleControl('play')}>PLAY</button>
22+
<button onClick={handleControl('pause')}>PAUSE</button>
23+
<button onClick={handleControl('resume')}>RESUME</button>
24+
<button onClick={handleControl('reverse')}>REVERSE PLAY</button>
25+
<br/><br/>
26+
<SequencePlayer
27+
image={SampleImage}
28+
data={[
29+
{ x: 0, y: 0 },
30+
{ x: -183, y: 0 },
31+
{ x: -366, y: 0 },
32+
{ x: -545, y: 0 },
33+
{ x: -732, y: 0 },
34+
{ x: 0, y: -172 },
35+
{ x: -183, y: -172 },
36+
{ x: -366, y: -172 },
37+
{ x: -549, y: -172 },
38+
{ x: -732, y: -172 },
39+
{ x: 0, y: -338 },
40+
{ x: -183, y: -339 },
41+
{ x: -363, y: -338 },
42+
{ x: -549, y: -338 }
43+
]}
44+
playerSize={{ width: 183, height: 168 }}
45+
imageSize={{ width: 918, height: 506 }}
46+
ref={playerRef}
47+
delay={200}
48+
/>
49+
</div>
50+
);
51+
});

example/global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.png' {
2+
const value: string;
3+
export = value;
4+
}

example/sample.png

44.4 KB
Loading

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"dev": "start-storybook -p 6006",
99
"build": "rm -rf dist && rollup -c",
1010
"build:watch": "rollup -c --watch",
11-
"build:storybook": "build-storybook"
11+
"build:storybook": "build-storybook --quiet"
1212
},
1313
"keywords": [
1414
"reactjs",

0 commit comments

Comments
 (0)