Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bump): improve AreaBump typings and add support for series extra…
… properties
- Loading branch information
Showing
13 changed files
with
356 additions
and
222 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 |
---|---|---|
@@ -1,10 +1,18 @@ | ||
import { BasicTooltip } from '@nivo/tooltip' | ||
import { AreaBumpDatum, AreaBumpComputedSerie } from './types' | ||
import { AreaBumpDatum, AreaBumpComputedSerie, AreaBumpSerieExtraProps } from './types' | ||
|
||
interface AreaTooltipProps<D extends AreaBumpDatum> { | ||
serie: AreaBumpComputedSerie<D> | ||
interface AreaTooltipProps< | ||
Datum extends AreaBumpDatum, | ||
ExtraProps extends AreaBumpSerieExtraProps | ||
> { | ||
serie: AreaBumpComputedSerie<Datum, ExtraProps> | ||
} | ||
|
||
export const AreaTooltip = <D extends AreaBumpDatum>({ serie }: AreaTooltipProps<D>) => { | ||
return <BasicTooltip id={serie.id} enableChip={true} color={serie.color} /> | ||
} | ||
export const AreaTooltip = < | ||
Datum extends AreaBumpDatum, | ||
ExtraProps extends AreaBumpSerieExtraProps | ||
>({ | ||
serie, | ||
}: AreaTooltipProps<Datum, ExtraProps>) => ( | ||
<BasicTooltip id={serie.id} enableChip={true} color={serie.color} /> | ||
) |
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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import { ResponsiveWrapper } from '@nivo/core' | ||
import { AreaBumpDatum, AreaBumpSvgProps, DefaultAreaBumpDatum } from './types' | ||
import { | ||
AreaBumpDatum, | ||
AreaBumpSerieExtraProps, | ||
AreaBumpSvgProps, | ||
DefaultAreaBumpDatum, | ||
} from './types' | ||
import { AreaBump } from './AreaBump' | ||
|
||
export const ResponsiveAreaBump = <D extends AreaBumpDatum = DefaultAreaBumpDatum>( | ||
props: Omit<AreaBumpSvgProps<D>, 'width' | 'height'> | ||
export const ResponsiveAreaBump = < | ||
Datum extends AreaBumpDatum = DefaultAreaBumpDatum, | ||
ExtraProps extends AreaBumpSerieExtraProps = Record<string, unknown> | ||
>( | ||
props: Omit<AreaBumpSvgProps<Datum, ExtraProps>, 'width' | 'height'> | ||
) => ( | ||
<ResponsiveWrapper> | ||
{({ width, height }) => <AreaBump<D> width={width} height={height} {...props} />} | ||
{({ width, height }) => ( | ||
<AreaBump<Datum, ExtraProps> width={width} height={height} {...props} /> | ||
)} | ||
</ResponsiveWrapper> | ||
) |
Oops, something went wrong.