Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joewoodson committed Jan 29, 2025
1 parent ca75f2c commit 7b88609
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
17 changes: 2 additions & 15 deletions packages/charts/src/components/BarChart/BarChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const planetsRadiusDataWithSingleClickable = (() => {
return {
label: item.name,
value: parseFloat(item.radius),
onBarClick: index === 0 ? () => window.open('https://frontify.com') : undefined,
onBarClick: index === 0 ? () => window.open('https://frontify.com', '_blank', 'noopener') : undefined,
};
});

Expand Down Expand Up @@ -190,22 +190,9 @@ const addOnClickToFirstPoint = (series: BarChartSeries[]): BarChartSeries[] => {
...singleSeries,
dataPoints: singleSeries.dataPoints.map((dataPoint, index) => ({
...dataPoint,
onBarClick: index === 0 ? () => window.open('https://frontify.com') : undefined,
onBarClick: index === 0 ? () => window.open('https://frontify.com', '_blank', 'noopener') : undefined,
})),
}));
// return series.reduce(
// (prev, curr) => [
// ...prev,
// {
// ...curr,
// dataPoints: curr.dataPoints.map((dataPoint, index) => ({
// ...dataPoint,
// onBarClick: index === 0 ? () => window.open('https://frontify.com') : null,
// })),
// },
// ],
// [],
// );
};

const planetImagesMap: Record<string, string> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const Bars = ({ series, horizontal, displayStyle }: BarGroupProps) => {
}
};
const onPointerOut = () => setFocusedItemLabel(null);
const onPointerDown = (e: EventHandlerParams<BarChartDataPoint>) => e.datum.onBarClick && e.datum.onBarClick(e);
const onPointerDown = (e: EventHandlerParams<BarChartDataPoint>) => e.datum.onBarClick?.(e);

const seriesElements = series.map((item, seriesIndex) => (
<BarSeries
Expand Down

0 comments on commit 7b88609

Please sign in to comment.