Skip to content

Commit

Permalink
feat(legends): init SizeLegendSvg
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte committed Dec 16, 2017
1 parent f316606 commit 22c186a
Show file tree
Hide file tree
Showing 13 changed files with 9,333 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/nivo-circle-packing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"jsnext:main": "es/index.js",
"dependencies": {
"@nivo/core": "0.33.0",
"@nivo/legends": "0.33.0",
"d3-hierarchy": "^1.1.5",
"react-motion": "^0.5.2",
"recompose": "^0.26.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/nivo-circle-packing/src/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import React from 'react'
import { TransitionMotion, spring } from 'react-motion'
import pick from 'lodash/pick'
import { colorMotionSpring, getInterpolatedColor } from '@nivo/core'
import { Container, SvgWrapper } from '@nivo/core'
import { colorMotionSpring, getInterpolatedColor, Container, SvgWrapper } from '@nivo/core'
import enhance from './enhance'
import { nodeWillEnter, nodeWillLeave } from './motion'
import { getNodeHandlers } from './interactivity'
Expand Down
10 changes: 7 additions & 3 deletions packages/nivo-legends/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
"devDependencies": {
"@nivo/babel-preset": "0.33.0",
"babel-cli": "^6.26.0",
"babel-jest": "^20.0.3",
"cross-env": "^5.0.5",
"jest": "^21.0.1",
"babel-eslint": "^8.0.3",
"babel-jest": "^21.2.0",
"cross-env": "^5.1.1",
"eslint": "^4.12.1",
"eslint-plugin-react": "^7.5.1",
"jest": "^21.2.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0"
Expand All @@ -27,6 +30,7 @@
"access": "public"
},
"scripts": {
"lint": "eslint src stories tests",
"test": "jest --verbose ./tests",
"test:cover": "jest --verbose --coverage ./tests",
"build:commonjs": "rm -rf lib && cross-env NODE_ENV=commonjs babel src --out-dir lib",
Expand Down
17 changes: 17 additions & 0 deletions packages/nivo-legends/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,24 @@ export const ANCHOR_LEFT = 'left'
export const ANCHOR_TOP_LEFT = 'top-left'
export const ANCHOR_CENTER = 'center'

export const POSITION_TOP = 'top'
export const POSITION_RIGHT = 'right'
export const POSITION_BOTTOM = 'bottom'
export const POSITION_LEFT = 'left'

export const DIRECTION_TOP_LEFT = 'top-left'
export const DIRECTION_TOP_RIGHT = 'top-right'
export const DIRECTION_RIGHT_TOP = 'right-top'
export const DIRECTION_RIGHT_BOTTOM = 'right-bottom'
export const DIRECTION_BOTTOM_LEFT = 'bottom-left'
export const DIRECTION_BOTTOM_RIGHT = 'bottom-right'
export const DIRECTION_LEFT_TOP = 'left-top'
export const DIRECTION_LEFT_BOTTOM = 'left-bottom'

export const DIRECTION_LEFT_TO_RIGHT = 'left-to-right'
export const DIRECTION_RIGHT_TO_LEFT = 'right-to-left'
export const DIRECTION_TOP_TO_BOTTOM = 'top-to-bottom'
export const DIRECTION_BOTTOM_TO_TOP = 'bottom-to-top'

export const SHAPE_SQUARE = 'square'
export const SHAPE_CIRCLE = 'circle'
6 changes: 6 additions & 0 deletions packages/nivo-legends/src/svg/BoxLegendSvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ const BoxLegendSvg = ({
}

BoxLegendSvg.propTypes = {
data: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
fill: PropTypes.string.isRequired,
})
).isRequired,
containerWidth: PropTypes.number.isRequired,
containerHeight: PropTypes.number.isRequired,
translateX: PropTypes.number.isRequired,
Expand Down
1 change: 1 addition & 0 deletions packages/nivo-legends/src/svg/LegendSvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const LegendSvg = ({
symbolSpacing,
symbolShape,
}) => {
// eslint-disable-next-line no-unused-vars
const { width, height, padding } = computeDimensions({
itemCount: data.length,
itemWidth,
Expand Down
Loading

0 comments on commit 22c186a

Please sign in to comment.