-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(voronoi): improve voronoi (#93)
- Loading branch information
Raphaël Benitte
authored
Dec 4, 2017
1 parent
df4ac4e
commit e1ae81a
Showing
5 changed files
with
146 additions
and
131 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 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,17 @@ | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* Copyright 2016-present, Raphaël Benitte. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
import React from 'react' | ||
import compose from 'recompose/compose' | ||
import defaultProps from 'recompose/defaultProps' | ||
import pure from 'recompose/pure' | ||
import { withTheme, withDimensions } from '../../../hocs' | ||
import { VoronoiDefaultProps } from './props' | ||
|
||
export default Component => | ||
compose(defaultProps(VoronoiDefaultProps), withTheme(), withDimensions(), pure)(Component) |
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,44 @@ | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* Copyright 2016-present, Raphaël Benitte. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
import PropTypes from 'prop-types' | ||
|
||
export const VoronoiPropTypes = { | ||
data: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, | ||
x: PropTypes.number.isRequired, | ||
y: PropTypes.number.isRequired, | ||
}) | ||
).isRequired, | ||
enablePolygons: PropTypes.bool.isRequired, | ||
enableSites: PropTypes.bool.isRequired, | ||
enableLinks: PropTypes.bool.isRequired, | ||
x: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, | ||
y: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, | ||
borderWidth: PropTypes.number.isRequired, | ||
borderColor: PropTypes.string.isRequired, | ||
linkWidth: PropTypes.number.isRequired, | ||
linkColor: PropTypes.string.isRequired, | ||
siteSize: PropTypes.number.isRequired, | ||
siteColor: PropTypes.string.isRequired, | ||
} | ||
|
||
export const VoronoiDefaultProps = { | ||
enablePolygons: true, | ||
enableSites: false, | ||
enableLinks: false, | ||
x: 0, | ||
y: 1, | ||
borderWidth: 2, | ||
borderColor: '#000', | ||
linkWidth: 1, | ||
linkColor: '#bbb', | ||
siteSize: 4, | ||
siteColor: '#666', | ||
} |