Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 73b8571

Browse files
authored
Merge pull request #3 from react-native-toolkit/changed-image-ui
Updated Docs & setup review workflow
2 parents 25c291f + b18dca1 commit 73b8571

File tree

3 files changed

+66
-13
lines changed

3 files changed

+66
-13
lines changed

.github/workflows/review.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: review
2+
on: pull_request
3+
4+
jobs:
5+
test:
6+
strategy:
7+
matrix:
8+
platform: [ubuntu-latest, macOS-latest]
9+
node: ['12.x']
10+
name: test/node ${{ matrix.node }}/${{ matrix.platform }}
11+
runs-on: ${{ matrix.platform }}
12+
steps:
13+
- uses: actions/checkout@master
14+
- uses: actions/setup-node@master
15+
with:
16+
node-version: ${{ matrix.node }}
17+
- run: npx yarn bootstrap
18+
- run: npx yarn test
19+
20+
coverage:
21+
needs: [test]
22+
name: coverage
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@master
26+
- uses: actions/setup-node@master
27+
with:
28+
node-version: 12.x
29+
- run: npx yarn bootstrap
30+
- run: npx yarn test --coverage
31+
- uses: romeovs/lcov-reporter-action@v0.2.16
32+
with:
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
chromatic:
36+
needs: [test]
37+
name: Publish storybook to chromatic 🧪
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v2
41+
- uses: actions/setup-node@v1
42+
with:
43+
node-version: 12.x
44+
- run: npx yarn bootstrap
45+
- run: npx yarn chromatic
46+
working-directory: example
47+
env:
48+
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# logs
22
*.log
33

4+
# coverage
5+
coverage
6+
47
# OSX
58
#
69
.DS_Store

example/src/stories/BetterImage.stories.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,65 +9,67 @@ export default {
99

1010
const Template = (args) => <BetterImage {...args} />;
1111

12+
const imageStyle = { height: 200, width: 400 };
13+
1214
const validSource = () => ({
1315
source: {
14-
uri: `https://pyt-images.imgix.net/images/app/pretrip/australia.png?h=346.5&w=252&crop=fit&dpr=3&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
16+
uri: `https://unsplash.com/photos/yNvVnPcurD8/download?force=true&w=2400&bust=${Math.random()}`,
1517
},
1618
thumbnailSource: {
17-
uri: `https://pyt-images.imgix.net/images/app/pretrip/australia.png?h=346.5&w=252&crop=fit&dpr=0.1&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
19+
uri: `https://unsplash.com/photos/yNvVnPcurD8/download?force=true&w=24&bust=${Math.random()}`,
1820
},
1921
fallbackSource: {
20-
uri: `https://pyt-images.imgix.net/images/place-holder.png?bust=${Math.random()}`,
22+
uri: `https://unsplash.com/a/img/empty-states/photos.png?bust=${Math.random()}`,
2123
},
2224
});
2325
export const ValidImage = Template.bind({});
2426
ValidImage.args = {
2527
...validSource(),
26-
viewStyle: { height: 400, width: 400 },
28+
viewStyle: imageStyle,
2729
resizeMode: 'contain',
2830
};
2931

3032
const inValidSource = () => ({
3133
source: {
32-
uri: `https://pyt-images.imgix.net/images/app/pretrip/nowheretobefound.png?h=346.5&w=252&crop=fit&dpr=0.3&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
34+
uri: `https://unsplash.com/photos/2347729843y7/download?force=true&w=2400&bust=${Math.random()}`,
3335
},
3436
thumbnailSource: {
35-
uri: `https://pyt-images.imgix.net/images/app/pretrip/nowheretobefound.png?h=346.5&w=252&crop=fit&dpr=0.1&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
37+
uri: `https://unsplash.com/photos/2347729843y7/download?force=true&w=24&bust=${Math.random()}`,
3638
},
3739
fallbackSource: {
38-
uri: `https://pyt-images.imgix.net/images/place-holder.png?bust=${Math.random()}`,
40+
uri: `https://unsplash.com/a/img/empty-states/photos.png?bust=${Math.random()}`,
3941
},
4042
});
4143

4244
export const InvalidImage = Template.bind({});
4345
InvalidImage.args = {
4446
...inValidSource(),
45-
viewStyle: { height: 400, width: 400 },
47+
viewStyle: imageStyle,
4648
resizeMode: 'contain',
4749
};
4850

4951
const invalidImageOnlySource = () => ({
5052
source: {
51-
uri: `https://pyt-images.imgix.net/images/app/pretrip/nowheretobefound.png?h=346.5&w=252&crop=fit&dpr=0.3&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
53+
uri: `https://unsplash.com/photos/2347729843y7/download?force=true&w=2400&bust=${Math.random()}`,
5254
},
5355
thumbnailSource: {
54-
uri: `https://pyt-images.imgix.net/images/app/pretrip/australia.png?h=346.5&w=252&crop=fit&dpr=0.1&auto=format,compress,enhance&q=10&bust=${Math.random()}`,
56+
uri: `https://unsplash.com/photos/yNvVnPcurD8/download?force=true&w=24&bust=${Math.random()}`,
5557
},
5658
fallbackSource: {
57-
uri: `https://pyt-images.imgix.net/images/place-holder.png?bust=${Math.random()}`,
59+
uri: `https://unsplash.com/a/img/empty-states/photos.png?bust=${Math.random()}`,
5860
},
5961
});
6062
export const InvalidImageButWithValidThumbnail = Template.bind({});
6163
InvalidImageButWithValidThumbnail.args = {
6264
...invalidImageOnlySource(),
63-
viewStyle: { height: 400, width: 400 },
65+
viewStyle: imageStyle,
6466
resizeMode: 'contain',
6567
};
6668

6769
export const CustomImageFadeDuration = Template.bind({});
6870
CustomImageFadeDuration.args = {
6971
...validSource(),
70-
viewStyle: { height: 400, width: 400 },
72+
viewStyle: imageStyle,
7173
resizeMode: 'contain',
7274
thumbnailFadeDuration: 250,
7375
imageFadeDuration: 2000,

0 commit comments

Comments
 (0)