Skip to content

Commit

Permalink
fix: pension after transition to G-api (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelbr committed Jan 12, 2024
1 parent a6f260d commit 55c8a39
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 189 deletions.
43 changes: 20 additions & 23 deletions src/advanced-calculator/Pension/index.tsx
Original file line number Diff line number Diff line change
@@ -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);
}
Expand Down Expand Up @@ -72,9 +75,7 @@ export default function Pension({ yearlySalary }: { yearlySalary: number }) {
</div>
<div className={style['form-wrapper']}>
<fieldset className={style['form__fieldset']}>
<legend>
Årslønn hos nåverende arbeidsgiver
</legend>
<legend>Årslønn hos nåverende arbeidsgiver</legend>
<RangeSlider
min={500000}
max={1200000}
Expand All @@ -87,9 +88,7 @@ export default function Pension({ yearlySalary }: { yearlySalary: number }) {
</fieldset>

<fieldset className={style['form__fieldset']}>
<legend>
Pensjon, i prosent (mellom 0 til 7.1G)
</legend>
<legend>Pensjon, i prosent (mellom 0 til 7.1G)</legend>
<RangeSlider
min={2}
max={7}
Expand All @@ -102,9 +101,7 @@ export default function Pension({ yearlySalary }: { yearlySalary: number }) {
</fieldset>

<fieldset className={style['form__fieldset']}>
<legend>
Pensjon, i prosent (over 7.1G)
</legend>
<legend>Pensjon, i prosent (over 7.1G)</legend>
<RangeSlider
min={2}
max={25}
Expand All @@ -113,7 +110,7 @@ export default function Pension({ yearlySalary }: { yearlySalary: number }) {
id={'comparePensionAbove7G'}
name="Nåverende pensjon"
onChange={handleOnCompareAbove7GPensionChange}
disabled={compareSalary < SEVEN_POINT_ONE_G}
disabled={compareSalary < sevenG}
/>
</fieldset>

Expand Down
Loading

1 comment on commit 55c8a39

@vercel
Copy link

@vercel vercel bot commented on 55c8a39 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

variant-no – ./

variant-no-git-main-variant1.vercel.app
variant-no-variant1.vercel.app
www.variant.no

Please sign in to comment.