Create new Flutter app
The prompt requests the creation of a new app with a neumorphic design, similar to a household account book, using Flutter.
This commit is contained in:
43
src/components/ExpenseChart.tsx
Normal file
43
src/components/ExpenseChart.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
import React from 'react';
|
||||
import { PieChart, Pie, Cell, ResponsiveContainer, Legend } from 'recharts';
|
||||
|
||||
interface ExpenseData {
|
||||
name: string;
|
||||
value: number;
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface ExpenseChartProps {
|
||||
data: ExpenseData[];
|
||||
}
|
||||
|
||||
const ExpenseChart: React.FC<ExpenseChartProps> = ({ data }) => {
|
||||
return (
|
||||
<div className="neuro-card h-64">
|
||||
<h3 className="text-sm font-medium text-gray-600 mb-3">카테고리별 지출</h3>
|
||||
|
||||
<ResponsiveContainer width="100%" height="85%">
|
||||
<PieChart>
|
||||
<Pie
|
||||
data={data}
|
||||
cx="50%"
|
||||
cy="50%"
|
||||
innerRadius={50}
|
||||
outerRadius={70}
|
||||
paddingAngle={5}
|
||||
dataKey="value"
|
||||
labelLine={false}
|
||||
label={({ name, percent }) => `${name} ${(percent * 100).toFixed(0)}%`}
|
||||
>
|
||||
{data.map((entry, index) => (
|
||||
<Cell key={`cell-${index}`} fill={entry.color} />
|
||||
))}
|
||||
</Pie>
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ExpenseChart;
|
||||
Reference in New Issue
Block a user