Skip to content

Commit 0e0b215

Browse files
committed
refactor(views): Optimize code display and directory icons
1 parent bdb93b2 commit 0e0b215

File tree

1 file changed

+38
-25
lines changed

1 file changed

+38
-25
lines changed

views/src/app/repository/files.tsx

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import remarkMath from 'remark-math';
99
import remarkBreaks from 'remark-breaks';
1010
import remarkEmoji from 'remark-emoji';
1111
import {Prism as SyntaxHighlighter} from "react-syntax-highlighter";
12-
import {MdFileDownload, MdOutlineContentCopy} from "react-icons/md";
12+
// import {MdFileDownload, MdOutlineContentCopy} from "react-icons/md";
1313
import rehypeRaw from "rehype-raw";
1414
import rehypeKatex from "rehype-katex";
15+
import {CiFolderOn} from "react-icons/ci";
1516
interface FileData {
1617
repo: Repository,
1718
tree: {
@@ -157,7 +158,7 @@ export const RepoFiles = () => {
157158
>
158159
<div className="flex items-center">
159160
{file.rtype === 'tree' ? (
160-
<GitBranch size={18} className="mr-2 text-blue-500" />
161+
<CiFolderOn size={18} className="mr-2 text-blue-500" />
161162
) : (
162163
<FileText size={18} className="mr-2" />
163164
)}
@@ -195,25 +196,25 @@ export const RepoFiles = () => {
195196
components={{
196197
code({children, className}) {
197198
const match: any = /language-(\w+)/.exec(className || "");
198-
let [isShowCode, setIsShowCode] = useState(true);
199+
let [isShowCode, _setIsShowCode] = useState(true);
199200
return (
200201
<>
201-
<div className="code-header">
202-
<div
203-
style={{cursor: "pointer", marginRight: "10px", transformOrigin: "8px"}}
204-
className={isShowCode ? "code-rotate-down" : "code-rotate-right"}
205-
onClick={() => setIsShowCode(!isShowCode)}
206-
>
207-
<MdFileDownload/>
208-
</div>
209-
<div>{match && match[1]}</div>
210-
<div
211-
className="preview-code-copy"
212-
>
213-
{/*{isShowCopy && <span className="opacity-0-1-0 copy-success">Success</span>}*/}
214-
<MdOutlineContentCopy/>
215-
</div>
216-
</div>
202+
{/*<div className="code-header">*/}
203+
{/* <div*/}
204+
{/* style={{cursor: "pointer", marginRight: "10px", transformOrigin: "8px"}}*/}
205+
{/* className={isShowCode ? "code-rotate-down" : "code-rotate-right"}*/}
206+
{/* onClick={() => setIsShowCode(!isShowCode)}*/}
207+
{/* >*/}
208+
{/* <MdFileDownload/>*/}
209+
{/* </div>*/}
210+
{/* <div>{match && match[1]}</div>*/}
211+
{/* <div*/}
212+
{/* className="preview-code-copy"*/}
213+
{/* >*/}
214+
{/* /!*{isShowCopy && <span className="opacity-0-1-0 copy-success">Success</span>}*!/*/}
215+
{/* <MdOutlineContentCopy/>*/}
216+
{/* </div>*/}
217+
{/*</div>*/}
217218
{isShowCode && (
218219
<SyntaxHighlighter
219220
showLineNumbers={true}
@@ -227,42 +228,54 @@ export const RepoFiles = () => {
227228
},
228229
h1({children}) {
229230
return (
230-
<h1 id={"heading-" + ++index} className="heading">
231+
<h1 id={"heading-" + ++index} style={{
232+
fontSize: "32px"
233+
}} className="heading">
231234
{children}
232235
</h1>
233236
);
234237
},
235238
h2({children}) {
236239
return (
237-
<h2 id={"heading-" + ++index} className="heading">
240+
<h2 id={"heading-" + ++index} style={{
241+
fontSize: "24px"
242+
}} className="heading">
238243
{children}
239244
</h2>
240245
);
241246
},
242247
h3({children}) {
243248
return (
244-
<h3 id={"heading-" + ++index} className="heading">
249+
<h3 style={{
250+
fontSize: "18.72px"
251+
}} id={"heading-" + ++index} className="heading">
245252
{children}
246253
</h3>
247254
);
248255
},
249256
h4({children}) {
250257
return (
251-
<h4 id={"heading-" + ++index} className="heading">
258+
<h4 style={{
259+
fontSize: "16px"
260+
}} id={"heading-" + ++index} className="heading">
252261
{children}
253262
</h4>
254263
);
255264
},
256265
h5({children}) {
257266
return (
258-
<h5 id={"heading-" + ++index} className="heading">
267+
<h5 style={{
268+
fontSize: "13.28px"
269+
}} id={"heading-" + ++index} className="heading">
259270
{children}
260271
</h5>
261272
);
262273
},
263274
h6({children}) {
264275
return (
265-
<h6 id={"heading-" + ++index} className="heading">
276+
<h6 style={{
277+
fontSize: "12px"
278+
}} id={"heading-" + ++index} className="heading">
266279
{children}
267280
</h6>
268281
);

0 commit comments

Comments
 (0)