Compare commits
No commits in common. "ae5da09e23bb32a7f89fad0be2df4248f578aaf8" and "a06cea57837401536ef6e90ff7b10e90eeb61a2f" have entirely different histories.
ae5da09e23
...
a06cea5783
3 changed files with 5 additions and 30 deletions
|
@ -31,11 +31,6 @@ const { icon, type = 'info'} = Astro.props;
|
||||||
--callout-text: #2e3440;
|
--callout-text: #2e3440;
|
||||||
}
|
}
|
||||||
|
|
||||||
.callout-tip {
|
|
||||||
--callout-bg: var(--secondary-color);
|
|
||||||
--callout-text: #2e3440;
|
|
||||||
}
|
|
||||||
|
|
||||||
.callout-warning {
|
.callout-warning {
|
||||||
--callout-bg: var(--terminal-yellow);
|
--callout-bg: var(--terminal-yellow);
|
||||||
--callout-text: #2e3440;
|
--callout-text: #2e3440;
|
||||||
|
|
|
@ -15,14 +15,8 @@ import TimeLineItem from "./TimeLineItem.astro";
|
||||||
import { parse } from "ultrahtml";
|
import { parse } from "ultrahtml";
|
||||||
import {querySelectorAll} from 'ultrahtml/selector'
|
import {querySelectorAll} from 'ultrahtml/selector'
|
||||||
|
|
||||||
interface TimelineItem {
|
|
||||||
date: string;
|
|
||||||
title: string;
|
|
||||||
descriptionHTML: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These code has a lot of children LoL */
|
/* These code has a lot of children LoL */
|
||||||
function parseTimeLineContent(content: string): TimelineItem[] {
|
function parseTimeLineContent(content: string) {
|
||||||
if (!content) return [];
|
if (!content) return [];
|
||||||
const html = parse(content);
|
const html = parse(content);
|
||||||
|
|
||||||
|
@ -53,24 +47,18 @@ function parseTimeLineContent(content: string): TimelineItem[] {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
let timelineItems: TimelineItem[] = []
|
const renderedHTML = await Astro.slots.render('default');
|
||||||
|
const timelineItems = parseTimeLineContent(renderedHTML);
|
||||||
|
|
||||||
const { parseFromText = true } = Astro.props;
|
|
||||||
|
|
||||||
if (parseFromText) {
|
|
||||||
const renderedHTML = await Astro.slots.render('default');
|
|
||||||
timelineItems = parseTimeLineContent(renderedHTML);
|
|
||||||
}
|
|
||||||
---
|
---
|
||||||
<ol class="timeline">
|
<ol class="timeline">
|
||||||
{parseFromText && timelineItems.map(item => (
|
{timelineItems.map(item => (
|
||||||
<li>
|
<li>
|
||||||
<TimeLineItem date={item.date} title={item.title}>
|
<TimeLineItem date={item.date} title={item.title}>
|
||||||
<Fragment set:html={item.descriptionHTML} />
|
<Fragment set:html={item.descriptionHTML} />
|
||||||
</TimeLineItem>
|
</TimeLineItem>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
{!parseFromText && <slot/>}
|
|
||||||
</ol>
|
</ol>
|
||||||
<style>
|
<style>
|
||||||
ol.timeline {
|
ol.timeline {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
--text-color: #2e3440;
|
--text-color: #2e3440;
|
||||||
--secondary-text-color: #4c566a;
|
--secondary-text-color: #4c566a;
|
||||||
--accent-color: #486090;
|
--accent-color: #486090;
|
||||||
--secondary-color: #6078a8;
|
--secondary--color: #6078a8;
|
||||||
--border-color: #d1d5db;
|
--border-color: #d1d5db;
|
||||||
--header-color: #2e3440;
|
--header-color: #2e3440;
|
||||||
--terminal-green: #4b644b;
|
--terminal-green: #4b644b;
|
||||||
|
@ -275,14 +275,6 @@ div.content {
|
||||||
text-decoration: underline 1px;
|
text-decoration: underline 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.callout-info div.callout-content a {
|
|
||||||
color: dodgerblue;
|
|
||||||
}
|
|
||||||
div.callout-warning div.callout-content a {
|
|
||||||
color: steelblue;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
border-left: 1px solid var(--accent-color);
|
border-left: 1px solid var(--accent-color);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue