add change language button on feed pages

This commit is contained in:
Aarni Halinen
2021-04-04 22:11:24 +03:00
parent a4668b4150
commit 2763b8ee6e
+22 -14
View File
@@ -3,7 +3,7 @@ import Image from "next/image";
import styled from "styled-components";
import colors from "@theme/colors";
import Post from "@models/Feed";
import { TextSection } from "@components/index";
import { TextSection, ChangeLanguageButton } from "@components/index";
import MarkdownStyles from "@views/common/MarkdownStyles";
import LoadingView from "@views/common/LoadingView";
import { useTranslation } from "../../i18n";
@@ -31,6 +31,11 @@ const Content = styled(MarkdownStyles)`
margin-top: 1.5rem;
`;
const LngButton = styled(ChangeLanguageButton)`
align-self: flex-end;
margin-right: 1rem;
`;
const FeedPageView: React.FC<FeedPageViewProps> = ({ post }) => {
const { i18n } = useTranslation();
if (!post) return <LoadingView />;
@@ -45,13 +50,15 @@ const FeedPageView: React.FC<FeedPageViewProps> = ({ post }) => {
};
return (
<StyledTextSection>
<h1>
{title}
<p>
{description}
</p>
{post.image && (
<>
<LngButton />
<StyledTextSection>
<h1>
{title}
<p>
{description}
</p>
{post.image && (
<Image
src={post.image}
alt={title}
@@ -60,12 +67,13 @@ const FeedPageView: React.FC<FeedPageViewProps> = ({ post }) => {
width={16}
height={9}
/>
)}
</h1>
<div>
<Content source={content} escapeHtml={false} />
</div>
</StyledTextSection>
)}
</h1>
<div>
<Content source={content} escapeHtml={false} />
</div>
</StyledTextSection>
</>
);
};
export default FeedPageView;