|
1 | 1 | import React, { useEffect, useState } from 'react';
|
2 | 2 | import request from '@/utils/request';
|
3 | 3 | import { Dialog } from '@headlessui/react';
|
| 4 | +import { MarkdownViewer } from '@/components/MarkdownViewer'; |
4 | 5 |
|
5 | 6 | const Writeups = ({ user }) => {
|
6 | 7 | const [writeups, setWriteups] = useState([]);
|
@@ -47,14 +48,14 @@ const Writeups = ({ user }) => {
|
47 | 48 | {writeups.length > 0 ? (
|
48 | 49 | <div className="overflow-auto">
|
49 | 50 | {writeups.map((writeup, index) => (
|
50 |
| - <div key={index} onClick={() => openModal(writeup)} className='mb-1 bg-neutral-700 hover:bg-neutral-600 hover:cursor-pointer px-5 py-3 w-full text-white flex mx-auto border border-neutral-600'> |
| 51 | + <div key={index} onClick={() => openModal(writeup)} className='mb-2 bg-neutral-700/50 hover:bg-neutral-700/90 duration-100 hover:cursor-pointer px-5 py-2 w-full text-white flex mx-auto'> |
51 | 52 | <div className='w-full flex'>
|
52 |
| - <div className=""> |
53 |
| - <h3 className="text-2xl">{writeup.title}</h3> |
54 |
| - <p className="text-sm">Authored by <span onClick={() => window.location.href = `../../users/${user.username}`} className='text-blue-500 cursor-pointer'>{user.username}</span></p> |
| 53 | + <div> |
| 54 | + <h3 className="text-xl">{writeup.title}</h3> |
| 55 | + <p className="text-sm text-blue-500 font-semibold" onClick={() => window.location.href = `../../users/${user.username}`}>@{user.username}</p> |
55 | 56 | </div>
|
56 | 57 | <div className="ml-auto mt-2">
|
57 |
| - <p className="text-sm text-right">{writeup.views} views</p> |
| 58 | + <p className="text-sm text-right hidden">{writeup.views} views</p> |
58 | 59 | <div className="space-x-2 text-right text-lg">
|
59 | 60 | <i className="fas fa-arrow-up text-green-500 cursor-pointer"></i> {writeup.upvotes}
|
60 | 61 | <i className="fas fa-arrow-down text-red-500 cursor-pointer"></i> {writeup.downvotes}
|
@@ -86,10 +87,10 @@ const Writeups = ({ user }) => {
|
86 | 87 |
|
87 | 88 | <h1 className='text-2xl'>{selectedWriteup.title}</h1>
|
88 | 89 | <p>
|
89 |
| - Authored by <span onClick={() => window.location.href = `../../users/${user.username}`} className='text-blue-500 cursor-pointer'>{user.username}</span> for challenge <span onClick={() => window.location.href = `../../challenges/${selectedWriteup.challengeId}`} className='text-yellow-500 cursor-pointer'>{selectedWriteup.title}</span>. |
| 90 | + Authored by <span onClick={() => window.location.href = `../../users/${user.username}`} className='text-blue-500 cursor-pointer'>{user.username}</span> for challenge <span onClick={() => window.location.href = `../../challenges/${selectedWriteup.challengeId}`} className='text-yellow-500 cursor-pointer'>{selectedWriteup.challenge.title}</span>. |
90 | 91 | </p>
|
91 | 92 | <div className="mt-2">
|
92 |
| - <p>{selectedWriteup.content}</p> |
| 93 | + <MarkdownViewer content={selectedWriteup.content} /> |
93 | 94 | </div>
|
94 | 95 |
|
95 | 96 |
|
|
0 commit comments