-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade dev tools & use new context API (#33)
* Upgrade dev tools and prepare support for React new Context * Use React new Context * Remove componentWillReceiveProps for getDerivedStateFromProps * fix getDerivedStateFromProps
- Loading branch information
Showing
15 changed files
with
6,532 additions
and
3,123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export Block from './Block' | ||
export Code from './Code' | ||
export Result from './Result' | ||
export { default as Block } from './Block' | ||
export { default as Code } from './Code' | ||
export { default as Result } from './Result' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = api => { | ||
api.cache(true) | ||
return { | ||
plugins: ['@babel/plugin-proposal-class-properties'], | ||
env: { | ||
es: { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
}, | ||
commonjs: { | ||
presets: ['@babel/preset-env', '@babel/preset-react'], | ||
}, | ||
rollup: { | ||
presets: [ | ||
['@babel/preset-env', { modules: false }], | ||
'@babel/preset-react', | ||
], | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react' | ||
|
||
const SizesContext = React.createContext({ | ||
fallbackWidth: null, | ||
fallbackHeight: null, | ||
forceFallback: false, | ||
throttle: 200, | ||
}) | ||
|
||
SizesContext.displayName = 'SizesContext' | ||
|
||
export default SizesContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
import { Component } from 'react' | ||
import contextTypes, { contextKey } from './contextTypes' | ||
import React from 'react' | ||
import SizesContext from './SizesContext' | ||
|
||
class SizesProvider extends Component { | ||
static childContextTypes = contextTypes | ||
|
||
getChildContext() { | ||
const { config = {} } = this.props | ||
|
||
return { | ||
[contextKey]: { | ||
fallbackWidth: config.fallbackWidth || null, | ||
fallbackHeight: config.fallbackHeight || null, | ||
throttle: config.throttle || 200, | ||
}, | ||
} | ||
} | ||
|
||
render() { | ||
return this.props.children | ||
} | ||
} | ||
const SizesProvider = ({ config, children }) => ( | ||
<SizesContext.Provider value={config}>{children}</SizesContext.Provider> | ||
) | ||
|
||
export default SizesProvider |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.