diff --git a/src/components/cards/cardBlog.tsx b/src/components/cards/cardBlog.tsx index 5e5b396..859c7ed 100644 --- a/src/components/cards/cardBlog.tsx +++ b/src/components/cards/cardBlog.tsx @@ -14,6 +14,14 @@ export default async function CardBlog({ isAdmin, }: CardBlogProps) { const router = useRouter(); + + const descriptionLength = description.length; + + const descriptionLimit = 50; + + const limitedDescription = description.slice(0, descriptionLimit); + + const handleDelete = async () => { try { const deletePost = async () => { @@ -42,9 +50,9 @@ export default async function CardBlog({ return ( <> -
+
-
+

{title}

@@ -52,8 +60,8 @@ export default async function CardBlog({

{date}

-
-

{description}

+
+

{limitedDescription}...

diff --git a/src/components/text-editor.tsx b/src/components/text-editor.tsx index fff5c72..4213fdb 100644 --- a/src/components/text-editor.tsx +++ b/src/components/text-editor.tsx @@ -25,7 +25,6 @@ const RichTextEditor = ({ - const limit = 100; const editor = useEditor({ editorProps: { @@ -66,9 +65,7 @@ const RichTextEditor = ({ autolink: true, defaultProtocol: 'https', }), - CharacterCount.configure({ - limit, - }), + CharacterCount.configure(), CodeBlock.configure({ HTMLAttributes: { class: "border-gray-300 rounded-md p-2 bg-gray-500 text-white font-code", @@ -113,45 +110,16 @@ const RichTextEditor = ({ } }, [editor]) - const percentage = editor - ? Math.round((100 / limit) * editor.storage.characterCount.characters()) - : 0 + return ( <> {editor ? : null} -
- - - - - - - {editor?.storage.characterCount.characters()} / {limit} characters +
+ + + {editor?.storage.characterCount.characters()} characters