From bfec82884f4a24b66ab682b32073287f998ddd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Benitte?= Date: Thu, 14 Dec 2017 00:51:35 +0900 Subject: [PATCH] feat(line): remove unused component --- packages/nivo-line/src/legacy/LineDotsSvg.js | 171 ------------------- 1 file changed, 171 deletions(-) delete mode 100644 packages/nivo-line/src/legacy/LineDotsSvg.js diff --git a/packages/nivo-line/src/legacy/LineDotsSvg.js b/packages/nivo-line/src/legacy/LineDotsSvg.js deleted file mode 100644 index 609a941d0f..0000000000 --- a/packages/nivo-line/src/legacy/LineDotsSvg.js +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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 PropTypes from 'prop-types' -import compose from 'recompose/compose' -import withPropsOnChange from 'recompose/withPropsOnChange' -import pure from 'recompose/pure' -import setDisplayName from 'recompose/setDisplayName' -import { TransitionMotion, spring } from 'react-motion' -import { motionPropTypes } from '@nivo/core' -import { getLabelGenerator } from '@nivo/core' -import { DotsItem } from '@nivo/core' - -const LineDots = ({ - lines, - - symbol, - size, - color, - borderWidth, - borderColor, - - // labels - enableLabel, - getLabel, - labelYOffset, - - // theming - theme, - - // motion - animate, - motionStiffness, - motionDamping, -}) => { - const points = lines.reduce((acc, line) => { - const { id, points } = line - - return [ - ...acc, - ...points.filter(point => point.value !== null).map(point => { - const pointData = { - serie: { id }, - x: point.key, - y: point.value, - } - - return { - key: `${id}.${point.x}`, - x: point.x, - y: point.y, - fill: color(line), - stroke: borderColor(line), - label: enableLabel ? getLabel(pointData) : null, - } - }), - ] - }, []) - - if (animate !== true) { - return ( - - {points.map(point => ( - - ))} - - ) - } - const springConfig = { - motionDamping, - motionStiffness, - } - - return ( - { - return { - key: point.key, - data: point, - style: { - x: spring(point.x, springConfig), - y: spring(point.y, springConfig), - size: spring(size, springConfig), - }, - } - })} - > - {interpolatedStyles => ( - - {interpolatedStyles.map(({ key, style, data: point }) => ( - - ))} - - )} - - ) -} - -LineDots.ropTypes = { - lines: PropTypes.arrayOf( - PropTypes.shape({ - id: PropTypes.string.isRequired, - }) - ), - - symbol: PropTypes.func, - size: PropTypes.number.isRequired, - color: PropTypes.func.isRequired, - borderWidth: PropTypes.number.isRequired, - borderColor: PropTypes.func.isRequired, - - // labels - enableLabel: PropTypes.bool.isRequired, - label: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, - labelFormat: PropTypes.string, - labelYOffset: PropTypes.number, - - // theming - theme: PropTypes.shape({ - dots: PropTypes.shape({ - textColor: PropTypes.string.isRequired, - fontSize: PropTypes.string.isRequired, - }).isRequired, - }).isRequired, - - // motion - ...motionPropTypes, -} - -LineDots.defaultProps = { - // labels - enableLabel: false, - label: 'y', -} - -const enhance = compose( - withPropsOnChange(['label', 'labelFormat'], ({ label, labelFormat }) => ({ - getLabel: getLabelGenerator(label, labelFormat), - })), - pure -) - -export default setDisplayName('LineDots')(enhance(LineDots))