Skip to content

Commit ab5164f

Browse files
committed
style(frontend): 调整md预览器引用块和音乐播放器样式
调整md预览器引用块和音乐播放器样式
1 parent 469b052 commit ab5164f

3 files changed

Lines changed: 43 additions & 8 deletions

File tree

frontend/src/components/ArticlePreview.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export default function ArticlePreview({ article }) {
532532
<li className="mb-1 text-gray-700 leading-relaxed" {...props} />
533533
),
534534
blockquote: (props) => (
535-
<blockquote className="border-l-4 border-blue-500 pl-4 italic my-4 text-gray-600 bg-gray-50 py-2 rounded-r" {...props} />
535+
<blockquote className="border-l-4 border-gray-200 pl-4 italic my-4 text-gray-600 bg-gray-50 py-2 rounded-r" {...props} />
536536
),
537537
table: (props) => (
538538
<div className="overflow-x-auto my-4">
@@ -641,9 +641,9 @@ export default function ArticlePreview({ article }) {
641641
const fullSrc = getFullImageUrl(src);
642642

643643
return (
644-
<div className="my-4 p-4 bg-gray-100 border border-gray-200 rounded-xl shadow-sm max-w-lg">
644+
<div className="my-4 p-4 bg-gray-100 border border-gray-200 rounded-xl shadow-sm max-w-lg audio-player">
645645
<div className="flex items-center mb-3">
646-
<div className="flex-shrink-0 w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center mr-3">
646+
<div className="flex-shrink-0 w-8 h-8 bg-blue-400 rounded-full flex items-center justify-center mr-3">
647647
<Music className="h-4 w-4 text-white" />
648648
</div>
649649
<div className="flex-1 min-w-0">
@@ -659,7 +659,7 @@ export default function ArticlePreview({ article }) {
659659
src={fullSrc}
660660
controls={controls}
661661
preload={preload}
662-
className="w-full rounded-md"
662+
className="w-full rounded-md audio-element"
663663
style={{ height: "40px", outline: "none" }}
664664
{...props}
665665
>

frontend/src/components/dashboard/MarkdownPreview.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function MarkdownPreview({ content, previewRef }) {
5757
ul: (props) => <ul className="list-disc list-inside mb-3 text-gray-700" {...props} />,
5858
ol: (props) => <ol className="list-decimal list-inside mb-3 text-gray-700" {...props} />,
5959
li: (props) => <li className="mb-1 text-gray-700" {...props} />,
60-
blockquote: (props) => <blockquote className="border-l-4 border-blue-500 pl-4 italic my-3 text-gray-600" {...props} />,
60+
blockquote: (props) => <blockquote className="border-l-4 border-gray-200 pl-4 italic my-3 text-gray-600 bg-gray-50 py-2 rounded-r" {...props} />,
6161
table: (props) => (
6262
<div className="overflow-x-auto my-4">
6363
<table className="min-w-full border-collapse border border-gray-300" {...props} />
@@ -156,9 +156,9 @@ export default function MarkdownPreview({ content, previewRef }) {
156156
}
157157

158158
return (
159-
<div className="my-4 p-4 bg-gray-100 border border-gray-200 rounded-xl shadow-sm max-w-lg">
159+
<div className="my-4 p-4 bg-gray-100 border border-gray-200 rounded-xl shadow-sm max-w-lg audio-player">
160160
<div className="flex items-center mb-3">
161-
<div className="flex-shrink-0 w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center mr-3">
161+
<div className="flex-shrink-0 w-8 h-8 bg-blue-400 rounded-full flex items-center justify-center mr-3">
162162
<Music className="h-4 w-4 text-white" />
163163
</div>
164164
<div className="flex-1 min-w-0">
@@ -172,7 +172,7 @@ export default function MarkdownPreview({ content, previewRef }) {
172172
src={src}
173173
controls={controls}
174174
preload={preload}
175-
className="w-full rounded-md"
175+
className="w-full rounded-md audio-element"
176176
style={{ height: "40px", outline: "none" }}
177177
{...props}
178178
/>

frontend/src/index.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,41 @@
398398
border-color: #4b5563;
399399
}
400400

401+
/* 音频播放器暗色模式 */
402+
.dark .audio-player .bg-blue-400 {
403+
background-color: #374151 !important;
404+
}
405+
406+
.dark .audio-element {
407+
background-color: #1f2937;
408+
border: none;
409+
outline: none;
410+
box-shadow: none;
411+
accent-color: #60a5fa;
412+
color-scheme: dark;
413+
}
414+
415+
.dark .audio-element::-webkit-media-controls-panel {
416+
background-color: #1f2937;
417+
border: none;
418+
color: #f9fafb;
419+
}
420+
421+
.dark .audio-element::-webkit-media-controls-play-button,
422+
.dark .audio-element::-webkit-media-controls-mute-button {
423+
background-color: transparent;
424+
color: #f9fafb;
425+
}
426+
427+
.dark .audio-element::-webkit-media-controls-timeline {
428+
background-color: #1f2937;
429+
}
430+
431+
.dark .audio-element::-webkit-media-controls-current-time-display,
432+
.dark .audio-element::-webkit-media-controls-time-remaining-display {
433+
color: #d1d5db;
434+
}
435+
401436
.dark .pagination-prev-next:hover:not(.disabled) {
402437
background-color: #374151;
403438
}

0 commit comments

Comments
 (0)