Skip to content

Commit

Permalink
Vaihdettu tekstikomponenti OphTypographyyn
Browse files Browse the repository at this point in the history
  • Loading branch information
hajoa committed Dec 10, 2024
1 parent b9abc09 commit a3eb81e
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 127 deletions.
3 changes: 2 additions & 1 deletion src/maksut-ui/app/[locale]/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import ErrorPanel from '@/app/components/ErrorPanel';
import { useTranslations } from 'use-intl';
import { OphTypography } from '@opetushallitus/oph-design-system';

export default function Error() {
const t = useTranslations('Error');
return (
<ErrorPanel>
<h2>{t('header')}</h2>
<OphTypography variant={'h2'}>{t('header')}</OphTypography>
</ErrorPanel>
);
}
3 changes: 2 additions & 1 deletion src/maksut-ui/app/[locale]/error/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import ErrorPanel from '@/app/components/ErrorPanel';
import { useTranslations } from 'use-intl';
import { OphTypography } from '@opetushallitus/oph-design-system';

export default function ErrorPage() {
const t = useTranslations('PaymentError');

return (
<ErrorPanel>
<h2>{t('header')}</h2>
<OphTypography variant={'h2'}>{t('header')}</OphTypography>
</ErrorPanel>
);
}
4 changes: 2 additions & 2 deletions src/maksut-ui/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { NextIntlClientProvider } from 'next-intl';
import { getMessages } from 'next-intl/server';
import { TopBar } from '@/app/components/TopBar';
import { Locale } from '@/app/lib/types';
import { OphLanguage } from '@opetushallitus/oph-design-system';
import { OphLanguage, ophColors } from '@opetushallitus/oph-design-system';

export const metadata: Metadata = {
title: 'Maksut',
Expand All @@ -28,7 +28,7 @@ export default async function LocaleLayout({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
backgroundColor: '#F6F6F6',
backgroundColor: ophColors.grey50,
};

return (
Expand Down
7 changes: 4 additions & 3 deletions src/maksut-ui/app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { getTranslations } from 'next-intl/server';
import ErrorPanel from '@/app/components/ErrorPanel';
import { OphTypography } from '@opetushallitus/oph-design-system';

export default async function NotFound() {
const t = await getTranslations('NotFound');

return (
<ErrorPanel>
<h2>{t('header')}</h2>
<span>{t('body1')}</span>
<span>{t('body2')}</span>
<OphTypography variant={'h2'}>{t('header')}</OphTypography>
<OphTypography>{t('body1')}</OphTypography>
<OphTypography>{t('body2')}</OphTypography>
</ErrorPanel>
);
}
3 changes: 2 additions & 1 deletion src/maksut-ui/app/components/AlertIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Image from 'next/image';
import { Box } from '@mui/material';
import { ophColors } from '@opetushallitus/oph-design-system';

const AlertIcon = () => {
return (
<Box
style={{
backgroundColor: '#cc2f1b',
backgroundColor: ophColors.orange3,
borderRadius: '50%',
width: '60px',
height: '60px',
Expand Down
11 changes: 6 additions & 5 deletions src/maksut-ui/app/components/AstuPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useLocale, useTranslations } from 'use-intl';
import { translateLocalizedString } from '@/app/lib/utils';
import Panel from '@/app/components/Panel';
import MaksaButton from '@/app/components/MaksaButton';
import { OphTypography } from '@opetushallitus/oph-design-system';

const AstuPanel = ({ lasku }: { lasku: Lasku }) => {
const t = useTranslations('AstuPanel');
Expand All @@ -16,28 +17,28 @@ const AstuPanel = ({ lasku }: { lasku: Lasku }) => {
if (lasku.status === 'paid') {
return (
<>
<span>{t('päätösMaksettu')}</span>
<span>{tMaksut('yhteiskäytto')}</span>
<OphTypography>{t('päätösMaksettu')}</OphTypography>
<OphTypography>{tMaksut('yhteiskäytto')}</OphTypography>
</>
);
} else {
return (
<>
<span>{t('päätösMaksamatta')}</span>
<OphTypography>{t('päätösMaksamatta')}</OphTypography>
</>
);
}
};

return (
<Panel>
<h2>
<OphTypography variant={'h2'}>
{translateLocalizedString(
lasku.metadata?.form_name,
locale,
'ASTU lomake',
)}
</h2>
</OphTypography>
{stateText()}
<Maksu lasku={lasku} />
<MaksaButton lasku={lasku}></MaksaButton>
Expand Down
10 changes: 5 additions & 5 deletions src/maksut-ui/app/components/ExpiredPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

import ErrorPanel from '@/app/components/ErrorPanel';
import { useTranslations } from 'use-intl';
import { OphLink } from '@opetushallitus/oph-design-system';
import { OphLink, OphTypography } from '@opetushallitus/oph-design-system';

const ExpiredPanel = ({ contact }: { contact: string | undefined }) => {
const t = useTranslations('ExpiredPanel');

return (
<ErrorPanel>
<h2>{t('header')}</h2>
<span>{t('body1')}</span>
<span>
<OphTypography variant={'h2'}>{t('header')}</OphTypography>
<OphTypography>{t('body1')}</OphTypography>
<OphTypography>
{t('body2')}
<OphLink href={`mailto:${contact}`}>{contact}</OphLink>.
</span>
</OphTypography>
</ErrorPanel>
);
};
Expand Down
7 changes: 5 additions & 2 deletions src/maksut-ui/app/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Box } from '@mui/material';
import { Lasku } from '@/app/lib/types';
import { getTranslations } from 'next-intl/server';
import { OphTypography } from '@opetushallitus/oph-design-system';

const Header = async ({ lasku }: { lasku: Lasku }) => {
const t = await getTranslations('Header');

return (
<Box style={{ textAlign: 'center' }}>
<h3>{`${lasku.first_name} ${lasku.last_name}`}</h3>
<h1>{t('title')}</h1>
<OphTypography
variant={'h3'}
>{`${lasku.first_name} ${lasku.last_name}`}</OphTypography>
<OphTypography variant={'h1'}>{t('title')}</OphTypography>
</Box>
);
};
Expand Down
31 changes: 16 additions & 15 deletions src/maksut-ui/app/components/KkHakemusmaksuPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useLocale, useTranslations } from 'use-intl';
import Panel from '@/app/components/Panel';
import MaksaButton from '@/app/components/MaksaButton';
import { translateLocalizedString } from '@/app/lib/utils';
import { OphTypography } from '@opetushallitus/oph-design-system';

const KkHakemusmaksuPanel = ({ lasku }: { lasku: Lasku }) => {
const t = useTranslations('KkHakemusmaksuPanel');
Expand All @@ -22,9 +23,9 @@ const KkHakemusmaksuPanel = ({ lasku }: { lasku: Lasku }) => {
const aloituskausiHeader = (aloitusvuosi?: number, aloituskausi?: string) => {
if (aloitusvuosi && aloituskausi) {
return (
<h3 style={{ margin: 0 }}>
<OphTypography variant={'h3'} style={{ margin: 0 }}>
{t('aloituskausi')}: {aloituskausiText(aloitusvuosi, aloituskausi)}
</h3>
</OphTypography>
);
}
return null;
Expand All @@ -34,58 +35,58 @@ const KkHakemusmaksuPanel = ({ lasku }: { lasku: Lasku }) => {
if (lasku.status === 'paid') {
return (
<>
<span>{t('maksettu')}</span>
<span>
<OphTypography>{t('maksettu')}</OphTypography>
<OphTypography>
{t('maksettu2')}{' '}
{aloituskausiText(
lasku.metadata?.alkamisvuosi,
lasku.metadata?.alkamiskausi,
)}
. {t('maksettu3')}
</span>
<span>{t('maksettu4')}</span>
<span>{tMaksut('yhteiskäytto')}</span>
</OphTypography>
<OphTypography>{t('maksettu4')}</OphTypography>
<OphTypography>{tMaksut('yhteiskäytto')}</OphTypography>
</>
);
} else if (lasku.status === 'overdue') {
return (
<>
<span>{t('eraantynyt')}</span>
<OphTypography>{t('eraantynyt')}</OphTypography>
</>
);
} else if (lasku.status === 'invalidated') {
return (
<>
<span>
<OphTypography>
{t('mitatoity')}{' '}
{aloituskausiText(
lasku.metadata?.alkamisvuosi,
lasku.metadata?.alkamiskausi,
)}
. {t('mitatoity2')}
</span>
<span>{tMaksut('yhteiskäytto')}</span>
</OphTypography>
<OphTypography>{tMaksut('yhteiskäytto')}</OphTypography>
</>
);
} else {
return (
<>
<span>{t('maksamatta')}</span>
<span>{t('maksamatta2')}</span>
<OphTypography>{t('maksamatta')}</OphTypography>
<OphTypography>{t('maksamatta2')}</OphTypography>
</>
);
}
};

return (
<Panel>
<h2 style={{ margin: 0 }}>
<OphTypography variant={'h2'} style={{ margin: 0 }}>
{translateLocalizedString(
lasku.metadata?.haku_name,
locale,
'Hakemusmaksu',
)}
</h2>
</OphTypography>
{aloituskausiHeader(
lasku.metadata?.alkamisvuosi,
lasku.metadata?.alkamiskausi,
Expand Down
1 change: 1 addition & 0 deletions src/maksut-ui/app/components/MaksaButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const MaksaButton = ({ lasku }: { lasku: Lasku }) => {
return (
<OphButton
variant={'contained'}
target={'_self'}
href={`${backendUrl}/lasku/${lasku.order_id}/maksa?secret=${lasku.secret}&locale=${locale}`}
>
{t('maksa')}
Expand Down
18 changes: 10 additions & 8 deletions src/maksut-ui/app/components/Maksu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Lasku, PaymentStatus } from '@/app/lib/types';
import { useTranslations } from 'use-intl';
import { Box, useTheme } from '@mui/material';
import { ophColors } from '@opetushallitus/oph-design-system';
import { ophColors, OphTypography } from '@opetushallitus/oph-design-system';
import { ReactNode } from 'react';
import { BigNumber } from 'bignumber.js';

Expand Down Expand Up @@ -36,14 +36,14 @@ const StatusRow = ({ status }: { status: PaymentStatus }) => {

return (
<>
<span
<OphTypography
style={{
textAlign: 'left',
margin: theme.spacing(1.5, 2, 1.5, 0),
}}
>
{t('tila')}
</span>
</OphTypography>
<Box
style={{
padding: theme.spacing(0.5, 1, 0.5, 1),
Expand Down Expand Up @@ -96,23 +96,23 @@ const MaksuRow = ({

return (
<>
<span
<OphTypography
style={{
textAlign: 'left',
margin: theme.spacing(1, 2, 1, 0),
}}
>
{name}
</span>
<span
</OphTypography>
<OphTypography
style={{
textAlign: 'right',
margin: theme.spacing(1, 0, 1, 2),
fontWeight: bold ? 'bold' : 'initial',
}}
>
{value}
</span>
</OphTypography>
</>
);
};
Expand Down Expand Up @@ -154,7 +154,9 @@ const Maksu = ({ lasku }: { lasku: Lasku }) => {
textAlign: 'center',
}}
>
<h4 style={{ margin: theme.spacing(1) }}>{title()}</h4>
<OphTypography variant={'h4'} style={{ margin: theme.spacing(1) }}>
{title()}
</OphTypography>
<Box
style={{
display: 'grid',
Expand Down
1 change: 0 additions & 1 deletion src/maksut-ui/app/components/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const Panel = ({ children }: { children: ReactNode }) => {
display: 'flex',
flexDirection: 'column',
maxWidth: '1200px',
minWidth: '800px',
filter: 'drop-shadow(0 1px 3px rgba(0,0,0,0.30))',
padding: theme.spacing(2, 4),
}}
Expand Down
2 changes: 1 addition & 1 deletion src/maksut-ui/app/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const TopBar = ({ lang }: { lang?: Locale }) => {
const theme = useTheme();
return (
<AppBar position="static" style={{ padding: theme.spacing(3, 0) }}>
<Box style={{ margin: 'auto', width: '1000px' }}>
<Box style={{ margin: 'auto', maxWidth: '1000px' }}>
<Image
src={`/maksut-ui/opintopolku_logo_header_${lang || 'fi'}.svg`}
alt="Opintopolku"
Expand Down
Loading

0 comments on commit a3eb81e

Please sign in to comment.