diff --git a/src/advanced-calculator/Pension/index.tsx b/src/advanced-calculator/Pension/index.tsx index 8ed7ccc45..95b682375 100644 --- a/src/advanced-calculator/Pension/index.tsx +++ b/src/advanced-calculator/Pension/index.tsx @@ -1,27 +1,30 @@ -import { ONE_G } from '../config'; - import PensionGraph from '../Graphs/PensionGraph'; import RangeSlider from '../Components/RangeSlider'; import { useState } from 'react'; import style from '../calculator.module.css'; -import {Heading3} from "@components/heading"; - -const SEVEN_POINT_ONE_G = ONE_G * 7.1; -// const TWELVE_G = ONE_G * 12; - -const differenceWhenGreaterThan7G = (salary: number) => { - const difference = Math.floor(salary - SEVEN_POINT_ONE_G); - return Math.sign(difference) > 0 ? difference : 0; -}; - -export default function Pension({ yearlySalary }: { yearlySalary: number }) { +import { Heading3 } from '@components/heading'; + +export default function Pension({ + yearlySalary, + oneG, +}: { + yearlySalary: number; + oneG: number; +}) { const [compareSalary, setCompareSalary] = useState(500000); const [comparePensionPercentage, setComparePensionChange] = useState({ below7G: 5, above7G: 5, }); + const sevenG = oneG * 7.1; + + function differenceWhenGreaterThan7G(salary: number) { + const difference = Math.floor(salary - sevenG); + return Math.sign(difference) > 0 ? difference : 0; + } + function handleOnCompareSalaryChange(value: number) { setCompareSalary(value); } @@ -72,9 +75,7 @@ export default function Pension({ yearlySalary }: { yearlySalary: number }) {