mirror of
https://github.com/ershisan99/flashcards-example-project.git
synced 2025-12-16 12:33:18 +00:00
feat: decks page styles
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { FC } from 'react'
|
import { ComponentPropsWithoutRef, FC } from 'react'
|
||||||
|
|
||||||
import { KeyboardArrowLeft, KeyboardArrowRight } from '@/assets'
|
import { KeyboardArrowLeft, KeyboardArrowRight } from '@/assets'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
@@ -27,8 +27,8 @@ export type PaginationProps = {
|
|||||||
perPage?: number
|
perPage?: number
|
||||||
perPageOptions?: number[]
|
perPageOptions?: number[]
|
||||||
siblings?: number
|
siblings?: number
|
||||||
} & PaginationConditionals
|
} & PaginationConditionals &
|
||||||
|
Omit<ComponentPropsWithoutRef<'div'>, 'onChange'>
|
||||||
const classNames = {
|
const classNames = {
|
||||||
container: s.container,
|
container: s.container,
|
||||||
dots: s.dots,
|
dots: s.dots,
|
||||||
@@ -37,12 +37,15 @@ const classNames = {
|
|||||||
pageButton(selected?: boolean) {
|
pageButton(selected?: boolean) {
|
||||||
return clsx(this.item, selected && s.selected)
|
return clsx(this.item, selected && s.selected)
|
||||||
},
|
},
|
||||||
root: s.root,
|
root(className?: string) {
|
||||||
|
return clsx(s.root, className)
|
||||||
|
},
|
||||||
select: s.select,
|
select: s.select,
|
||||||
selectBox: s.selectBox,
|
selectBox: s.selectBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Pagination: FC<PaginationProps> = ({
|
export const Pagination: FC<PaginationProps> = ({
|
||||||
|
className,
|
||||||
count,
|
count,
|
||||||
onChange,
|
onChange,
|
||||||
onPerPageChange,
|
onPerPageChange,
|
||||||
@@ -50,6 +53,7 @@ export const Pagination: FC<PaginationProps> = ({
|
|||||||
perPage = null,
|
perPage = null,
|
||||||
perPageOptions,
|
perPageOptions,
|
||||||
siblings,
|
siblings,
|
||||||
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
handleMainPageClicked,
|
handleMainPageClicked,
|
||||||
@@ -68,7 +72,7 @@ export const Pagination: FC<PaginationProps> = ({
|
|||||||
const showPerPageSelect = !!perPage && !!perPageOptions && !!onPerPageChange
|
const showPerPageSelect = !!perPage && !!perPageOptions && !!onPerPageChange
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames.root}>
|
<div className={classNames.root(className)} {...rest}>
|
||||||
<div className={classNames.container}>
|
<div className={classNames.container}>
|
||||||
<PrevButton disabled={isFirstPage} onClick={handlePreviousPageClicked} />
|
<PrevButton disabled={isFirstPage} onClick={handlePreviousPageClicked} />
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-width: 220px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.valueDisplay {
|
.valueDisplay {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
.list {
|
.list {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
flex-shrink: 0;
|
||||||
background-color: var(--color-dark-900);
|
background-color: var(--color-dark-900);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
.root {
|
.root {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fieldContainer {
|
.fieldContainer {
|
||||||
|
|||||||
@@ -13,5 +13,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
column-gap: 16px;
|
column-gap: 16px;
|
||||||
margin-bottom: 16px;
|
margin: 10px 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export const DecksPage = () => {
|
|||||||
search
|
search
|
||||||
value={search ?? ''}
|
value={search ?? ''}
|
||||||
/>
|
/>
|
||||||
<Tabs onValueChange={handleTabChange} value={currentTab ?? undefined}>
|
<Tabs asChild onValueChange={handleTabChange} value={currentTab ?? undefined}>
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value={'my'}>My decks</TabsTrigger>
|
<TabsTrigger value={'my'}>My decks</TabsTrigger>
|
||||||
<TabsTrigger value={'all'}>All decks</TabsTrigger>
|
<TabsTrigger value={'all'}>All decks</TabsTrigger>
|
||||||
@@ -163,6 +163,7 @@ export const DecksPage = () => {
|
|||||||
sort={sort}
|
sort={sort}
|
||||||
/>
|
/>
|
||||||
<Pagination
|
<Pagination
|
||||||
|
className={s.pagination}
|
||||||
count={decks?.pagination?.totalPages || 1}
|
count={decks?.pagination?.totalPages || 1}
|
||||||
onChange={setCurrentPage}
|
onChange={setCurrentPage}
|
||||||
page={currentPage ?? 1}
|
page={currentPage ?? 1}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ select,
|
|||||||
textarea,
|
textarea,
|
||||||
optgroup,
|
optgroup,
|
||||||
option {
|
option {
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
font-weight: inherit;
|
font-weight: inherit;
|
||||||
|
|||||||
Reference in New Issue
Block a user