Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Mobile layout for post details

Matt Roberts8a82237a0265
diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scss
index 1fa61f958..394ee3e01 100644
--- a/public/pages/ShowPost/ShowPost.page.scss
+++ b/public/pages/ShowPost/ShowPost.page.scss
@@ -55,6 +55,23 @@
&__meta {
display: flex;
align-items: center;
+ flex-wrap: wrap;
+ row-gap: spacing(2);
+
+ &--desktop {
+ @include media("sm") {
+ display: none;
+ }
+ }
+
+ &--mobile {
+ display: none;
+ margin-top: spacing(4);
+
+ @include media("sm") {
+ display: flex;
+ }
+ }
}
&__description-section {
diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsx
index d389bcc0a..b7c8fae80 100644
--- a/public/pages/ShowPost/ShowPost.page.tsx
+++ b/public/pages/ShowPost/ShowPost.page.tsx
@@ -62,6 +62,19 @@ const canEditPost = (user: CurrentUser, post: Post) => {
return user.id === post.user.id && timeAgo(post.createdAt) <= oneHour
}
+const PostMetaInfo = ({ post, locale }: { post: Post; locale: string }) => (
+ <HStack spacing={2} align="center">
+ <Avatar user={post.user} size="small" />
+ <span className="text-sm text-gray-600">
+ <Trans id="showpost.postedby">Posted by</Trans> <UserName user={post.user} />
+ </span>
+ <span className="text-sm text-gray-400">•</span>
+ <Moment className="text-sm text-gray-600" locale={locale} date={post.createdAt} />
+ <span className="text-sm text-gray-400">•</span>
+ <ResponseLozenge status={post.status} response={post.response} size="xsmall" />
+ </HStack>
+)
+
export default function ShowPostPage(props: ShowPostPageProps) {
const [editMode, setEditMode] = useState(false)
const [showDeleteModal, setShowDeleteModal] = useState(false)
@@ -198,20 +211,11 @@ export default function ShowPostPage(props: ShowPostPageProps) {
<h1 className="p-show-post__title">{props.post.title}</h1>
)}
- {/* Posted by info with status */}
+ {/* Posted by info with status - Desktop only */}
{!editMode && (
<>
- <div className="p-show-post__meta">
- <HStack spacing={2} align="center">
- <Avatar user={props.post.user} size="small" />
- <span className="text-sm text-gray-600">
- <Trans id="showpost.postedby">Posted by</Trans> <UserName user={props.post.user} />
- </span>
- <span className="text-sm text-gray-400">•</span>
- <Moment className="text-sm text-gray-600" locale={Fider.currentLocale} date={props.post.createdAt} />
- <span className="text-sm text-gray-400">•</span>
- <ResponseLozenge status={props.post.status} response={props.post.response} size="xsmall" />
- </HStack>
+ <div className="p-show-post__meta p-show-post__meta--desktop">
+ <PostMetaInfo post={props.post} locale={fider.currentLocale} />
</div>
<ResponseDetails status={props.post.status} response={props.post.response} />
</>
@@ -219,6 +223,13 @@ export default function ShowPostPage(props: ShowPostPageProps) {
</VStack>
</HStack>
+ {/* Posted by info with status - Mobile only (full width) */}
+ {!editMode && (
+ <div className="p-show-post__meta p-show-post__meta--mobile">
+ <PostMetaInfo post={props.post} locale={fider.currentLocale} />
+ </div>
+ )}
+
{/* Description - Full width */}
{!editMode ? (
<div className="p-show-post__description-section">