Skip to content

Commit d779266

Browse files
authored
Merge pull request #101 from navikt/move-fullscreen-button
Move fullscreen button
2 parents a6c6b9a + 76ac7ca commit d779266

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

xp-archive/client/content/Content.module.css

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
display: flex;
1212
justify-content: space-between;
1313
gap: 1.5rem;
14+
align-items: flex-end;
1415
}
1516

1617
.versionSelector {
@@ -21,3 +22,8 @@
2122
.versionButton {
2223
background-color: white;
2324
}
25+
26+
.viewSelectorWrapper {
27+
display: flex;
28+
gap: 1rem;
29+
}

xp-archive/client/content/Content.tsx

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react';
2-
import { SidebarRightIcon } from '@navikt/aksel-icons';
2+
import { ExternalLinkIcon, SidebarRightIcon } from '@navikt/aksel-icons';
33
import { xpArchiveConfig } from '@common/shared/siteConfigs';
44
import { Button, Detail, Heading, Label } from '@navikt/ds-react';
55
import { useFetchContent } from '../hooks/useFetchContent';
@@ -63,6 +63,10 @@ export const Content = () => {
6363
setSelectedView(getDefaultView(isWebpage, hasAttachment));
6464
}, [isWebpage, hasAttachment, selectedContentId]);
6565

66+
const htmlPath = `${xpArchiveConfig.basePath}/html/${selectedContentId}/${selectedLocale}/${
67+
data?.json._versionKey
68+
}`;
69+
6670
const getVersionDisplay = () => {
6771
if (selectedVersion && data?.versions) {
6872
return formatTimestamp(
@@ -84,13 +88,28 @@ export const Content = () => {
8488
<Heading size={'medium'} level={'2'} spacing>
8589
{data?.json.displayName ?? ''}
8690
</Heading>
87-
<ViewSelector
88-
selectedView={selectedView}
89-
setSelectedView={setSelectedView}
90-
hasAttachment={hasAttachment}
91-
isWebpage={isWebpage}
92-
/>
91+
<div className={style.viewSelectorWrapper}>
92+
<ViewSelector
93+
selectedView={selectedView}
94+
setSelectedView={setSelectedView}
95+
hasAttachment={hasAttachment}
96+
isWebpage={isWebpage}
97+
/>
98+
<Button
99+
as={'a'}
100+
href={htmlPath}
101+
icon={<ExternalLinkIcon />}
102+
iconPosition={'right'}
103+
onClick={(e) => {
104+
e.preventDefault();
105+
window.open(htmlPath, '_blank');
106+
}}
107+
>
108+
{'Åpne i nytt vindu'}
109+
</Button>
110+
</div>
93111
</div>
112+
94113
<div className={style.versionSelector}>
95114
<Label spacing>Versjoner</Label>
96115
<Button

xp-archive/client/contentView/htmlView/HtmlView.module.css

-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
border: none;
1111
}
1212

13-
.fullscreenButton {
14-
position: absolute;
15-
bottom: 0.25rem;
16-
right: 1.5rem;
17-
}
18-
1913
.loaderWrapper {
2014
position: absolute;
2115
margin: 1rem;

xp-archive/client/contentView/htmlView/HtmlView.tsx

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, { useState } from 'react';
22
import style from './HtmlView.module.css';
3-
import { ExpandIcon } from '@navikt/aksel-icons';
43
import { xpArchiveConfig } from '@common/shared/siteConfigs';
5-
import { Button, Loader } from '@navikt/ds-react';
4+
import { Loader } from '@navikt/ds-react';
65

76
type Props = {
87
nodeId: string;
@@ -33,18 +32,6 @@ export const HtmlView = ({ nodeId, locale: langLocale, versionId }: Props) => {
3332
disableLinksScriptsAndEventListeners(e.currentTarget);
3433
}}
3534
/>
36-
<Button
37-
as={'a'}
38-
href={htmlPath}
39-
className={style.fullscreenButton}
40-
icon={<ExpandIcon />}
41-
onClick={(e) => {
42-
e.preventDefault();
43-
window.open(htmlPath, '_blank');
44-
}}
45-
>
46-
{'Åpne i nytt vindu'}
47-
</Button>
4835
</div>
4936
);
5037
};

0 commit comments

Comments
 (0)