From 3ff7e551aa1a3d4f3b17b372c2d3f6f1fc2da903 Mon Sep 17 00:00:00 2001 From: Tanyalak Date: Mon, 10 Apr 2023 16:56:21 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20=E0=B8=AA=E0=B8=A1=E0=B8=B1=E0=B8=84=E0=B8=A3=E0=B8=95?= =?UTF-8?q?=E0=B8=B2=E0=B8=A1=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99?= =?UTF-8?q?=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/src/app.postcss | 4 ++ cms/src/lib/components/url.js | 36 +++++++++++++++++ cms/src/lib/data/competitive-exam.json | 22 +++++++++++ cms/src/routes/+page.svelte | 19 ++++++--- cms/src/routes/competitive/[id]/+page.svelte | 41 ++++++++++++++++++-- cms/src/routes/qualifying/[id]/+page.svelte | 41 +++++++++++++++++--- 6 files changed, 148 insertions(+), 15 deletions(-) create mode 100644 cms/src/lib/components/url.js diff --git a/cms/src/app.postcss b/cms/src/app.postcss index deaebf7..d00ac4a 100644 --- a/cms/src/app.postcss +++ b/cms/src/app.postcss @@ -95,4 +95,8 @@ ::-webkit-scrollbar-thumb:hover { background-color: #a8bbbf; } + + .display-none{ + display: none; + } } diff --git a/cms/src/lib/components/url.js b/cms/src/lib/components/url.js new file mode 100644 index 0000000..ce03a12 --- /dev/null +++ b/cms/src/lib/components/url.js @@ -0,0 +1,36 @@ +import { derived, writable } from 'svelte/store' + +export function createUrlStore(ssrUrl) { + // Ideally a bundler constant so that it's tree-shakable + if (typeof window === 'undefined') { + const { subscribe } = writable(ssrUrl) + return { subscribe } + } + + const href = writable(window.location.href) + + const originalPushState = history.pushState + const originalReplaceState = history.replaceState + + const updateHref = () => href.set(window.location.href) + + history.pushState = function () { + originalPushState.apply(this, arguments) + updateHref() + } + + history.replaceState = function () { + originalReplaceState.apply(this, arguments) + updateHref() + } + + window.addEventListener('popstate', updateHref) + window.addEventListener('hashchange', updateHref) + + return { + subscribe: derived(href, ($href) => new URL($href)).subscribe + } +} + +// If you're using in a pure SPA, you can return a store directly and share it everywhere +export default createUrlStore() diff --git a/cms/src/lib/data/competitive-exam.json b/cms/src/lib/data/competitive-exam.json index a51ddb6..5aa8870 100644 --- a/cms/src/lib/data/competitive-exam.json +++ b/cms/src/lib/data/competitive-exam.json @@ -11,6 +11,28 @@ "url":"/images/c1.jpg" } ], + "regi":[ + { + "title":"เจ้าพนักงานเภสัชกรรมปฏิบัติงาน", + "url":"/" + }, + { + "title":"เจ้าพนักงานทันตสาธารณสุขปฏิบัติงาน", + "url":"/" + }, + { + "title":"ผู้ช่วยทันตแพทย์ปฏิบัติงาน", + "url":"/" + }, + { + "title":"ดุริยางคศิลปินปฏิบัติงาน", + "url":"/" + }, + { + "title":"คีตศิลปินปฏิบัติงาน", + "url":"/" + } + ], "files":[ { "title":"รายละเอียดประกาศ", diff --git a/cms/src/routes/+page.svelte b/cms/src/routes/+page.svelte index 58de954..532c11a 100644 --- a/cms/src/routes/+page.svelte +++ b/cms/src/routes/+page.svelte @@ -83,7 +83,7 @@ >
- 1 + 1
@@ -121,7 +121,7 @@
- 1 + 1

@@ -156,7 +156,7 @@
- 1 + 1
@@ -213,7 +213,7 @@
- 1 + 1
@@ -252,7 +252,7 @@
- 1 + 1

@@ -287,7 +287,7 @@
- 1 + 1
@@ -360,4 +360,11 @@ .imgCard{ height: 210px; } +.fit{ + display: block; + height: 100%; + width: 100%; + object-fit: cover; + object-position: top; +} \ No newline at end of file diff --git a/cms/src/routes/competitive/[id]/+page.svelte b/cms/src/routes/competitive/[id]/+page.svelte index ed4a7d4..95c3752 100644 --- a/cms/src/routes/competitive/[id]/+page.svelte +++ b/cms/src/routes/competitive/[id]/+page.svelte @@ -39,12 +39,45 @@
{i.title}
{/each} {/if} + + {#if data.regi} +
สมัครสอบ
+ {#each data.regi as regi} +
+ +
+
+ + + สมัครสอบ + +
+ {regi.title} +
+
+
+ {/each} +
+ {/if} + {#if data.files} +
เอกสารประกอบ
{#each data.files as file} -
- +
+ + {/each} {/if}
diff --git a/cms/src/routes/qualifying/[id]/+page.svelte b/cms/src/routes/qualifying/[id]/+page.svelte index 2ef78e6..b0ab303 100644 --- a/cms/src/routes/qualifying/[id]/+page.svelte +++ b/cms/src/routes/qualifying/[id]/+page.svelte @@ -39,13 +39,44 @@
{i.title}
{/each} {/if} - + {#if data.regi} +
สมัครสอบ
+ {#each data.regi as regi} +
+ +
+
+ + + สมัครสอบ + +
+ {regi.title} +
+
+
+ {/each} +
+ {/if} + {#if data.files} +
เอกสารประกอบ
{#each data.files as file} -
- +
+ + {/each} {/if}