clean code, organization -> title and add subtitle
This commit is contained in:
parent
3ef4e0c6eb
commit
16917a088f
11 changed files with 35 additions and 47 deletions
|
|
@ -3,12 +3,9 @@ import { error } from '@sveltejs/kit';
|
|||
import type { PageServerLoad } from './$types'
|
||||
export const load: PageServerLoad = async ({fetch}) => {
|
||||
const res = await fetch("/api/info")
|
||||
if(res.ok){
|
||||
const info = await res.json()
|
||||
return info
|
||||
}else{
|
||||
throw error(500, 'ไม่สามารถอ่านข้อมูลตั้งต้นของเวปได้');
|
||||
}
|
||||
|
||||
|
||||
if(!res.ok)
|
||||
throw error(500, 'ไม่สามารถอ่านข้อมูลตั้งต้นของเวปได้');
|
||||
|
||||
const info = await res.json()
|
||||
return info
|
||||
}
|
||||
|
|
@ -9,12 +9,12 @@
|
|||
dayjs.extend(buddhistEra)
|
||||
import type { LayoutData } from './$types';
|
||||
export let data: LayoutData;
|
||||
let {logo_url,supervised,divisions,institutes,address,organization} = data
|
||||
let {logo_url,supervised,divisions,institutes,address,title,subtitle} = data
|
||||
|
||||
</script>
|
||||
|
||||
<Header {logo_url} {organization} {supervised} />
|
||||
<Header {logo_url} {title} {supervised} />
|
||||
<div class="justify-center place-content-center" style="padding-top:50px">
|
||||
<slot />
|
||||
<slot/>
|
||||
</div>
|
||||
<Footer {logo_url} {organization} {address} {divisions} {institutes} />
|
||||
<Footer {logo_url} {title} {address} {divisions} {institutes} />
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
//import content from "$lib/data/content/home.html?raw"
|
||||
//import { getQualifyExams,getCompetitiveExams } from '$lib/data/info';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import type {Exam} from '$lib/data/CMSDataType'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
|
||||
export const load: PageServerLoad = async ({fetch}) => {
|
||||
let qualify_exams: Exam[] = []
|
||||
let competitive_exams: Exam[] = []
|
||||
let content = ""
|
||||
let image = undefined
|
||||
let res = await fetch("/api/content?page=home")
|
||||
let res = await fetch("/api/info")
|
||||
if(!res.ok)
|
||||
throw error(500, 'ไม่สามารถอ่านข้อมูลตั้งต้นของหน้าหลักได้');
|
||||
const {title,subtitle} = await res.json()
|
||||
res = await fetch("/api/content?page=home")
|
||||
if(res.ok){
|
||||
const r = await res.json()
|
||||
content = r.content
|
||||
|
|
@ -31,5 +36,5 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
e.date = e.start? dayjs(e.start).format("DD MMM BBBB"):""
|
||||
})
|
||||
}
|
||||
return { content,image, qualify_exams,competitive_exams };
|
||||
return {title,subtitle,content,image, qualify_exams,competitive_exams };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
export let data: PageData;
|
||||
const {qualify_exams,competitive_exams,image} = data
|
||||
const {qualify_exams,competitive_exams,image,title,subtitle} = data
|
||||
|
||||
</script>
|
||||
<section class="reative flex bg-gradient pt-10 pb-44 md:pb-38">
|
||||
<div class="container mx-auto items-start flex flex-wrap">
|
||||
<div class="w-full md:w-6/12 lg:w-6/12 xl:w-6/12 px-6">
|
||||
<div class="pt-16 sm:pt-18">
|
||||
<h2 class="font-semibold text-3xl text-blueGray-600">
|
||||
กองสรรหาบุคคล
|
||||
{title}
|
||||
</h2>
|
||||
<h2 class="pt-1 text-2xl text-red-400">
|
||||
Recruitment Division
|
||||
{subtitle}
|
||||
</h2>
|
||||
<p class="mt-4 text-lg leading-relaxed text-blueGray-500">
|
||||
{@html data.content}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,6 @@
|
|||
<div class="">
|
||||
{@html data.detail}
|
||||
</div>
|
||||
{#if data.docUrl}
|
||||
<hr class="border-blueGray-200 mb-4 mt-7" />
|
||||
<div class="text-lg py-1">
|
||||
<i class="fa-solid fa-bookmark mr-3 text-xs text-blue-400"></i><a href={data.docUrl} class="text-blue-400 hover:text-blue-600" target="_blank">คลิกที่นี่เพื่ออ่าน </a><span class="font-medium">เอกสารประกอบ</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.files}
|
||||
{#each data.files as file}
|
||||
<hr class="border-blueGray-200 mb-4 mt-4" />
|
||||
|
|
|
|||
|
|
@ -34,12 +34,6 @@
|
|||
<div class="">
|
||||
{@html data.detail}
|
||||
</div>
|
||||
{#if data.docUrl}
|
||||
<hr class="border-blueGray-200 my-4" />
|
||||
<div class="text-lg py-1">
|
||||
<i class="fa-solid fa-bookmark mr-3 text-xs text-blue-400"></i><a href={data.docUrl} class="text-blue-400 hover:text-blue-600" target="_blank">คลิกที่นี่เพื่ออ่าน </a><span class="font-medium">เอกสารประกอบ</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.files}
|
||||
{#each data.files as file}
|
||||
<hr class="border-blueGray-200 mb-4 mt-4" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue