Skip to content

Commit

Permalink
fix styling + add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbalonperin committed May 24, 2024
1 parent 84c94c7 commit f8bda6f
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
interval={startEndOnly ? "preserveStartEnd" : intervalType}
tickLine={false}
Expand Down Expand Up @@ -225,6 +231,12 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickFormatter={valueFormatter}
allowDecimals={allowDecimals}
Expand Down
24 changes: 24 additions & 0 deletions src/components/chart-elements/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
axisLine={showAxisLine}
Expand Down Expand Up @@ -236,6 +242,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
axisLine={showAxisLine}
Expand Down Expand Up @@ -275,6 +287,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickFormatter={
relative ? (value: number) => `${(value * 100).toString()} %` : valueFormatter
Expand Down Expand Up @@ -313,6 +331,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
>
{yAxisLabel && (
Expand Down
12 changes: 12 additions & 0 deletions src/components/chart-elements/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
axisLine={showAxisLine}
Expand Down Expand Up @@ -221,6 +227,12 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickFormatter={valueFormatter}
allowDecimals={allowDecimals}
Expand Down
12 changes: 12 additions & 0 deletions src/components/chart-elements/ScatterChart/ScatterChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
tickFormatter={valueFormatter.x}
Expand Down Expand Up @@ -291,6 +297,12 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
allowDecimals={allowDecimals}
allowDataOverflow={true}
Expand Down
6 changes: 6 additions & 0 deletions src/stories/chart-elements/AreaChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,9 @@ export const AxisLabels: Story = {
yAxisLabel: "Amount (USD)",
},
};

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};
6 changes: 6 additions & 0 deletions src/stories/chart-elements/BarChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,9 @@ export const AxisLabels: Story = {
yAxisLabel: "Amount (USD)",
},
};

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};
6 changes: 6 additions & 0 deletions src/stories/chart-elements/LineChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,9 @@ export const AxisLabels: Story = {
yAxisLabel: "Amount (USD)",
},
};

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};
6 changes: 6 additions & 0 deletions src/stories/chart-elements/ScatterChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,9 @@ export const AxisLabels: Story = {
yAxisLabel: "Amount (USD)",
},
};

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};

0 comments on commit f8bda6f

Please sign in to comment.