Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Changes to the post styling / layout

Matt Roberts72d0078d279f
diff --git a/public/assets/images/heroicons-thumbsup.svg b/public/assets/images/heroicons-thumbsup.svg
new file mode 100644
index 000000000..28a572046
--- /dev/null
+++ b/public/assets/images/heroicons-thumbsup.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z" />
+</svg>
diff --git a/public/assets/styles/utility/display.scss b/public/assets/styles/utility/display.scss
index 51866812a..b424a7505 100644
--- a/public/assets/styles/utility/display.scss
+++ b/public/assets/styles/utility/display.scss
@@ -106,6 +106,10 @@
align-items: baseline;
}
+.flex-items-start {
+ align-items: start;
+}
+
.justify-between {
justify-content: space-between;
}
@@ -217,3 +221,7 @@
background-color: get("colors.gray.100");
}
}
+
+.purple-border {
+ border-top: 4px solid get("colors.primary.base");
+}
diff --git a/public/assets/styles/utility/text.scss b/public/assets/styles/utility/text.scss
index 9cc2fc946..bd92062a4 100644
--- a/public/assets/styles/utility/text.scss
+++ b/public/assets/styles/utility/text.scss
@@ -9,6 +9,12 @@ pre:last-child {
margin-bottom: 0;
}
+.text-large {
+ font-size: get("font.size.2xl");
+ font-weight: get("font.weight.bold");
+ letter-spacing: -1px;
+}
+
.text-display2 {
font-size: get("font.size.xl");
font-weight: get("font.weight.medium");
diff --git a/public/components/common/Moment.tsx b/public/components/common/Moment.tsx
index 72c6089d7..d28122615 100644
--- a/public/components/common/Moment.tsx
+++ b/public/components/common/Moment.tsx
@@ -1,9 +1,10 @@
import React from "react"
-import { formatDate, timeSince } from "@fider/services"
+import { classSet, formatDate, timeSince } from "@fider/services"
interface MomentText {
locale: string
date: Date | string
+ className?: string
format?: "relative" | "full" | "short" | "date"
}
@@ -28,9 +29,14 @@ export const Moment = (props: MomentText) => {
const tooltip = props.format === "short" ? formatDate(props.locale, props.date, "full") : undefined
+ const className = classSet({
+ ...(props.className ? { [props.className]: true } : {}),
+ date: true,
+ })
+
return (
- <span className="date" data-tooltip={tooltip}>
+ <span className={className} data-tooltip={tooltip}>
{display}
</span>
)
-}
+}
\ No newline at end of file
diff --git a/public/pages/ShowPost/ShowPost.page.scss b/public/pages/ShowPost/ShowPost.page.scss
index a23a0f93c..2e5e037bc 100644
--- a/public/pages/ShowPost/ShowPost.page.scss
+++ b/public/pages/ShowPost/ShowPost.page.scss
@@ -26,11 +26,11 @@
.p-show-post {
display: grid;
gap: spacing(4);
- grid-template-columns: 1fr 3fr;
+ grid-template-columns: 3fr 1fr;
grid-template-rows: auto;
grid-template-areas:
- "Action Main"
- "Action Main";
+ "Main Action"
+ "Main Action";
&__main-col {
grid-area: Main;
diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsx
index a83fd6004..3ebc67ce6 100644
--- a/public/pages/ShowPost/ShowPost.page.tsx
+++ b/public/pages/ShowPost/ShowPost.page.tsx
@@ -6,7 +6,6 @@ import { Comment, Post, Tag, Vote, ImageUpload, CurrentUser } from "@fider/model
import { actions, clearUrlHash, Failure, Fider, notify, timeAgo } from "@fider/services"
import {
- VoteCounter,
ShowPostResponse,
Button,
UserName,
@@ -20,6 +19,7 @@ import {
Icon,
Header,
PoweredByFider,
+ Avatar,
} from "@fider/components"
import { ResponseForm } from "./components/ResponseForm"
import { TagsPanel } from "./components/TagsPanel"
@@ -30,7 +30,7 @@ import { VotesPanel } from "./components/VotesPanel"
import IconX from "@fider/assets/images/heroicons-x.svg"
import IconPencilAlt from "@fider/assets/images/heroicons-pencil-alt.svg"
-import IconCheck from "@fider/assets/images/heroicons-check.svg"
+import IconThumbsUp from "@fider/assets/images/heroicons-thumbsup.svg"
import { HStack, VStack } from "@fider/components/layout"
import { Trans } from "@lingui/macro"
@@ -148,9 +148,9 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho
<div className="p-show-post">
<div className="p-show-post__main-col">
<div className="p-show-post__header-col">
- <VStack spacing={4}>
+ <VStack spacing={6}>
<HStack>
- <VoteCounter post={this.props.post} />
+ {/* <VoteCounter post={this.props.post} /> */}
<div className="flex-grow">
{this.state.editMode ? (
@@ -158,20 +158,28 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho
<Input field="title" maxLength={100} value={this.state.newTitle} onChange={this.setNewTitle} />
</Form>
) : (
- <h1 className="text-display2">{this.props.post.title}</h1>
+ <h1 className="text-large">{this.props.post.title}</h1>
)}
- <span className="text-muted">
+ <HStack spacing={4} className="my-3 mt-4">
+ <Avatar user={this.props.post.user} />
+ <VStack spacing={1}>
+ <UserName user={this.props.post.user} />
+ <Moment className="text-muted" locale={Fider.currentLocale} date={this.props.post.createdAt} />
+ </VStack>
+ </HStack>
+
+ {/* <span className="text-muted">
<Trans id="showpost.label.author">
Posted by <UserName user={this.props.post.user} /> &middot; <Moment locale={Fider.currentLocale} date={this.props.post.createdAt} />
</Trans>
- </span>
+ </span> */}
</div>
</HStack>
- <VStack>
- <span className="text-category">
+ <VStack className="flex-items-start">
+ {/* <span className="text-category">
<Trans id="label.description">Description</Trans>
- </span>
+ </span> */}
{this.state.editMode ? (
<Form error={this.state.error}>
<TextArea field="description" value={this.state.newDescription} onChange={this.setNewDescription} />
@@ -191,6 +199,25 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho
</>
)}
</VStack>
+ <div className="align-self-start">
+ <Button variant="primary" onClick={this.saveChanges} disabled={Fider.isReadOnly}>
+ <Icon sprite={IconThumbsUp} />{" "}
+ <span>
+ <Trans id="action.vote">Vote for this idea</Trans>
+ </span>
+ </Button>
+ </div>
+
+ <HStack>
+ <span className="text-display">
+ {this.props.post.votesCount} {this.props.post.votesCount === 1 ? "Vote" : "Votes"}
+ </span>
+ <div className="pl-4">
+ <VotesPanel post={this.props.post} votes={this.props.votes} hideTitle={true} />
+ </div>
+ </HStack>
+
+ <div className="purple-border" />
<ShowPostResponse status={this.props.post.status} response={this.props.post.response} />
</VStack>
</div>
@@ -211,7 +238,7 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho
{this.state.editMode ? (
<VStack>
<Button variant="primary" onClick={this.saveChanges} disabled={Fider.isReadOnly}>
- <Icon sprite={IconCheck} />{" "}
+ <Icon sprite={IconThumbsUp} />{" "}
<span>
<Trans id="action.save">Save</Trans>
</span>
diff --git a/public/pages/ShowPost/components/VotesPanel.tsx b/public/pages/ShowPost/components/VotesPanel.tsx
index 5799de4d5..e27d367b8 100644
--- a/public/pages/ShowPost/components/VotesPanel.tsx
+++ b/public/pages/ShowPost/components/VotesPanel.tsx
@@ -9,6 +9,7 @@ import { Trans } from "@lingui/macro"
interface VotesPanelProps {
post: Post
+ hideTitle?: boolean
votes: Vote[]
}
@@ -30,9 +31,11 @@ export const VotesPanel = (props: VotesPanelProps) => {
return (
<VStack>
<VotesModal post={props.post} isOpen={isVotesModalOpen} onClose={closeModal} />
- <span className="text-category">
- <Trans id="label.voters">Voters</Trans>
- </span>
+ {!props.hideTitle && (
+ <span className="text-category">
+ <Trans id="label.voters">Voters</Trans>
+ </span>
+ )}
<HStack>
{props.votes.length > 0 && <AvatarStack users={props.votes.map((x) => x.user)} />}
{extraVotesCount > 0 && (