Add footer to portfolio work history

This commit is contained in:
2021-12-28 17:46:11 +01:00
parent 84c9841d7b
commit a9ecb8fd7e
5 changed files with 189 additions and 111 deletions

View File

@ -1,6 +1,8 @@
<script lang="ts">
import type { RecordAttributes } from '../../routes/portfolio/index.json'
export let work: RecordAttributes
import type { WorkAttributes } from '../../routes/portfolio/index.json'
import { workAddressNameClass, workFooterClass } from './work.css'
import { horizontalBorderTopClass } from '$lib/styles/scoops.css'
export let work: WorkAttributes
</script>
<article>
@ -8,4 +10,18 @@
<section class="description">
{@html work.description}
</section>
{#if work.address}
<footer class="{workFooterClass} {horizontalBorderTopClass}">
<h4 class={workAddressNameClass}>{work.address.name}</h4>
<address>
<div>
{work.address.location},
{work.address.zipcode}
{work.address.city},
{work.address.country}
</div>
</address>
</footer>
{/if}
</article>

View File

@ -17,9 +17,19 @@ export interface ProjectAttributes extends RecordAttributes {
}
}
export interface WorkAttributes extends RecordAttributes {
address: {
name: string
location: string
zipcode: string
city: string
country: string
}
}
export interface PortfolioAttributes {
title: string
work_history: RecordAttributes[]
work_history: WorkAttributes[]
work_history_prelude: string
projects: ProjectAttributes[]
education: RecordAttributes[]
@ -27,7 +37,7 @@ export interface PortfolioAttributes {
export type PortfolioContent = {
title: string
workHistory: RecordAttributes[]
workHistory: WorkAttributes[]
workHistoryPrelude: string
projects: ProjectAttributes[]
education: RecordAttributes[]
@ -46,9 +56,9 @@ export async function get() {
}
const parsed = fm<PortfolioAttributes>(pageSource)
const workHistory = (parsed.attributes.work_history || []).map(
parseField('description')
)
const workHistory = (parsed.attributes.work_history || [])
.filter((workHistory) => workHistory.displayed)
.map(parseField('description'))
const projects = (parsed.attributes.projects || [])
.filter((project) => project.displayed)
.map(parseField('description'))