1
1
import React , { useEffect , useState } from 'react' ;
2
+ import { ExternalLinkIcon } from '@navikt/aksel-icons' ;
3
+ import { useAppState } from 'client/context/app-state/useAppState' ;
2
4
import { CmsContent } from '../../../../shared/cms-documents/content' ;
3
5
import { XmlView } from './xml-view/XmlView' ;
4
6
import { HtmlView } from './html-view/HtmlView' ;
5
7
import { FilesView } from './files-view/FilesView' ;
6
8
import { ViewSelector , ViewState } from '../view-selector/ViewSelector' ;
7
9
import { VersionSelector } from './version-selector/VersionSelector' ;
8
- import { Heading } from '@navikt/ds-react' ;
10
+ import { Button , Heading } from '@navikt/ds-react' ;
9
11
import { CategoriesPath } from '../../common/categories-path/CategoriesPath' ;
10
12
import { PdfExporter } from './pdf-exporter/PdfExporter' ;
11
13
@@ -23,6 +25,9 @@ export const ContentView = ({ content }: Props) => {
23
25
setViewState ( getDefaultViewState ( content ) ) ;
24
26
} , [ content ] ) ;
25
27
28
+ const { appContext } = useAppState ( ) ;
29
+ const fullscreenPath = `${ appContext . basePath } /html/${ versionKey } ` ;
30
+
26
31
return (
27
32
< >
28
33
< CategoriesPath path = { content . path } className = { style . path } />
@@ -31,11 +36,28 @@ export const ContentView = ({ content }: Props) => {
31
36
< Heading size = { 'medium' } level = { '2' } className = { style . header } >
32
37
{ content . displayName }
33
38
</ Heading >
34
- < ViewSelector
35
- content = { content }
36
- viewState = { viewState }
37
- setViewState = { setViewState }
38
- />
39
+ < div className = { style . viewSelectorWrapper } >
40
+ < ViewSelector
41
+ content = { content }
42
+ viewState = { viewState }
43
+ setViewState = { setViewState }
44
+ />
45
+ < Button
46
+ size = { 'small' }
47
+ variant = { 'primary' }
48
+ as = { 'a' }
49
+ href = { fullscreenPath }
50
+ className = { style . fullscreenButton }
51
+ icon = { < ExternalLinkIcon /> }
52
+ iconPosition = { 'right' }
53
+ onClick = { ( e ) => {
54
+ e . preventDefault ( ) ;
55
+ window . open ( fullscreenPath , '_blank' ) ;
56
+ } }
57
+ >
58
+ { 'Åpne i nytt vindu' }
59
+ </ Button >
60
+ </ div >
39
61
</ div >
40
62
< VersionSelector content = { content } />
41
63
</ div >
0 commit comments