import React, { useState } from 'react';
|
import { Typography, Card } from 'antd';
|
import WageForm from '../components/tools/WageForm';
|
import WageResultPanel from '../components/tools/WageResultPanel';
|
import { calculateUnpaidSalary } from '../utils/wageCalculator';
|
|
const { Title } = Typography;
|
|
const WageCalculatorPage = () => {
|
const [result, setResult] = useState(null);
|
|
const handleCalculate = (input) => {
|
const calcResult = calculateUnpaidSalary(input);
|
setResult(calcResult);
|
};
|
|
const handleReset = () => {
|
setResult(null);
|
};
|
|
return (
|
<div>
|
<Title level={3}>欠薪计算器</Title>
|
<Card style={{ marginBottom: 16 }} title="填写欠薪信息">
|
<WageForm onCalculate={handleCalculate} onReset={handleReset} />
|
</Card>
|
|
<Card title="计算结果">
|
<WageResultPanel result={result} />
|
</Card>
|
</div>
|
);
|
};
|
|
export default WageCalculatorPage;
|