Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: renatorib/react-sizes
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.1
Choose a base ref
...
head repository: renatorib/react-sizes
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jun 23, 2017

  1. Copy the full SHA
    a9a04ea View commit details
  2. v0.1.2

    renatorib committed Jun 23, 2017
    Copy the full SHA
    1e7a622 View commit details

Commits on Sep 15, 2017

  1. Prepare for 0.2.0

    - add eslint
    - optimize rerenders with shallowDiff in propsToPass
    - remove unnecessary dependencies
    - others
    renatorib committed Sep 15, 2017
    Copy the full SHA
    8a72152 View commit details
  2. fix clear script

    renatorib committed Sep 15, 2017
    Copy the full SHA
    ee45bca View commit details
  3. 0.2.0

    renatorib committed Sep 15, 2017
    Copy the full SHA
    01eebdb View commit details
  4. remove global listener

    renatorib committed Sep 15, 2017
    Copy the full SHA
    f3ec0da View commit details
  5. 0.3.0

    renatorib committed Sep 15, 2017
    Copy the full SHA
    80b6a1e View commit details

Commits on Sep 18, 2017

  1. fix path to index

    renatorib committed Sep 18, 2017
    Copy the full SHA
    d793004 View commit details
  2. 0.3.1

    renatorib committed Sep 18, 2017
    Copy the full SHA
    cc618ed View commit details

Commits on Sep 28, 2017

  1. add createSizedComponent

    renatorib committed Sep 28, 2017
    Copy the full SHA
    0840d61 View commit details

Commits on Nov 28, 2017

  1. Copy the full SHA
    14723b3 View commit details

Commits on Nov 30, 2017

  1. Copy the full SHA
    f165f2e View commit details
  2. 0.3.2

    renatorib committed Nov 30, 2017
    Copy the full SHA
    ca75a1c View commit details
  3. Copy the full SHA
    eeac619 View commit details
  4. fix lint

    renatorib committed Nov 30, 2017
    Copy the full SHA
    878d308 View commit details
  5. 0.3.3

    renatorib committed Nov 30, 2017
    Copy the full SHA
    60e3c0e View commit details

Commits on Dec 1, 2017

  1. add prettier and fix bugs

    renatorib committed Dec 1, 2017
    Copy the full SHA
    db40564 View commit details
  2. fix presets import

    renatorib committed Dec 1, 2017
    Copy the full SHA
    8e45512 View commit details
  3. 0.3.4

    renatorib committed Dec 1, 2017
    Copy the full SHA
    3fabe5d View commit details

Commits on Dec 2, 2017

  1. bundle with rollup

    renatorib committed Dec 2, 2017
    Copy the full SHA
    5b5be51 View commit details
  2. 0.4.0

    renatorib committed Dec 2, 2017
    Copy the full SHA
    2e3e5d5 View commit details
  3. 0.4.1

    renatorib committed Dec 2, 2017
    Copy the full SHA
    5d07393 View commit details
  4. v0.4.2

    renatorib committed Dec 2, 2017
    Copy the full SHA
    27b69cc View commit details
  5. fix pkg module references

    renatorib committed Dec 2, 2017
    Copy the full SHA
    66612de View commit details
  6. v0.4.3

    renatorib committed Dec 2, 2017
    Copy the full SHA
    f67d326 View commit details

Commits on Jan 17, 2018

  1. Support SSR with SizesProvider (#23)

    * remove dist es add to gitignore
    
    * add support to ssr with SizesProvider
    renatorib authored Jan 17, 2018
    Copy the full SHA
    907d84a View commit details
  2. v1.0.0-beta.0

    renatorib committed Jan 17, 2018
    Copy the full SHA
    b691e36 View commit details

Commits on Jan 18, 2018

  1. Copy the full SHA
    99dc834 View commit details
  2. v1.0.0-beta.1

    renatorib committed Jan 18, 2018
    Copy the full SHA
    e0510e2 View commit details
  3. v1.0.0

    renatorib committed Jan 18, 2018
    Copy the full SHA
    97cd82c View commit details

Commits on Feb 14, 2018

  1. 1.0.1

    renatorib committed Feb 14, 2018
    Copy the full SHA
    13f61f0 View commit details
  2. Copy the full SHA
    3bd74d7 View commit details
  3. v1.0.2

    renatorib committed Feb 14, 2018
    Copy the full SHA
    66f2868 View commit details

Commits on Feb 20, 2018

  1. Copy the full SHA
    c34747d View commit details
  2. v1.0.3

    renatorib committed Feb 20, 2018
    Copy the full SHA
    a0eb5c3 View commit details

Commits on Jun 1, 2018

  1. Fix throttle config. the configuration is in the context[contextKey] …

    …dict not directly under context (#28)
    Sascha Lenz authored and renatorib committed Jun 1, 2018
    Copy the full SHA
    05b6c96 View commit details

Commits on Jun 2, 2018

  1. v1.0.4

    renatorib committed Jun 2, 2018
    Copy the full SHA
    c03795a View commit details

Commits on Jul 10, 2018

  1. Copy the full SHA
    0df6318 View commit details

Commits on Mar 16, 2019

  1. 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
    danielr18 authored and renatorib committed Mar 16, 2019
    Copy the full SHA
    665bfb4 View commit details
  2. Copy the full SHA
    ccbeced View commit details

Commits on Mar 18, 2019

  1. Add force fallback option (#36)

    * Add force fallback flag
    
    * Fix highlight syntax theme
    danielr18 authored and renatorib committed Mar 18, 2019
    Copy the full SHA
    f9404d2 View commit details

Commits on Apr 22, 2019

  1. added throttle cancel method (#39)

    haritonasty authored and renatorib committed Apr 22, 2019
    Copy the full SHA
    ec87f43 View commit details
  2. v2.0.0

    renatorib committed Apr 22, 2019
    Copy the full SHA
    2389d73 View commit details

Commits on Jul 10, 2019

  1. Correction to the wording for README (#42)

    The correct term is "Higher-order components", and I also made a few minor grammatical fixes.
    impressivewebs authored and renatorib committed Jul 10, 2019
    Copy the full SHA
    d87bcab View commit details

Commits on Oct 21, 2019

  1. Bump mixin-deep from 1.3.1 to 1.3.2 (#44)

    Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
    - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
    - [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and renatorib committed Oct 21, 2019
    Copy the full SHA
    0039b7f View commit details
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
es
lib
35 changes: 35 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
"env": {
"browser": true,
"node": true
},
"rules": {
"valid-jsdoc": 2,
"react/prop-types": 0,
"react/jsx-uses-react": 1,
"react/jsx-no-undef": 2,
"import/no-unresolved": ["error", { "ignore": ["^react$"] }],
"comma-dangle": ["error", "always-multiline"],
"semi": ["error", "never"],
"no-trailing-spaces": ["error", { "skipBlankLines": true }],
"no-unused-vars": ["error", { "ignoreRestSiblings": true }]
},
"plugins": [
"import",
"react"
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
es
dist
node_modules
lib
.DS_Store
*.log
.vscode
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
node_modules
src
.storybook
.editorconfig
.eslintrc
.eslintignore
.prettierrc
logo.png
rollup.config.js
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package.json
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"requirePragma": false,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false
}
12 changes: 6 additions & 6 deletions .storybook/components/Block.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import React from 'react'

const wrapperStyle = {
paddingBottom: '20px',
};
}

const titleStyle = {
textTransform: 'uppercase',
@@ -12,17 +12,17 @@ const titleStyle = {
color: '#999',
paddingBottom: '5px',
fontWeight: 'bold',
};
}

const contentStyle = {
border: '1px solid #DDD',
};
}

const Block = ({ children, title }) => (
<div style={wrapperStyle}>
<div style={titleStyle}>{title}</div>
<div style={contentStyle}>{children}</div>
</div>
);
)

export default Block;
export default Block
12 changes: 6 additions & 6 deletions .storybook/components/Code.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter';
import { github as theme } from 'react-syntax-highlighter/dist/styles';
import Block from './Block';
import React from 'react'
import SyntaxHighlighter from 'react-syntax-highlighter/dist/prism'
import { prism as theme } from 'react-syntax-highlighter/dist/styles/prism'
import Block from './Block'

const Code = ({ children }) => (
<Block title="Code">
<SyntaxHighlighter language="jsx" style={theme} customStyle={{ margin: 0 }}>
{children}
</SyntaxHighlighter>
</Block>
);
)

export default Code;
export default Code
17 changes: 10 additions & 7 deletions .storybook/components/MobileBreakpoint.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import React from 'react';
import withSizes from '../../lib/withSizes';
import React from 'react'
import withSizes from '../../src/withSizes'

const MobileBreakpoint = ({ isMobile, breakpoint, width }) => (
<div>
<div>breakpoint: {breakpoint} | width: {width}</div>
<div>
breakpoint: {breakpoint} | width: {width}
</div>
<div>{isMobile ? 'Is Mobile' : 'Is Not Mobile'}</div>
<br /><br />
<br />
<br />
</div>
);
)

const mapSizesToProps = ({ width }, { breakpoint }) => ({
isMobile: width < breakpoint,
width,
});
})

export default withSizes(mapSizesToProps)(MobileBreakpoint);
export default withSizes(mapSizesToProps)(MobileBreakpoint)
12 changes: 4 additions & 8 deletions .storybook/components/Result.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from 'react';
import Block from './Block';
import React from 'react'
import Block from './Block'

const Result = ({ children }) => (
<Block title="Result">
{children}
</Block>
);
const Result = ({ children }) => <Block title="Result">{children}</Block>

export default Result;
export default Result
6 changes: 3 additions & 3 deletions .storybook/components/index.js
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'
2 changes: 1 addition & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { configure } from '@kadira/storybook';
import { configure } from '@storybook/react';

function loadStories() {
require('./stories');
51 changes: 40 additions & 11 deletions .storybook/stories/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
import React from 'react';
import { storiesOf, action, linkTo } from '@kadira/storybook';
import { Code, Result } from '../components';
import MobileBreakpoint from '../components/MobileBreakpoint';
import withSizes from '../../lib/withSizes';
import React from 'react'
import { storiesOf } from '@storybook/react'
import { Code, Result } from '../components'
import MobileBreakpoint from '../components/MobileBreakpoint'
import withSizes from '../../src/withSizes'
import SizesProvider from '../../src/SizesProvider'

const mapSizesToProps = sizes => ({
backgroundColor: sizes.width > 800 ? 'green' : 'blue',
isMobile: withSizes.isMobile(sizes),
isTablet: withSizes.isTablet(sizes),
isDesktop: withSizes.isDesktop(sizes),
});
})

const ExampleSizedComponent = withSizes(mapSizesToProps)(
({ isMobile, isTablet, isDesktop, backgroundColor }) => (
<div style={{ backgroundColor, color: 'white', padding: '30px' }}>
<div><strong>Resize your window</strong></div>
<div>
<strong>Resize your window</strong>
</div>
{isMobile && 'isMobile '}
{isTablet && 'isTablet '}
{isDesktop && 'isDesktop '}
</div>
)
);
)

class ForceFallbackExample extends React.Component {
state = {
forceFallback: true,
}

componentDidMount() {
setTimeout(() => {
this.setState({ forceFallback: false })
}, 5000)
}

render() {
const { forceFallback } = this.state

return (
<SizesProvider
config={{ fallbackHeight: 640, fallbackWidth: 280, forceFallback }}
>
<Result>
{forceFallback && <p>Forcing fallback to mobile</p>}
<ExampleSizedComponent />
</Result>
</SizesProvider>
)
}
}

storiesOf('Sizes', module)
.add('default behavior', () => (
@@ -29,7 +59,7 @@ storiesOf('Sizes', module)
<ExampleSizedComponent />
</Result>
<Code>
{`import React from 'react';
{`import React from 'react';
import withSizes from 'react-sizes';
const mapSizesToProps = sizes => ({
@@ -52,12 +82,11 @@ const ExampleSizedComponent = withSizes(mapSizesToProps)(
</Code>
</div>
))

.add('mobileBreakpoint', () => (
<div>
<MobileBreakpoint breakpoint={300} />
<MobileBreakpoint breakpoint={500} />
<MobileBreakpoint breakpoint={700} />
</div>
))
;
.add('force fallback', () => <ForceFallbackExample />)
Loading