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,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>