-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppendix2.jsx
More file actions
88 lines (78 loc) · 2.4 KB
/
Appendix2.jsx
File metadata and controls
88 lines (78 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* eslint-disable react/no-danger */
import React, { Fragment } from 'react'
import { Col, Row } from 'reactstrap'
import { PageHeading } from '@kth/kth-reactstrap/dist/components/studinfo'
import { useStore } from '../mobx'
import translate from '../../../../domain/translate'
import { formatLongTerm } from '../../../../domain/term'
import Article from '../components/Article'
import FooterContent from '../components/FooterContent'
import LadokData from '../components/LadokData'
import Sidebar from '../components/Sidebar'
function Specializations() {
const { language, specializations } = useStore()
const t = translate(language)
if (!specializations.length) return <p>{t('programme_appendix2_empty')}</p>
return specializations.map(({ code, title, description }) => {
const heading = `${title} (${code})`
return (
<div key={`div-${heading}`} className="page-break-inside">
<h2 key={heading}>{heading}</h2>
{description ? (
<LadokData key={`ladok-data-${heading}`} html={description} />
) : (
<p key="empty" className="font-italic">
{t('programme_appendix2_empty_description')}
</p>
)}
</div>
)
})
}
export function Appendix2PDFExport() {
return (
<>
<Row key="data-area-row">
<Col key="article-specializations">
<Article uiKey="article">
<Specializations key="specializations-appendix-2" />
</Article>
</Col>
</Row>
</>
)
}
function Appendix2() {
const { language, programmeName, programmeCode, term } = useStore()
const t = translate(language)
const pageHeading = t('programme_appendix2')
const subHeading = `${t('programme_admitted_year')} ${formatLongTerm(
term,
language
)}, ${programmeName} (${programmeCode})`
return (
<>
<Row key="page-heading-row-appendix-2">
<Col>
<PageHeading subHeading={subHeading}>{pageHeading}</PageHeading>
</Col>
</Row>
<Row key="data-area-row">
<Col key="article-specializations">
<Article uiKey="article">
<Specializations key="specializations-appendix-2" />
</Article>
</Col>
<Col key="sidebar" xs="12" xl="3">
<Sidebar />
</Col>
</Row>
<Row key="footer-row">
<Col>
<FooterContent />
</Col>
</Row>
</>
)
}
export default Appendix2