Skip to content

Commit

Permalink
feat: make latin italic
Browse files Browse the repository at this point in the history
  • Loading branch information
friedjoff committed Sep 14, 2020
1 parent c9b1b0f commit d49296e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
33 changes: 21 additions & 12 deletions src/components/ForestTypeDescription/VegetationTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ import { Table } from 'semantic-ui-react';
// eslint-disable-next-line import/no-unresolved
import { info, list, vegetation } from 'lib/src';

const concat = (prev, cur) => [prev, ', ', cur];

function VegetationTab({ data }) {
const { i18n, t } = useTranslation();
const location = { forestType: data.code };
const treeList = list(location);
const vegInfo = vegetation(location);
const [t1, t2, t3] = list(location);
const vegetationInfo = vegetation(location);
const [b1, b2] = vegetationInfo.bush;
const [h1, h2] = vegetationInfo.herb;
const [m1, m2] = vegetationInfo.moss;

const getInfo = (type) => (typeCode) => {
const typeInfo = info(type, typeCode);
return `${typeInfo[i18n.language]} (${typeInfo.la})`;
return (
<>
{typeInfo[i18n.language]} (<i>{typeInfo.la}</i>)
</>
);
};

return (
Expand Down Expand Up @@ -50,67 +59,67 @@ function VegetationTab({ data }) {
<Table.Row>
<Table.HeaderCell>{t('projection.treeTypesOne')}</Table.HeaderCell>
<Table.Cell colSpan="3">
{treeList[0].map(getInfo('treeType')).join(', ') || '-'}
{t1.map(getInfo('treeType')).reduce(concat) || '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>{t('projection.treeTypesTwo')}</Table.HeaderCell>
<Table.Cell colSpan="3">
{treeList[1].map(getInfo('treeType')).join(', ') || '-'}
{t2.map(getInfo('treeType')).reduce(concat) || '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>{t('projection.treeTypesThree')}</Table.HeaderCell>
<Table.Cell colSpan="3">
{treeList[2].map(getInfo('treeType')).join(', ') || '-'}
{t3.map(getInfo('treeType')).reduce(concat) || '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>
{t('forestType.bush')} {t('forestType.often')}
</Table.HeaderCell>
<Table.Cell colSpan="3">
{vegInfo.bush[0].map(getInfo('bushType')).join(', ') || '-'}
{b1.length ? b1.map(getInfo('bushType')).reduce(concat) : '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>
{t('forestType.bush')} {t('forestType.rare')}
</Table.HeaderCell>
<Table.Cell colSpan="3">
{vegInfo.bush[1].map(getInfo('bushType')).join(', ') || '-'}
{b2.length ? b2.map(getInfo('bushType')).reduce(concat) : '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>
{t('forestType.herb')} {t('forestType.often')}
</Table.HeaderCell>
<Table.Cell colSpan="3">
{vegInfo.herb[0].map(getInfo('herbType')).join(', ') || '-'}
{h1.length ? h1.map(getInfo('herbType')).reduce(concat) : '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>
{t('forestType.herb')} {t('forestType.rare')}
</Table.HeaderCell>
<Table.Cell colSpan="3">
{vegInfo.herb[1].map(getInfo('herbType')).join(', ') || '-'}
{h2.length ? h2.map(getInfo('herbType')).reduce(concat) : '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>
{t('forestType.moss')} {t('forestType.often')}
</Table.HeaderCell>
<Table.Cell colSpan="3">
{vegInfo.moss[0].map(getInfo('mossType')).join(', ') || '-'}
{m1.length ? m1.map(getInfo('mossType')).reduce(concat) : '-'}
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.HeaderCell>
{t('forestType.moss')} {t('forestType.rare')}
</Table.HeaderCell>
<Table.Cell colSpan="3">
{vegInfo.moss[1].map(getInfo('mossType')).join(', ') || '-'}
{m2.length ? m2.map(getInfo('mossType')).reduce(concat) : '-'}
</Table.Cell>
</Table.Row>
</Table.Body>
Expand Down
6 changes: 5 additions & 1 deletion src/components/ForestTypeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ function ForestTypeModal({ compact, data, setIsForestTypeModalOpen }) {
<ForestTypeDescription data={data} />
</Modal.Content>
}
header={`${data.code} - ${data[i18n.language]} (${data.la})`}
header={
<Modal.Header>
{data.code} - {data[i18n.language]} (<i>{data.la}</i>)
</Modal.Header>
}
onClose={() => setIsForestTypeModalOpen(false)}
onOpen={() => setIsForestTypeModalOpen(true)}
trigger={<Button active compact={compact} icon="info" />}
Expand Down

0 comments on commit d49296e

Please sign in to comment.