Skip to content

Commit

Permalink
Skal ha feature toggle for å konvertere delamlblokk til fritekstfelt
Browse files Browse the repository at this point in the history
  • Loading branch information
charliemidtlyng committed Dec 10, 2024
1 parent c360cb5 commit 66757c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/frontend/App/context/toggles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum ToggleName {

// Release-toggles
visEndreDokumenttittelKnapp = 'familie.ef.sak.frontend-endre-dokumenttittel',
konvertereDelmalblokkTilHtmlFelt = 'familie.ef.sak.konverter-delmalblokk-til-html-input',

// Midlertidige toggles - kan fjernes etterhvert
}
16 changes: 13 additions & 3 deletions src/frontend/Komponenter/Behandling/Brev/BrevMenyDelmal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import styled from 'styled-components';
import { Accordion, Button, Checkbox } from '@navikt/ds-react';
import { ABorderRadiusMedium, ABorderStrong } from '@navikt/ds-tokens/dist/tokens';
import HtmlEditor from '../../../Felles/HtmlEditor/HtmlEditor';
import { useToggles } from '../../../App/context/TogglesContext';
import { ToggleName } from '../../../App/context/toggles';

const DelmalValg = styled.div`
display: flex;
Expand Down Expand Up @@ -63,6 +65,10 @@ export const BrevMenyDelmal: React.FC<Props> = ({
overstyring,
}) => {
const { delmalValgfelt, delmalFlettefelter } = delmal;
const { toggles } = useToggles();

const skalKunneKonvertereDelmalblokk = toggles[ToggleName.konvertereDelmalblokkTilHtmlFelt];

const [ekspanderbartPanelÅpen, settEkspanderbartPanelÅpen] = useState(false);

const handleFlettefeltInput = (verdi: string, flettefelt: Flettefeltreferanse) => {
Expand Down Expand Up @@ -155,8 +161,11 @@ export const BrevMenyDelmal: React.FC<Props> = ({
key={flettefelt._ref}
/>
))}
{erDelmalblokk && (
<Button onClick={() => overstyring.konverterTilHtml(delmal)}>
{erDelmalblokk && skalKunneKonvertereDelmalblokk && (
<Button
onClick={() => overstyring.konverterTilHtml(delmal)}
size={'small'}
>
Konverter til tekstfelt
</Button>
)}
Expand All @@ -170,8 +179,9 @@ export const BrevMenyDelmal: React.FC<Props> = ({
/>
<Button
onClick={() => overstyring.konverterTilDelmalblokk(delmal)}
size={'small'}
>
Konverter tilbake
Konverter til brevbygger
</Button>
</>
)}
Expand Down

0 comments on commit 66757c4

Please sign in to comment.