Skip to content

Commit

Permalink
fix(packages): remove global from default props (#1544)
Browse files Browse the repository at this point in the history
* fix(bar): remove `global` from default props

* fix(calendar): remove `global` from default props

* fix(chord): remove `global` from default props

* fix(geo): remove `global` from default props

* fix(heatmap): remove `global` from default props

* fix(line): remove `global` from default props

* fix(network): remove `global` from default props

* fix(parallel-coordinates): remove `global` from default props

* fix(scatterplot): remove `global` from default props

* fix(swarmplot): remove `global` from default props

* fix(treemap): remove `global` from default props

* fix(waffle): remove `global` from default props
  • Loading branch information
targos authored May 27, 2021
1 parent b820166 commit 4eb54ca
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 24 deletions.
3 changes: 1 addition & 2 deletions packages/bar/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ export const BarDefaultProps = {

annotations: [],

pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}

export const BarSvgDefaultProps = {
Expand Down
3 changes: 1 addition & 2 deletions packages/calendar/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,5 @@ export const CalendarDefaultProps = {

export const CalendarCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}
3 changes: 1 addition & 2 deletions packages/chord/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,5 @@ export const ChordDefaultProps = {

export const ChordCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}
3 changes: 1 addition & 2 deletions packages/geo/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ export const GeoMapDefaultProps = {

export const GeoMapCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}

const commonChoroplethDefaultProps = {
Expand Down
3 changes: 1 addition & 2 deletions packages/heatmap/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ export const HeatMapDefaultProps = {
cellHoverOthersOpacity: 0.35,

// canvas specific
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}

export const HeatMapSvgDefaultProps = {
Expand Down
3 changes: 1 addition & 2 deletions packages/line/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,5 @@ export const LineDefaultProps = {

export const LineCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}
3 changes: 1 addition & 2 deletions packages/network/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,5 @@ export const NetworkDefaultProps = {

export const NetworkCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ ParallelCoordinatesCanvas.propTypes = {
const WrappedParallelCoordinatesCanvas = withContainer(ParallelCoordinatesCanvas)
WrappedParallelCoordinatesCanvas.defaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}

export default WrappedParallelCoordinatesCanvas
3 changes: 1 addition & 2 deletions packages/scatterplot/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ export const ScatterPlotDefaultProps = {
export const ScatterPlotCanvasDefaultProps = {
...commonDefaultProps,
layers: ['grid', 'axes', 'nodes', 'mesh', 'legends', 'annotations'],
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}

export const NodePropType = PropTypes.shape({
Expand Down
3 changes: 1 addition & 2 deletions packages/swarmplot/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,5 @@ export const SwarmPlotDefaultProps = {

export const SwarmPlotCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}
3 changes: 1 addition & 2 deletions packages/treemap/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,5 @@ export const TreeMapHtmlDefaultProps = {

export const TreeMapCanvasDefaultProps = {
...commonDefaultProps,
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}
3 changes: 1 addition & 2 deletions packages/waffle/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,5 @@ export const WaffleHtmlDefaultProps = {
export const WaffleCanvasDefaultProps = {
...commonDefaultProps,
legends: [],
pixelRatio:
global.window && global.window.devicePixelRatio ? global.window.devicePixelRatio : 1,
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1,
}

0 comments on commit 4eb54ca

Please sign in to comment.