Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macgeargear/sucu 70 page documentid #23

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/components/Footer/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { cn } from '$lib/utils/cn';
</script>

<div class="h-auto w-full py-16 px-[135px] max-md:p-[70px] gap-6 bg-sucu-pink-05">
<div class="bottom-0 h-auto w-full py-16 px-[135px] max-md:p-[70px] gap-6 bg-sucu-pink-05">
<div class="flex justify-between w-full h-full max-md:hidden">
<div class="h-auto w-auto gap-6 flex">
<div class="flex flex-col gap-3">
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/List/List.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

<a
href={linkHref}
target="_blank"
class={cn(
'h-auto w-full flex flex-col py-3 px-4',
listVariants({ variant }),
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/Modal/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</script>

{#if isModalOpen}
<div class="fixed z-50 inset-0 bg-gray-700 bg-opacity-40 backdrop-blur-sm" />
<div class="fixed inset-0 bg-black bg-opacity-50 flex flex-col items-center justify-center z-50">
<div
class="bg-white h-[500px] max-md:h-[600px] max-md:w-[400px] w-[800px] rounded p-[36px] flex flex-col"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const navItems = [
{ name: 'ประกาศ', href: '/' },
{ name: 'เอกสาร', href: '/' },
{ name: 'เอกสาร', href: '/document' },
{ name: 'งบประมาณและสถิติ', href: '/' },
{ name: 'สโมสรนิสิตฯ', href: '/' }
];
Expand Down
5 changes: 0 additions & 5 deletions src/lib/components/Playground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import TabsList from './Tabs/TabsList.svelte';
import TabsTrigger from './Tabs/TabsTrigger.svelte';
import TabsContent from './Tabs/TabsContent.svelte';
import Navbar from './Navbar.svelte';
import Footer from './Footer/Footer.svelte';
import AnnoucementCard from './AnnoucementCard/AnnoucementCard.svelte';
import thumbnail from '../assets/images/thumbnail.png';
import OrganizationCard from './OrganizationCard/OrganizationCard.svelte';
Expand Down Expand Up @@ -101,7 +99,6 @@

<div>
<!-- Typography Section -->
<Navbar />
<section class="section">
<h2 class="font-bold text-2xl mb-4">Typography Variants</h2>
{#each typographyVariants as variant}
Expand Down Expand Up @@ -307,8 +304,6 @@
<h2 class="font-bold text-2xl mb-4">Organization Card</h2>
<OrganizationCard />
</section>

<Footer />
</div>

<style>
Expand Down
10 changes: 10 additions & 0 deletions src/lib/utils/date.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dayjs from 'dayjs';
import buddhistEra from 'dayjs/plugin/buddhistEra';
import 'dayjs/locale/th';
import 'dayjs/locale/th';

dayjs.extend(buddhistEra);

export function formatDateTH(dateString: string): string {
return dayjs(dateString).locale('th').format('DD MMMM BBBB');
}
8 changes: 7 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<script>
import Footer from '$lib/components/Footer/Footer.svelte';
import Navbar from '$lib/components/Navbar.svelte';
import '../styles/app.css';
</script>

<slot />
<div>
<Navbar />
<slot />
<Footer />
</div>
6 changes: 3 additions & 3 deletions src/routes/document/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@

<MaxWidthWrapper class="mt-10 space-y-12">
<div class="flex flex-col gap-3 items-start">
<button on:click={() => history.back()} class="lg:relative -left-14 top-12">
<Fa icon={faCircleArrowLeft} size="lg" />
</button>
<div class="flex items-center gap-4">
<button on:click={() => history.back()} class="lg:relative -left-60 top-2">
<Fa icon={faCircleArrowLeft} size="lg" />
</button>
<h1 class={cn(typography({ variant: 'heading3' }), 'md:text-5xl lg:order-first')}>เอกสาร</h1>
</div>
<p class="text-sucu-gray lg:w-full">
Expand Down
53 changes: 53 additions & 0 deletions src/routes/document/[id]/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script lang="ts">
import MaxWidthWrapper from '$lib/components/MaxWidthWrapper.svelte';
import { cn } from '$lib/utils';
import { faCircleArrowLeft } from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
import { typography } from '../../../styles/tailwind/typography';
import dayjs from 'dayjs';
import buddhistEra from 'dayjs/plugin/buddhistEra';
import 'dayjs/locale/th';
import { formatDateTH } from '$lib/utils/date';
import Button from '$lib/components/Button.svelte';
import { modalShow } from '$lib/components/Modal/store';
import Modal from '$lib/components/Modal/Modal.svelte';

export let data;
const { document } = data;

modalShow.set(false);

dayjs.extend(buddhistEra);
</script>

<MaxWidthWrapper class="mt-10 space-y-6 lg:space-y-12 min-h-screen">
<div class="flex flex-col gap-3 items-start">
<button on:click={() => history.back()} class="lg:relative -left-14 top-12">
<Fa icon={faCircleArrowLeft} size="lg" />
</button>
<div class="flex items-center gap-4">
<h1 class={cn(typography({ variant: 'heading4' }), 'md:text-5xl lg:order-first')}>
{document?.title}
</h1>
</div>
<div>
<p>
โดย {document?.author.first_name}
</p>
<p>{formatDateTH(document?.updated_at || '')}</p>
</div>
</div>

<hr class="border-t border-gray-300 my-12" />

<div class="flex flex-col gap-6 lg:gap-12">
<p>{document?.content.repeat(8)}</p>
<div class="w-[342px] h-[220px] lg:w-[876px] lg:h-[500px] bg-sucu-gray-light" />
<Button class="w-fit mb-16" on:click={() => modalShow.set(true)}
>ดาวน์โหลดเอกสารที่เกี่ยวข้อง</Button
>
{#if modalShow}
<Modal />
{/if}
</div>
</MaxWidthWrapper>
8 changes: 8 additions & 0 deletions src/routes/document/[id]/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { documents } from '$lib/mock/document';
import type { PageLoad } from './$types';
import 'dayjs/locale/th';

export const load: PageLoad = async ({ params }) => {
const document = documents.find((doc) => doc.id === params.id);
return { params, document };
};
Loading