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

Feat/anan/pagination #25

Merged
merged 18 commits into from
Oct 17, 2024
Merged

Feat/anan/pagination #25

merged 18 commits into from
Oct 17, 2024

Conversation

Chulinuwu
Copy link
Collaborator

Type of Change

  • [Pagination component ] New features

Description

pagination component+ responsive

Screenshots or GIFs (if applicable)

chrome-capture-2024-10-4

Copy link
Member

@punchanabu punchanabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.youtube.com/watch?v=a1wW0AjQCI8

ฟังเพลงนี้ไประหว่างแก้ pr

src/lib/components/pagination/pagination.svelte Outdated Show resolved Hide resolved
import Dropdown from '../Dropdown/Dropdown.svelte';

export let Arrayitem: string[] = []; // Explicitly define the type as any[]
let currentPage: number | string = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ขอ 2 อันนี้เป็น type number หน่อย

let currentPage: number
let itemsPerPage: number

เดี่ยว backend จะส่งมาเป็น type number เหมือนกัน
และมันจะไม่ต้องไป ParseInt หลายๆที่
หลังจากเปลี่ยน type แล้วพยายามเอา ParseInt ออกไป

Comment on lines 76 to 84
<button
class={cn(
' px-4 max-md:px-4 py-2 rounded max-md:scale-75',
currentPage === page ? 'text-white bg-sucu-pink-02 ' : 'text-black bg-white border'
)}
on:click={() => changePage(page)}
>
{page}
</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

เอาอีก if นึงมาครอบตรงนี้มันจะได้ไม่ type error หลังจากนั้น

{#if typeof page === 'number'}
         <button>some content</button>
{/if}

src/lib/components/pagination/pagination.svelte Outdated Show resolved Hide resolved
import { faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
import Dropdown from '../Dropdown/Dropdown.svelte';

export let Arrayitem: string[] = []; // Explicitly define the type as any[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ลบ comment นี้ออกไปมันคือ string[] ไม่ใช่ any[]

Comment on lines 8 to 13
let currentPage: number | string = 1;
let itemsPerPage: string = '5'; // Default items per page
let totalPages: number = Math.ceil(Arrayitem.length / parseInt(itemsPerPage));
let paginatedItems: string[] = [];

const pageChoice: string[] = ['5', '10', '15'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

พวกนี้อาจจะต้องเปลี่ยนเป็น props แทนหมายถึงต้อง export ไว้ด้วยละกันเพื่อ custom ทีหลัง

Copy link
Member

@punchanabu punchanabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

เปลี่ยนชื่อแล้ว merge ได้เลยคิดว่า ok ละ

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ชื่อ component เริ่มต้นด้วยตัวใหญ่นะ เปลี่ยนเป็น Pagination.svelte

ฝากเปลี่ยนชื่อด้วยนะเหมือนจะยังไม่เป็นตัวใหญ่

@Chulinuwu Chulinuwu merged commit c75950e into dev Oct 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants