Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Block Explorer UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
Block Explorer UI
Commits
3e4cfa37
Commit
3e4cfa37
authored
3 months ago
by
Lukas
Browse files
Options
Downloads
Patches
Plain Diff
Add thumbs up icon and limit voters length to top 5 votes on post card
parent
6845716a
No related branches found
No related tags found
1 merge request
!510
Lbudginas/#411 add post comments
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/post/PostContent.tsx
+2
-2
2 additions, 2 deletions
components/post/PostContent.tsx
components/post/PostContentCard.tsx
+36
-25
36 additions, 25 deletions
components/post/PostContentCard.tsx
with
38 additions
and
27 deletions
components/post/PostContent.tsx
+
2
−
2
View file @
3e4cfa37
...
...
@@ -35,12 +35,12 @@ const PostContent: React.FC<PostContentProps> = ({ active_votes, data }) => {
isPropertiesOpen
=
{
isPropertiesOpen
}
data
=
{
data
}
/>
{
active_votes
.
length
&&
(
{
active_votes
.
length
?
(
<
VoteDetailsTable
isVoteDetailsOpen
=
{
isVoteDetailsOpen
}
voteDetails
=
{
active_votes
}
/>
)
}
)
:
null
}
</>
);
};
...
...
This diff is collapsed.
Click to expand it.
components/post/PostContentCard.tsx
+
36
−
25
View file @
3e4cfa37
import
Link
from
"
next/link
"
;
import
{
ChevronDown
,
ChevronUp
}
from
"
lucide-react
"
;
import
{
ChevronDown
,
ChevronUp
,
ThumbsUp
}
from
"
lucide-react
"
;
import
{
formatAndDelocalizeFromTime
}
from
"
@/utils/TimeUtils
"
;
import
{
Card
,
CardHeader
,
CardContent
,
CardFooter
}
from
"
../ui/card
"
;
...
...
@@ -58,22 +58,31 @@ const PostContentCard: React.FC<PostContentCardProps> = ({
"
pt-2
"
:
!
title
,
})
}
>
<
div
className
=
"px-4"
>
<
div
className
=
"px-4
py-2
"
>
<
pre
className
=
"text-sm"
>
{
body
}
</
pre
>
</
div
>
<
div
className
=
"mt-2 border-t-[1px] border-slate-400"
>
<
div
className
=
"p-2 flex gap-1 flex-wrap"
>
{
voters
.
map
((
voter
)
=>
(
<
div
key
=
{
voter
}
className
=
"text-link bg-buttonBg hover:bg-buttonHover cursor-pointer py-1 px-3 m-2 break-word whitespace-nowrap rounded-full"
>
<
Link
href
=
{
`/@
${
voter
}
`
}
>
{
voter
}
</
Link
>
</
div
>
))
}
{
voters
.
length
?
(
<
div
className
=
"mt-2 border-t-[1px] border-slate-400"
>
<
div
className
=
"p-2 flex items-center gap-1 flex-wrap"
>
<
ThumbsUp
/>
{
voters
.
map
((
voter
,
index
)
=>
{
if
(
index
<
5
)
{
return
(
<
div
key
=
{
voter
}
className
=
"text-link bg-buttonBg hover:bg-buttonHover cursor-pointer py-1 px-3 m-2 break-word whitespace-nowrap rounded-full"
>
<
Link
href
=
{
`/@
${
voter
}
`
}
>
{
voter
}
</
Link
>
</
div
>
);
}
})
}
{
voters
.
length
>
5
?
(
<
p
>
and
{
voters
.
length
-
5
}
others
</
p
>
)
:
null
}
</
div
>
</
div
>
</
div
>
)
:
null
}
</
div
>
</
CardContent
>
...
...
@@ -90,17 +99,19 @@ const PostContentCard: React.FC<PostContentCardProps> = ({
<
ChevronDown
className
=
"w-4 ml-1"
/>
)
}
</
button
>
<
button
onClick
=
{
handleVoteDetailsToggle
}
className
=
"flex items-center text-xs px-2 hover:bg-buttonHover"
>
{
`Vote Details (
${
voteDetailsLength
}
)`
}
{
isVoteDetailsOpen
?
(
<
ChevronUp
className
=
"w-4 ml-1"
/>
)
:
(
<
ChevronDown
className
=
"w-4 ml-1"
/>
)
}
</
button
>
{
voteDetailsLength
?
(
<
button
onClick
=
{
handleVoteDetailsToggle
}
className
=
"flex items-center text-xs px-2 hover:bg-buttonHover"
>
{
`Vote Details (
${
voteDetailsLength
}
)`
}
{
isVoteDetailsOpen
?
(
<
ChevronUp
className
=
"w-4 ml-1"
/>
)
:
(
<
ChevronDown
className
=
"w-4 ml-1"
/>
)
}
</
button
>
)
:
null
}
</
div
>
</
CardFooter
>
</
Card
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment