Skip to content

Commit 8b71d57

Browse files
committed
Rendrer parts uten descriptors i editoren, med editorhelp
1 parent 4513898 commit 8b71d57

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/components/_editor-only/editor-help/EditorHelp.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ type Props = {
2929
text: string;
3030
globalWarningText?: string;
3131
type?: 'info' | 'error' | 'help' | 'arrowUp' | 'arrowDown';
32-
};
32+
} & React.HTMLAttributes<HTMLDivElement>;
3333

3434
export const EditorHelp = ({
3535
text,
3636
globalWarningText,
3737
type = 'help',
38+
...rest
3839
}: Props) => {
3940
const { pageConfig } = usePageConfig();
4041
const { editorView } = pageConfig;
@@ -52,7 +53,7 @@ export const EditorHelp = ({
5253
}
5354

5455
return (
55-
<div className={style.editorHelp} id={id}>
56+
<div className={style.editorHelp} id={id} {...rest}>
5657
<StaticImage
5758
imageData={imagePath[type]}
5859
alt={''}

src/components/parts/PartsMapper.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,19 @@ const PartComponent = ({ partProps, pageProps }: Props) => {
151151
export const PartsMapper = ({ pageProps, partProps }: Props) => {
152152
const { path, descriptor, config } = partProps;
153153

154-
if (!descriptor) {
155-
return null;
156-
}
157-
158154
const isEditView = pageProps.editorView === 'edit';
159155
const editorProps = isEditView ? buildEditorProps(path) : undefined;
160156

157+
if (!descriptor) {
158+
return (
159+
<EditorHelp
160+
text={'Velg en part-komponent'}
161+
type={'info'}
162+
{...editorProps}
163+
/>
164+
);
165+
}
166+
161167
if (partsDeprecated.has(descriptor)) {
162168
return isEditView ? <div {...editorProps} /> : null;
163169
}

0 commit comments

Comments
 (0)