Merge with Lim add mock data to ui

This commit is contained in:
schooltechx 2023-04-05 17:59:43 +07:00
parent 08bd7b0b6a
commit 11ab0b68d0
15 changed files with 139 additions and 78 deletions

View file

@ -1,11 +1,12 @@
import homeContent from "$lib/data/home.md?raw"
import { marked } from 'marked'
const detail = marked.parse(homeContent) //(await compile(homeContent))?.code;
//import homeContent from "$lib/data/home.md?raw"
// import { marked } from 'marked'
// const detail = marked.parse(homeContent)
import content from "$lib/data/content/home.html?raw"
import { getQualifyExams,getCompetitiveExams } from '$lib/data/info';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async () => {
const qualify_exams = await getQualifyExams(3);
const competitive_exams = await getCompetitiveExams(3);
return { detail , qualify_exams,competitive_exams };
return { content , qualify_exams,competitive_exams };
};

View file

@ -1,6 +1,6 @@
import { getAbout } from '$lib/data/info';
import content from "$lib/data/content/about.html?raw"
import type { PageServerLoad } from './$types';
export const load = (async () => {
const about = await getAbout();
return about;
return {content};
}) satisfies PageServerLoad;

View file

@ -1,8 +1,16 @@
import {getCompetitiveExams} from "$lib/data/info"
import type { PageServerLoad } from './$types'
import type {CalendarEvent} from '$lib/components/CalendarEvent'
export const load: PageServerLoad = async () => {
const exams = await getCompetitiveExams()
return {exams}
const events:CalendarEvent[]=[]
exams.forEach(({id,title,start})=>{
const backgroundColor ="#1111EE"
const url = "/competitive/"+id
events.push({id,title,start,url,backgroundColor})
})
return {exams,events}
}

View file

@ -0,0 +1,18 @@
import type { PageServerLoad } from './$types'
import { error } from '@sveltejs/kit'
import {getQualifyExams} from "$lib/data/info"
export const load: PageServerLoad = async ({params}) => {
const id = params.id+""
const exams = await getQualifyExams()
const post = exams.find((q)=>{
return q.id===id
})
if(post)
return post
else
throw error(404,{message:"ค้นหาโพสเกี่ยวกับการคัดเลือกไม่พบ"})
}

View file

@ -0,0 +1,15 @@
<script lang="ts">
import type { PageData } from './$types'
export let data: PageData;
</script>
<section class="items-start h-screen flex max-h-1000-px pt-12 bg-blueGray-100">
<div class="container mx-auto items-start flex flex-wrap px-4">
<h2 class="font-semibold text-2xl text-blueGray-600 mb-4">
การสอบแข่งขัน {data.id}
</h2>
</div>
</section>