Skip to content

Commit

Permalink
Update post description collapsibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jonamil committed Jun 7, 2024
1 parent 25f6d85 commit 5a0e4a5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/CommentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="space-y-px @container">
<div
class="@comment-detached:rounded mx-auto flex max-w-150 pl-3.5 pr-3.5"
:class="[isCollapsed ? 'bg-gray-100' : '']"
:class="[isCollapsed ? 'bg-gray-100 shadow-border-y shadow-gray-100' : '']"
>
<div
v-for="index in outsideIndentations"
Expand All @@ -16,7 +16,7 @@
/>
<div
class="flex w-full min-w-0 flex-1"
:class="[!isPostDescription ? 'shadow-border-b shadow-gray-200' : '']"
:class="[!isPostDescription && !isCollapsed ? 'shadow-border-b shadow-gray-200' : '']"
>
<div
v-for="index in insideIndentations"
Expand All @@ -31,8 +31,10 @@
<div class="w-full flex-1">
<div
class="flex items-center pb-3 pt-2.5 text-gray-500"
:class="[isCollapsed ? 'cursor-s-resize' : 'cursor-n-resize']"
@click="isCollapsed = !isCollapsed"
:class="[
!isPostDescription ? (isCollapsed ? 'cursor-s-resize' : 'cursor-n-resize') : '',
]"
@click="toggleCollapsed()"
>
<div class="flex-1">
<span class="font-serif text-base-serif italic">{{ item.by }}</span>
Expand Down Expand Up @@ -118,6 +120,10 @@ const content = useContentStore();
const isPostDescription = !('parent' in props.item);
const isCollapsed = ref(false);
function toggleCollapsed() {
if (isPostDescription) return;
isCollapsed.value = !isCollapsed.value;
}
// count total recursive descendants by emitting events to potential higher-level comment instances
const descendants = ref(1);
Expand Down

1 comment on commit 5a0e4a5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for hackernews-dot-cool ready!

✅ Preview
https://hackernews-dot-cool-i3ljgjjvl-jonamil-56ba8df7.vercel.app

Built with commit 5a0e4a5.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.