Skip to content

Commit

Permalink
feat(tooltip): remove prop types
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Nov 15, 2020
1 parent 3413142 commit b187c61
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 33 deletions.
3 changes: 1 addition & 2 deletions packages/tooltip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"@nivo/core": "*"
},
"peerDependencies": {
"@nivo/core": "0.63.1",
"prop-types": ">= 15.5.10 < 16.0.0"
"@nivo/core": "0.63.1"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/tooltip/src/Crosshair.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'
import { crosshairPropTypes } from './props'
import CrosshairLine from './CrosshairLine'
import { CrosshairLine } from './CrosshairLine'

const Crosshair = memo(({ width, height, type, x, y }) => {
export const Crosshair = memo(({ width, height, type, x, y }) => {
let xLine
let yLine
if (type === 'cross') {
Expand Down Expand Up @@ -43,6 +41,7 @@ const Crosshair = memo(({ width, height, type, x, y }) => {
)
})

/*
Crosshair.displayName = 'Crosshair'
Crosshair.propTypes = {
width: PropTypes.number.isRequired,
Expand All @@ -56,3 +55,4 @@ Crosshair.defaultProps = {
}
export default Crosshair
*/
5 changes: 3 additions & 2 deletions packages/tooltip/src/CrosshairLine.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { memo, useMemo } from 'react'
import PropTypes from 'prop-types'
import { useSpring, animated } from 'react-spring'
import { useTheme, useMotionConfig } from '@nivo/core'

const CrosshairLine = memo(({ x0, x1, y0, y1 }) => {
export const CrosshairLine = memo(({ x0, x1, y0, y1 }) => {
const theme = useTheme()
const { animate, config: springConfig } = useMotionConfig()
const style = useMemo(
Expand All @@ -26,6 +25,7 @@ const CrosshairLine = memo(({ x0, x1, y0, y1 }) => {
return <animated.line {...animatedProps} fill="none" style={style} />
})

/*
CrosshairLine.displayName = 'CrosshairLine'
CrosshairLine.propTypes = {
x0: PropTypes.number.isRequired,
Expand All @@ -35,3 +35,4 @@ CrosshairLine.propTypes = {
}
export default CrosshairLine
*/
6 changes: 3 additions & 3 deletions packages/tooltip/src/TableTooltip.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'
import { useTheme } from '@nivo/core'

const tableStyle = {
width: '100%',
borderCollapse: 'collapse',
}

const TableTooltip = memo(({ title, rows, renderContent }) => {
export const TableTooltip = memo(({ title, rows, renderContent }) => {
const theme = useTheme()

if (!rows.length) return null
Expand Down Expand Up @@ -38,7 +37,7 @@ const TableTooltip = memo(({ title, rows, renderContent }) => {

return <div style={theme.tooltip.container}>{content}</div>
})

/*
TableTooltip.propTypes = {
title: PropTypes.node,
rows: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.node)).isRequired,
Expand All @@ -48,3 +47,4 @@ TableTooltip.propTypes = {
TableTooltip.displayName = 'TableTooltip'
export default TableTooltip
*/
5 changes: 2 additions & 3 deletions packages/tooltip/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export * from './TooltipWrapper'
export * from './BasicTooltip'
export * from './Chip'
export { default as TableTooltip } from './TableTooltip'
export { default as Crosshair } from './Crosshair'
export * from './TableTooltip'
export * from './Crosshair'
export * from './Tooltip'
export * from './TooltipProvider'
export * from './context'
export * from './hooks'
export * from './props'
export * from './types'
19 changes: 0 additions & 19 deletions packages/tooltip/src/props.js

This file was deleted.

0 comments on commit b187c61

Please sign in to comment.