added drafts
This commit is contained in:
@@ -234,8 +234,13 @@ export default function Search() {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-baseline justify-between gap-3">
|
<div className="flex items-baseline justify-between gap-3">
|
||||||
<div className={`font-display italic truncate text-lg leading-tight pr-2 ${active ? 'text-[var(--mauve)]' : 'text-[var(--text)]'}`} style={{ paddingInlineEnd: '0.35em' }}>
|
<div className={`font-display italic truncate text-lg leading-tight pr-2 flex items-baseline gap-2 ${active ? 'text-[var(--mauve)]' : 'text-[var(--text)]'}`} style={{ paddingInlineEnd: '0.35em' }}>
|
||||||
{title}
|
<span className="truncate">{title}</span>
|
||||||
|
{p.draft && (
|
||||||
|
<span className="text-[9px] font-sans not-italic uppercase tracking-[0.2em] text-[var(--peach)] border border-[var(--peach)]/60 px-1.5 py-0.5 shrink-0" style={{ borderRadius: 1 }}>
|
||||||
|
Draft
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<time className="text-[10px] font-sans uppercase tracking-[0.18em] text-[var(--subtext0)] shrink-0" dateTime={p.date}>
|
<time className="text-[10px] font-sans uppercase tracking-[0.18em] text-[var(--subtext0)] shrink-0" dateTime={p.date}>
|
||||||
{formatDate(p.date)}
|
{formatDate(p.date)}
|
||||||
|
|||||||
@@ -33,9 +33,12 @@ let siteConfig = {
|
|||||||
welcome_subtitle: "An ongoing arrangement of pieces, sketches, and stray observations."
|
welcome_subtitle: "An ongoing arrangement of pieces, sketches, and stray observations."
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cookieHeader = Astro.request.headers.get('cookie') ?? '';
|
||||||
|
const fetchHeaders: HeadersInit = cookieHeader ? { cookie: cookieHeader } : {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [postsRes, configRes] = await Promise.all([
|
const [postsRes, configRes] = await Promise.all([
|
||||||
fetch(`${API_URL}/api/posts`),
|
fetch(`${API_URL}/api/posts`, { headers: fetchHeaders }),
|
||||||
fetch(`${API_URL}/api/config`)
|
fetch(`${API_URL}/api/config`)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,11 @@ let post: PostDetail | null = null;
|
|||||||
let html = '';
|
let html = '';
|
||||||
let error = '';
|
let error = '';
|
||||||
|
|
||||||
|
const cookieHeader = Astro.request.headers.get('cookie') ?? '';
|
||||||
|
const fetchHeaders: HeadersInit = cookieHeader ? { cookie: cookieHeader } : {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const postRes = await fetch(`${API_URL}/api/posts/${encodeURIComponent(slug ?? '')}`);
|
const postRes = await fetch(`${API_URL}/api/posts/${encodeURIComponent(slug ?? '')}`, { headers: fetchHeaders });
|
||||||
if (postRes.ok) {
|
if (postRes.ok) {
|
||||||
post = await postRes.json();
|
post = await postRes.json();
|
||||||
html = renderMarkdown(post!.content, post!.dimensions);
|
html = renderMarkdown(post!.content, post!.dimensions);
|
||||||
|
|||||||
Reference in New Issue
Block a user