Adding Astrojs sources.
This commit is contained in:
parent
2664e6d8fc
commit
e20f4f45de
169 changed files with 11389 additions and 0 deletions
51
src/components/Notes.astro
Normal file
51
src/components/Notes.astro
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
import '../styles/global.css';
|
||||
|
||||
import { urlfrag } from '../utils/path';
|
||||
import { dateFormat } from '../utils/date';
|
||||
import { titleCase } from '../utils/strings';
|
||||
|
||||
import { type CollectionEntry } from 'astro:content';
|
||||
|
||||
const scriptureStyles: {[index: string]:string} = {
|
||||
gospels: 'bg-gospels',
|
||||
pentateuch: 'bg-pentateuch',
|
||||
historic: 'bg-historic',
|
||||
acts: 'bg-acts',
|
||||
wisdom: 'bg-wisdom',
|
||||
pauline: 'bg-pauline',
|
||||
prophets: 'bg-prophets',
|
||||
revelation: 'bg-revelation',
|
||||
devotional: 'bg-devotional',
|
||||
};
|
||||
const getScriptureStyle = (cat: any): string => {
|
||||
if (cat in scriptureStyles) {
|
||||
return scriptureStyles[cat];
|
||||
}
|
||||
return 'bg-gospels';
|
||||
};
|
||||
|
||||
const base = import.meta.env.BASE_URL;
|
||||
const { notes } = Astro.props;
|
||||
---
|
||||
|
||||
<div id="notes-list">
|
||||
<ul>{notes.map((note: CollectionEntry<'notes'>) => (
|
||||
<li>
|
||||
<div class="relative overflow-hidden">
|
||||
<img src={urlfrag(base, note.data.post_image)} class="rounded-md" />
|
||||
</div>
|
||||
<ul class="tags relative">
|
||||
{note.data.tags?.filter((tag: string) => (tag != 'notes')).map((tag: string) => (
|
||||
<li class:list={[getScriptureStyle(note.data.scripture_category)]}>{titleCase(tag)}</li>
|
||||
))}</ul>
|
||||
<hgroup>
|
||||
<h2>
|
||||
<a href={new URL(`${base}notes/${note.id}/`, Astro.url).pathname}>{note.data.title}</a>
|
||||
</h2>
|
||||
<h3>{note.data.sub_heading}</h3>
|
||||
</hgroup>
|
||||
<time>{dateFormat(note.data.date)}</time>
|
||||
</li>
|
||||
))}</ul>
|
||||
</div>
|
||||
Loading…
Reference in a new issue