Skip to content

Commit

Permalink
label size
Browse files Browse the repository at this point in the history
  • Loading branch information
severinlandolt committed Apr 13, 2024
1 parent 06467c1 commit 122a239
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/components/chart-elements/FunnelChart/FunnelChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export interface FunnelChartProps extends React.HTMLAttributes<HTMLDivElement> {
};
}

//#region Funnel Chart Primitive
// ============================================================================

const FunnelChartPrimitive = React.forwardRef<HTMLDivElement, FunnelChartProps>(
(props: FunnelChartProps, ref) => {
const {
Expand Down Expand Up @@ -355,12 +358,11 @@ const FunnelChartPrimitive = React.forwardRef<HTMLDivElement, FunnelChartProps>(
10
}
textAnchor="middle"
fontSize="0.75rem"
fill=""
stroke=""
className={tremorTwMerge(
// light
"fill-tremor-content",
"fill-tremor-content text-tremor-label",
// dark
"dark:fill-dark-tremor-content",
)}
Expand Down Expand Up @@ -607,13 +609,13 @@ const validateData = (data: DataT[], calculatedFrom?: CalculateFrom): string | n
return null;
};

// Exports
//#region Exports
// ============================================================================

const FunnelChart = ({ data, ...props }: FunnelChartProps) => {
const errorMessage = data ? validateData(data, props.calculateFrom) : null;
return errorMessage ? (
<NoData noDataText={`Calculation error: ${errorMessage}`} />
<NoData className="h-full w-full p-6" noDataText={`Calculation error: ${errorMessage}`} />
) : (
<FunnelChartPrimitive data={data} {...props} />
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/chart-elements/common/NoData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import React from "react";

interface NoDataProps {
noDataText?: string;
className?: string;
}
const NoData = ({ noDataText = "No data" }: NoDataProps) => {
const NoData = ({ className, noDataText = "No data" }: NoDataProps) => {
return (
<div
className={tremorTwMerge(
Expand All @@ -14,6 +15,7 @@ const NoData = ({ noDataText = "No data" }: NoDataProps) => {
"border-tremor-border",
// dark
"dark:border-dark-tremor-border",
className,
)}
>
<p
Expand Down
4 changes: 2 additions & 2 deletions src/stories/chart-elements/FunnelChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { CustomTooltipProps } from "components/chart-elements/common/CustomToolt
import { currencyValueFormatter } from "lib";

const data = [
{ name: "opens", value: -200 },
{ name: "visitors", value: 351 },
{ name: "opens", value: 200 },
{ name: "visitors ajdf asfkdjhs dkfjhas dfjas jfkhasd kjk ", value: 351 },
{
name: `added to cart`,
value: 191,
Expand Down

0 comments on commit 122a239

Please sign in to comment.