fix: ssr hydration error in piechart

This commit is contained in:
Ephraim Atta-Duncan
2023-08-15 18:02:10 +00:00
parent 29b4cb7793
commit b7543298e1
2 changed files with 33 additions and 27 deletions

View File

@ -9,6 +9,7 @@ import { cn } from '@documenso/ui/lib/utils';
import { StargazersType } from './page';
export type MetricsDataKey = 'stars' | 'forks' | 'mergedPRs' | 'openIssues';
export type GithubMetricProps = HTMLAttributes<HTMLDivElement> & {
data: StargazersType;
metricKey: MetricsDataKey;
@ -17,8 +18,6 @@ export type GithubMetricProps = HTMLAttributes<HTMLDivElement> & {
chartHeight?: number;
};
export type MetricsDataKey = 'stars' | 'forks' | 'mergedPRs' | 'openIssues';
export const GithubMetric = ({
className,
data,
@ -39,9 +38,9 @@ export const GithubMetric = ({
<div className={cn('flex flex-col', className)} {...props}>
<h3 className="px-4 text-lg font-semibold">{title}</h3>
<div className="border-border mt-2.5 flex flex-1 items-center justify-center rounded-2xl border shadow-sm hover:shadow">
<div className="border-border mt-2.5 flex flex-1 items-center justify-center rounded-2xl border pr-2 shadow-sm hover:shadow">
<ResponsiveContainer width="100%" height={chartHeight}>
<BarChart data={formattedData} margin={{ top: 40, right: 20 }}>
<BarChart data={formattedData} margin={{ top: 30, right: 20 }}>
<XAxis dataKey="month" />
<YAxis />
<Tooltip