Skip to content

Commit

Permalink
chore(client): remove read more feature
Browse files Browse the repository at this point in the history
  • Loading branch information
lareii committed Sep 22, 2024
1 parent 347da13 commit 41d384d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/components/app/Comment/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function Comment({ comment: initialComment, onDelete }) {
onDelete={onDelete}
/>
</div>
<MarkdownContent isPostPage={true} content={comment.content} />
<MarkdownContent content={comment.content} />
<div className='mt-4 flex justify-between'>
<LikeButton comment={comment} setComment={setComment} />
<DateTooltip created_at={comment.created_at} updated_at={comment.updated_at} />
Expand Down
13 changes: 1 addition & 12 deletions client/components/app/Markdown/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { usePathname } from 'next/navigation';
import { useState } from 'react';
import Link from 'next/link';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
Expand All @@ -8,8 +7,6 @@ import { SquareArrowOutUpRight } from 'lucide-react';
export default function MarkdownContent({ content }) {
const isPostPage = usePathname().includes('/app/posts/');

const [isExpanded, setIsExpanded] = useState(isPostPage);

const customRenderers = {
img: ({ src, alt }) => (
<Link href={src} target='_blank'>
Expand All @@ -36,18 +33,10 @@ export default function MarkdownContent({ content }) {
<Markdown
components={customRenderers}
remarkPlugins={[remarkGfm]}
className={`md ${isExpanded ? 'line-clamp-none' : 'line-clamp-5'}`}
className={`md ${isPostPage ? 'line-clamp-none' : 'line-clamp-5'}`}
>
{content}
</Markdown>
{!isPostPage && (
<div
onClick={() => setIsExpanded(!isExpanded)}
className='text-xs cursor-pointer w-fit'
>
{isExpanded ? 'gizle' : 'devamını oku'}
</div>
)}
</div>
);
}

0 comments on commit 41d384d

Please sign in to comment.