Skip to content

Commit

Permalink
🔥 Fjerner siste rest av rhf
Browse files Browse the repository at this point in the history
Co-authored-by: Øivind Stensrud <[email protected]>
Co-authored-by: Tor Idland <[email protected]>
Co-authored-by: Halvor Grizzly Bjørn <[email protected]>
  • Loading branch information
4 people authored Oct 20, 2023
2 parents c4a8bcc + 83cee6f commit f15c250
Show file tree
Hide file tree
Showing 37 changed files with 98 additions and 1,192 deletions.
53 changes: 24 additions & 29 deletions components/SoknadFormWrapper/SoknadFormWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,43 @@
import { FieldErrors } from 'react-hook-form';
import React, { useState } from 'react';
import { Button, Detail } from '@navikt/ds-react';
import { FormErrorSummary } from '../schema/FormErrorSummary';
import * as classes from './SoknadFormWrapper.module.css';
import { useAppStateContext } from 'context/appStateContext';
import { FormErrorSummary, SøknadValidationError } from 'components/schema/FormErrorSummary';
import { useIntl } from 'react-intl';
import SlettModal from './SlettModal';
import LagreModal from './LagreModal';
import SlettModal from './SlettModal';

interface Props {
children?: React.ReactNode;
nextButtonText: string;
backButtonText?: string;
cancelButtonText: string;
onNext: (data: any) => void;
children: React.ReactNode;
onNext: () => void;
onBack?: () => void;
onDelete: () => Promise<any>;
nextButtonText?: string;
nextIsLoading?: boolean;
focusOnErrors?: boolean;
errors?: FieldErrors;
errors?: SøknadValidationError[];
className?: string;
}

const SøknadFormWrapper = ({
children,
nextButtonText,
backButtonText,
onNext,
onBack,
errors,
nextIsLoading = false,
className = '',
}: Props) => {
const SøknadFormWrapper = (props: Props) => {
const { formatMessage } = useIntl();
const {
children,
onNext,
onBack,
errors,
nextButtonText = formatMessage({ id: 'navigation.next' }),
nextIsLoading = false,
className,
} = props;
const { appState } = useAppStateContext();
const [showLagreModal, setShowLagreModal] = useState<boolean>(false);
const [showAvbrytModal, setShowAvbrytModal] = useState<boolean>(false);
const [visLagreModal, setVisLagreModal] = useState<boolean>(false);
const [visAvbrytModal, setVisAvbrytModal] = useState<boolean>(false);

return (
<>
<form
onSubmit={(event) => {
event.preventDefault();
onNext(event);
onNext();
}}
className={`${classes?.formContent} ${className}`}
>
Expand All @@ -56,7 +51,7 @@ const SøknadFormWrapper = ({
type="button"
onClick={onBack}
>
{backButtonText}
{formatMessage({ id: 'navigation.back' })}
</Button>
)}
<Button
Expand All @@ -79,22 +74,22 @@ const SøknadFormWrapper = ({
className={classes?.buttonSave}
variant="tertiary"
type="button"
onClick={() => setShowLagreModal(true)}
onClick={() => setVisLagreModal(true)}
>
{formatMessage({ id: 'navigation.save' })}
</Button>
<Button
className={classes?.buttonCancel}
variant="tertiary"
type="button"
onClick={() => setShowAvbrytModal(true)}
onClick={() => setVisAvbrytModal(true)}
>
{formatMessage({ id: 'navigation.cancel' })}
</Button>
</div>
</form>
<LagreModal isOpen={showLagreModal} onClose={(value) => setShowLagreModal(value)} />
<SlettModal isOpen={showAvbrytModal} onClose={(value) => setShowAvbrytModal(value)} />
<LagreModal isOpen={visLagreModal} onClose={(value) => setVisLagreModal(value)} />
<SlettModal isOpen={visAvbrytModal} onClose={(value) => setVisAvbrytModal(value)} />
</>
);
};
Expand Down
96 changes: 0 additions & 96 deletions components/SoknadFormWrapper/SoknadFormWrapperNew.tsx

This file was deleted.

77 changes: 0 additions & 77 deletions components/input/CheckboxGroupWrapper.test.tsx

This file was deleted.

37 changes: 0 additions & 37 deletions components/input/CheckboxGroupWrapper.tsx

This file was deleted.

78 changes: 0 additions & 78 deletions components/input/ConfirmationPanelWrapper.test.tsx

This file was deleted.

Loading

0 comments on commit f15c250

Please sign in to comment.