Skip to content

Commit

Permalink
feat(tooltip): adapt BasicTooltip for new typings
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Nov 15, 2020
1 parent b187c61 commit cb87d9a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/tooltip/src/BasicTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { memo, ReactNode } from 'react'
// @ts-ignore
import { useTheme, useValueFormatter } from '@nivo/core'
import { useTheme, DataFormatter, useValueFormatter } from '@nivo/core'
import { Chip } from './Chip'

interface BasicTooltipProps {
id: ReactNode
value?: number | string
value?: number | string | Date
format?: DataFormatter
color?: string
enableChip?: boolean
renderContent?: () => JSX.Element
Expand All @@ -26,10 +27,10 @@ export const BasicTooltip = memo<BasicTooltipProps>(
}
content = (
<div style={theme.tooltip.basic}>
{enableChip && <Chip color={color} style={theme.tooltip.chip} />}
{enableChip && <Chip color={color!} style={theme.tooltip.chip} />}
{value !== undefined ? (
<span>
{id}: <strong>{isNaN(value) ? String(value) : value}</strong>
{id}: <strong>{`${value}`}</strong>
</span>
) : (
id
Expand Down

0 comments on commit cb87d9a

Please sign in to comment.