66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
import { useTheme } from "next-themes";
|
|
import { colors } from "@/lib/colors";
|
|
import { useConfig } from "@/hooks/use-config";
|
|
import {
|
|
CartesianGrid,
|
|
XAxis,
|
|
YAxis,
|
|
ResponsiveContainer,
|
|
BarChart,
|
|
Bar,
|
|
Tooltip,
|
|
} from "recharts";
|
|
import { data } from "./data";
|
|
import CustomTooltip from "./custom-tooltip";
|
|
|
|
const NoPaddingBar = ({ height = 300 }) => {
|
|
|
|
const { theme: mode } = useTheme();
|
|
|
|
|
|
return (
|
|
<ResponsiveContainer width="100%" height={height}>
|
|
<BarChart height={height} data={data} barSize={20}>
|
|
<CartesianGrid
|
|
stroke='none'
|
|
strokeDasharray="3 3"
|
|
vertical={false}
|
|
/>
|
|
<XAxis
|
|
dataKey="name"
|
|
tick={{
|
|
fill: mode === 'light' ? colors["default-600"] : colors["default-300"],
|
|
fontSize: "12px",
|
|
}}
|
|
tickLine={false}
|
|
stroke='none'
|
|
axisLine={false}
|
|
scale="point"
|
|
padding={{ left: 10, right: 10 }}
|
|
/>
|
|
<YAxis
|
|
tick={{
|
|
fill: mode === 'light' ? colors["default-600"] : colors["default-300"],
|
|
fontSize: "12px",
|
|
}}
|
|
tickLine={false}
|
|
stroke='none'
|
|
/>
|
|
<Tooltip content={<CustomTooltip />} />
|
|
<Bar
|
|
dataKey="pv"
|
|
fill={colors.warning}
|
|
background={{
|
|
fill: colors.warning,
|
|
}}
|
|
|
|
/>
|
|
</BarChart>
|
|
</ResponsiveContainer>
|
|
);
|
|
};
|
|
|
|
export default NoPaddingBar;
|