Skip to content

Commit

Permalink
chore: resolve git to take account of the case in folders
Browse files Browse the repository at this point in the history
  • Loading branch information
vutuanlinh2k2 committed Jul 20, 2023
1 parent 2c61089 commit 437c7e8
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 0 deletions.
65 changes: 65 additions & 0 deletions apps/hubble-stats/components/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { FC } from 'react';
import {
ResponsiveContainer,
AreaChart as AreaChartCmp,
Area,
Tooltip,
XAxis,
} from 'recharts';
import { AreaChartProps } from './types';

const AreaChart: FC<AreaChartProps> = ({
data,
setDate,
setValue,
isDarkMode,
width = '100%',
height = 180,
}) => {
return (
<ResponsiveContainer width={width} height={height}>
<AreaChartCmp
data={data}
onMouseLeave={() => {
setDate && setDate(null);
setValue && setValue(null);
}}
>
<XAxis
dataKey="date"
tickFormatter={(date) =>
new Date(date).toLocaleDateString('en-US', {
day: 'numeric',
})
}
strokeOpacity={0}
tick={{
fontSize: '16px',
fill: '#9CA0B0',
fontWeight: 400,
}}
tickMargin={16}
/>
<Tooltip
contentStyle={{ display: 'none' }}
content={({ active, payload }) => {
if (active && payload && payload.length) {
setValue && setValue(payload[0].payload['value']);
setDate && setDate(payload[0].payload['date']);
}

return null;
}}
/>
<Area
dataKey="value"
stroke={isDarkMode ? '#C6BBFA' : '#624FBE'}
fillOpacity={0}
strokeWidth={2}
/>
</AreaChartCmp>
</ResponsiveContainer>
);
};

export default AreaChart;
1 change: 1 addition & 0 deletions apps/hubble-stats/components/AreaChart/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as AreaChart } from './AreaChart';
8 changes: 8 additions & 0 deletions apps/hubble-stats/components/AreaChart/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type AreaChartProps = {
data: any;
setValue: (value: number | null) => void;
setDate: (date: Date | null) => void;
isDarkMode: boolean;
width?: number | string;
height?: number | string;
};
60 changes: 60 additions & 0 deletions apps/hubble-stats/components/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { FC } from 'react';
import {
ResponsiveContainer,
BarChart as BarChartCmp,
XAxis,
Tooltip,
Bar,
} from 'recharts';
import { BarChartProps } from './types';

const BarChart: FC<BarChartProps> = ({
data,
setValue,
setDate,
isDarkMode,
width = '100%',
height = 180,
}) => {
return (
<ResponsiveContainer width={width} height={height}>
<BarChartCmp
data={data}
onMouseLeave={() => {
setValue && setValue(null);
setDate && setDate(null);
}}
>
<XAxis
dataKey="date"
tickFormatter={(date) =>
new Date(date).toLocaleDateString('en-US', {
day: 'numeric',
})
}
strokeOpacity={0}
tick={{
fontSize: '16px',
fill: '#9CA0B0',
fontWeight: 400,
}}
tickMargin={16}
/>
<Tooltip
contentStyle={{ display: 'none' }}
content={({ active, payload }) => {
if (active && payload && payload.length) {
setValue && setValue(payload[0].payload['value']);
setDate && setDate(payload[0].payload['date']);
}

return null;
}}
/>
<Bar dataKey="value" fill={isDarkMode ? '#81B3F6' : '#3D7BCE'} />
</BarChartCmp>
</ResponsiveContainer>
);
};

export default BarChart;
1 change: 1 addition & 0 deletions apps/hubble-stats/components/BarChart/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as BarChart } from './BarChart';
8 changes: 8 additions & 0 deletions apps/hubble-stats/components/BarChart/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type BarChartProps = {
data: any;
setValue: (value: number | null) => void;
setDate: (date: Date | null) => void;
isDarkMode: boolean;
width?: number | string;
height?: number | string;
};

0 comments on commit 437c7e8

Please sign in to comment.