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