Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #20 from nikolay-borzov/task_08
Browse files Browse the repository at this point in the history
Task 08 - Useful libraries
  • Loading branch information
nikolay-borzov committed Jun 19, 2018
2 parents 6191a2e + 2aaa2b9 commit 96158e4
Show file tree
Hide file tree
Showing 94 changed files with 6,297 additions and 2,582 deletions.
14 changes: 12 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
{
"plugins": [
[ "styled-components", { "displayName": false, "ssr": true }],
"transform-class-properties",
"transform-object-rest-spread",
"syntax-dynamic-import",
"react-loadable/babel"
],
"presets": [
["env", { "modules": false }],
"flow",
"react"
],
"retainLines": true,
"env": {
"development": {
"plugins": ["react-hot-loader/babel"]
"plugins": [
[ "styled-components", { "fileName": false, "ssr": true }],
"react-hot-loader/babel"
]
},
"test": {
"plugins": ["transform-class-properties", "dynamic-import-node"],
"plugins": [
[ "styled-components", { "fileName": false }],
"transform-class-properties",
"dynamic-import-node"
],
"presets": ["env", "react"]
}
}
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flow-typed/npm
8 changes: 6 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ module.exports = {
render: true,
mount: true
},
plugins: ['react'],
plugins: ['react', 'flowtype'],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
extends: ['prettier-standard', 'plugin:react/recommended']
extends: [
'prettier-standard',
'plugin:react/recommended',
'plugin:flowtype/recommended'
]
}
17 changes: 17 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[ignore]
<PROJECT_ROOT>/dist
<PROJECT_ROOT>/**.test.*

[include]


[libs]

[lints]
all=warn

[options]
emoji=true
include_warnings=true

[strict]
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ typings/
# dotenv environment variables file
.env

# Flow type definitions
flow-typed/npm

dist

.vscode
2 changes: 2 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import 'storybook-addon-jsx/register'
import '@storybook/addon-actions/register'
15 changes: 15 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { configure, setAddon } from '@storybook/react'
import JSXAddon from 'storybook-addon-jsx'

// Import app styles
import '../src/style.css'

// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /.stories.js$/)
function loadStories() {
req.keys().forEach(filename => req(filename))
}

setAddon(JSXAddon)

configure(loadStories, module)
13 changes: 13 additions & 0 deletions .storybook/decorators/alt-background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'

const styles = {
height: '100%',
position: 'absolute',
width: '100%'
}

export const AltBackground = storyFn => (
<div style={styles} className="alt-background">
{storyFn()}
</div>
)
11 changes: 11 additions & 0 deletions .storybook/decorators/centered.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

const styles = {
height: '100%',
position: 'absolute',
width: '100%',
display: 'flex',
justifyContent: 'center'
}

export const Centered = storyFn => <div style={styles}>{storyFn()}</div>
2 changes: 2 additions & 0 deletions .storybook/decorators/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './centered'
export * from './alt-background'
19 changes: 19 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// you can use this file to add your custom webpack plugins, loaders and anything you like.
// This is just the basic way to add additional webpack configurations.
// For more information refer the docs: https://storybook.js.org/configurations/custom-webpack-config

// IMPORTANT
// When you add this file, we won't add the default configurations which is similar
// to "React Create App". This only has babel loader to load JavaScript.

const config = require('../webpack/webpack.config.client')

module.exports = {
resolve: config.resolve,

plugins: [...config.plugins],

module: {
rules: [...config.module.rules]
}
}
59 changes: 59 additions & 0 deletions favicon-description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"masterPicture": "src/assets/favicon.png",
"iconsPath": "/",
"design": {
"ios": {
"pictureAspect": "noChange",
"assets": {
"ios6AndPriorIcons": false,
"ios7AndLaterIcons": false,
"precomposedIcons": false,
"declareOnlyDefaultIcon": true
},
"appName": "Movie Search"
},
"desktopBrowser": {},
"windows": {
"pictureAspect": "noChange",
"backgroundColor": "#2d89ef",
"onConflict": "override",
"assets": {
"windows80Ie10Tile": false,
"windows10Ie11EdgeTiles": {
"small": false,
"medium": true,
"big": false,
"rectangle": false
}
},
"appName": "Movie Search"
},
"androidChrome": {
"pictureAspect": "noChange",
"themeColor": "#ffffff",
"manifest": {
"name": "Movie Search",
"display": "standalone",
"orientation": "notSet",
"onConflict": "override",
"declared": true
},
"assets": {
"legacyIcon": false,
"lowResolutionIcons": false
}
},
"safariPinnedTab": {
"pictureAspect": "silhouette",
"themeColor": "#5bbad5"
}
},
"settings": {
"compression": 5,
"scalingAlgorithm": "Mitchell",
"errorOnImageTooSmall": false,
"readmeFile": false,
"htmlCodeFile": false,
"usePathAsIs": false
}
}
11 changes: 11 additions & 0 deletions flow-typed/film.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @flow

declare type Film = {
id: number,
poster_path: string,
title: string,
vote_average: number,
genres: string[],
release_date: string,
overview: string
}
5 changes: 5 additions & 0 deletions flow-typed/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @flow

declare var IS_DEVELOPMENT: boolean
declare var IS_SERVER: boolean
declare var API_URL: string
21 changes: 19 additions & 2 deletions jest/stubs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
export const film = {
id: 1,
title: 'Film title',
poster_path: 'http://via.placeholder.com/500x750',
poster_path: 'https://picsum.photos/g/300/450/?random',
overview: 'Film overview',
release_date: '2018-05-04',
genres: ['some genre', 'another genre']
genres: ['some genre', 'another genre'],
vote_average: 7.5
}

export const films = [film]

function getRandomImageId() {
// https://picsum.photos/images
return Math.floor(Math.random() * Math.floor(1084))
}

export function getRandomFilm(id) {
return {
...film,
id,
poster_path: film.poster_path.replace(
'random',
`image=${getRandomImageId()}`
)
}
}
Loading

0 comments on commit 96158e4

Please sign in to comment.