translate feed page
This commit is contained in:
@@ -6,6 +6,7 @@ import Post from "@models/Feed";
|
||||
import { TextSection } from "@components/index";
|
||||
import MarkdownStyles from "@views/common/MarkdownStyles";
|
||||
import LoadingView from "@views/common/LoadingView";
|
||||
import i18nNext from "../../i18n";
|
||||
|
||||
interface FeedPageViewProps {
|
||||
post?: Post;
|
||||
@@ -32,17 +33,27 @@ const Content = styled(MarkdownStyles)`
|
||||
|
||||
const FeedPageView: React.FC<FeedPageViewProps> = ({ post }) => {
|
||||
if (!post) return <LoadingView />;
|
||||
const { language } = i18nNext.i18n;
|
||||
const isFi = language === "fi";
|
||||
const {
|
||||
title, description, content,
|
||||
} = {
|
||||
title: isFi ? post.title_fi : post.title_en,
|
||||
description: isFi ? post.description_fi : post.description_en,
|
||||
content: isFi ? post.content_fi : post.content_en,
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledTextSection>
|
||||
<h1>
|
||||
{post.title_fi}
|
||||
{title}
|
||||
<p>
|
||||
{post.description_fi}
|
||||
{description}
|
||||
</p>
|
||||
{post.image && (
|
||||
<Image
|
||||
src={post.image}
|
||||
alt={post.title_fi}
|
||||
alt={title}
|
||||
objectFit="scale-down"
|
||||
layout="responsive"
|
||||
width={16}
|
||||
@@ -51,7 +62,7 @@ const FeedPageView: React.FC<FeedPageViewProps> = ({ post }) => {
|
||||
)}
|
||||
</h1>
|
||||
<div>
|
||||
<Content source={post.content_fi} escapeHtml={false} />
|
||||
<Content source={content} escapeHtml={false} />
|
||||
</div>
|
||||
</StyledTextSection>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user