Skip to content

Commit

Permalink
Støtter expandall-flagg på ReadMore
Browse files Browse the repository at this point in the history
  • Loading branch information
terjeofnorway committed Dec 17, 2024
1 parent f0b1811 commit 99e8506
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/parts/readMorePart/ReadMorePart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { ReadMore } from '@navikt/ds-react';
import { EditorHelp } from 'components/_editor-only/editor-help/EditorHelp';
import { ParsedHtml } from 'components/_common/parsedHtml/ParsedHtml';
Expand Down Expand Up @@ -32,6 +32,13 @@ export const ReadMorePart = ({ config }: PartComponentProps<PartType.ReadMore>)
callback: () => setIsOpen(true),
});

useEffect(() => {
if (window.location.toString().includes('expandall=true')) {
setIsOpen(true);
return;
}
}, []);

if (!config?.html || !config.title) {
return <EditorHelp text={'Legg inn tittel og beskrivelse for "les mer".'} type={'error'} />;
}
Expand Down

0 comments on commit 99e8506

Please sign in to comment.