Compare commits

..

No commits in common. "ae5da09e23bb32a7f89fad0be2df4248f578aaf8" and "a06cea57837401536ef6e90ff7b10e90eeb61a2f" have entirely different histories.

3 changed files with 5 additions and 30 deletions

View file

@ -31,11 +31,6 @@ const { icon, type = 'info'} = Astro.props;
--callout-text: #2e3440;
}
.callout-tip {
--callout-bg: var(--secondary-color);
--callout-text: #2e3440;
}
.callout-warning {
--callout-bg: var(--terminal-yellow);
--callout-text: #2e3440;

View file

@ -15,14 +15,8 @@ import TimeLineItem from "./TimeLineItem.astro";
import { parse } from "ultrahtml";
import {querySelectorAll} from 'ultrahtml/selector'
interface TimelineItem {
date: string;
title: string;
descriptionHTML: string;
}
/* These code has a lot of children LoL */
function parseTimeLineContent(content: string): TimelineItem[] {
function parseTimeLineContent(content: string) {
if (!content) return [];
const html = parse(content);
@ -53,24 +47,18 @@ function parseTimeLineContent(content: string): TimelineItem[] {
return items;
}
let timelineItems: TimelineItem[] = []
const { parseFromText = true } = Astro.props;
if (parseFromText) {
const renderedHTML = await Astro.slots.render('default');
timelineItems = parseTimeLineContent(renderedHTML);
}
const timelineItems = parseTimeLineContent(renderedHTML);
---
<ol class="timeline">
{parseFromText && timelineItems.map(item => (
{timelineItems.map(item => (
<li>
<TimeLineItem date={item.date} title={item.title}>
<Fragment set:html={item.descriptionHTML} />
</TimeLineItem>
</li>
))}
{!parseFromText && <slot/>}
</ol>
<style>
ol.timeline {

View file

@ -22,7 +22,7 @@
--text-color: #2e3440;
--secondary-text-color: #4c566a;
--accent-color: #486090;
--secondary-color: #6078a8;
--secondary--color: #6078a8;
--border-color: #d1d5db;
--header-color: #2e3440;
--terminal-green: #4b644b;
@ -275,14 +275,6 @@ div.content {
text-decoration: underline 1px;
}
div.callout-info div.callout-content a {
color: dodgerblue;
}
div.callout-warning div.callout-content a {
color: steelblue;
}
blockquote {
border-left: 1px solid var(--accent-color);
color: var(--text-color);