Skip to content

Commit 84f9dfa

Browse files
committed
Add preview
1 parent 123618d commit 84f9dfa

File tree

2 files changed

+100
-4
lines changed

2 files changed

+100
-4
lines changed

src/pages/ReadsEditor.module.scss

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@
472472
font-size: 16px;
473473
font-weight: 400;
474474
line-height: 22px;
475-
border-radius: 12px;
475+
border-radius: 0;
476476
padding: 0;
477477
width: 100%;
478478
margin: 0;
@@ -488,6 +488,7 @@
488488
.tagList {
489489
display: flex;
490490
gap: 4px;
491+
flex-wrap: wrap;
491492

492493
.tag {
493494
display: inline-block;
@@ -566,7 +567,7 @@
566567
.titleImage {
567568
width: 100%;
568569
max-height: 598px;
569-
570+
border-radius: 12px;
570571
}
571572

572573
.accordionTrigger {
@@ -606,9 +607,9 @@
606607
.sectionButton {
607608
background: none;
608609
color: var(--text-secondary);
609-
font-size: 18px;
610+
font-size: 14px;
610611
font-weight: 600;
611-
line-height: 20px;
612+
line-height: 16px;
612613
border: none;
613614

614615
display: flex;
@@ -619,4 +620,54 @@
619620
&.open {
620621
color: var(--text-primary);
621622
}
623+
624+
span {
625+
margin-right: 4px;
626+
}
627+
}
628+
629+
.metadataPreview {
630+
padding-left: 8px;
631+
.titlePreview {
632+
color: var(--text-primary);
633+
font-size: 18px;
634+
font-weight: 600;
635+
line-height: 20px;
636+
}
637+
638+
.titleImagePreview {
639+
max-height: 200px;
640+
border-radius: 12px;
641+
}
642+
643+
.summaryPreview {
644+
color: var(--text-secondary);
645+
font-size: 14px;
646+
font-weight: 300;
647+
line-height: 26px;
648+
}
649+
650+
.tagPreview {
651+
width: 200px;
652+
.tagList {
653+
display: flex;
654+
gap: 4px;
655+
flex-wrap: wrap;
656+
657+
.tag {
658+
display: inline-block;
659+
color: var(--text-secondary);
660+
font-size: 8px;
661+
font-weight: 400;
662+
line-height: 10px;
663+
background-color: var(--background-input);
664+
padding: 6px 10px;
665+
border-radius: 12px;
666+
width: fit-content;
667+
margin-block: 2px;
668+
margin-right: 4px;
669+
cursor: pointer;
670+
}
671+
}
672+
}
622673
}

src/pages/ReadsEditor.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,48 @@ const ReadsEditor: Component = () => {
331331
setAccordionSection((as) => [...as, 'metadata']);
332332
}}
333333
>
334+
<Show
335+
when={accordionSection().includes('metadata')}
336+
fallback={<span>Show</span>}
337+
>
338+
<span>Hide</span>
339+
</Show>
334340
Metadata
335341
</button>
336342

343+
<Show when={!accordionSection().includes('metadata')}>
344+
<div class={styles.metadataPreview}>
345+
<Show when={article.title.length > 0}>
346+
<div class={styles.titlePreview}>
347+
{article.title}
348+
</div>
349+
</Show>
350+
351+
<Show when={article.image.length > 0}>
352+
<img
353+
class={styles.titleImagePreview}
354+
src={article.image}
355+
/>
356+
</Show>
357+
358+
<Show when={article.summary.length > 0}>
359+
<div class={styles.summaryPreview}>
360+
{article.summary}
361+
</div>
362+
</Show>
363+
364+
<Show when={article.tags.length > 0}>
365+
<div class={styles.tagPreview}>
366+
<div class={styles.tagList}>
367+
<For each={article.tags}>
368+
{tag => <div class={styles.tag}>{tag}</div>}
369+
</For>
370+
</div>
371+
</div>
372+
</Show>
373+
</div>
374+
</Show>
375+
337376
<button
338377
class={`${styles.sectionButton} ${accordionSection().includes('content') ? styles.open : ''}`}
339378
onClick={() => {
@@ -345,6 +384,12 @@ const ReadsEditor: Component = () => {
345384
setAccordionSection((as) => [...as, 'content']);
346385
}}
347386
>
387+
<Show
388+
when={accordionSection().includes('content')}
389+
fallback={<span>Show</span>}
390+
>
391+
<span>Hide</span>
392+
</Show>
348393
Content
349394
</button>
350395
</div>

0 commit comments

Comments
 (0)