partner categories table #30

Merged
nik.polishuk merged 1 commits from table-pagination into main 2024-04-05 16:14:56 +03:00
2 changed files with 128 additions and 20 deletions

View File

@ -49,7 +49,7 @@ export const PartnerCategories = () => {
const COLUMNS = [ const COLUMNS = [
{ {
label: "Аватар", label: "",
renderCell: (item) => ( renderCell: (item) => (
<img <img
className="table__avatar" className="table__avatar"
@ -60,7 +60,7 @@ export const PartnerCategories = () => {
}, },
{ {
label: "ФИО", label: "ФИО",
renderCell: (item) => item?.employee.fio, renderCell: (item) => <p>{item?.employee.fio}</p>,
sort: { sortKey: "NAME" } sort: { sortKey: "NAME" }
}, },
{ {
@ -68,18 +68,21 @@ export const PartnerCategories = () => {
renderCell: (item) => ( renderCell: (item) => (
<Link className="table__link" to={`/candidate/${item.user_id}`}> <Link className="table__link" to={`/candidate/${item.user_id}`}>
Резюме Резюме
<div className="img__wrapper">
<img src={rightArrow} alt="arrow" />
</div>
</Link> </Link>
) )
}, },
{ {
label: "Отчет", label: "Отчетность",
renderCell: (item) => ( renderCell: (item) => (
<Link <Link
className="table__link" className="table__link"
to={`/profile/employees/report/${item.user_id}`} to={`/profile/employees/report/${item.user_id}`}
> >
Подробный отчет Подробный отчет
<div> <div className="img__wrapper">
<img src={rightArrow} alt="arrow" /> <img src={rightArrow} alt="arrow" />
</div> </div>
</Link> </Link>
@ -105,7 +108,7 @@ export const PartnerCategories = () => {
const pagination = usePagination(data, { const pagination = usePagination(data, {
state: { state: {
page: 0, page: 0,
size: 5 size: 10
} }
}); });
@ -259,6 +262,7 @@ export const PartnerCategories = () => {
id="search" id="search"
type="text" type="text"
value={search} value={search}
placeholder="Поиск по сотрудникам"
onChange={handleSearch} onChange={handleSearch}
/> />
</label> </label>
@ -270,26 +274,52 @@ export const PartnerCategories = () => {
pagination={pagination} pagination={pagination}
/> />
<div className="table__pagination"> <div className="table__pagination">
<span> <button
Total Pages: {pagination.state.getTotalPages(data.nodes)} className={
</span> pagination.state.page === 0 ? "switch disable" : "switch"
}
type="button"
disabled={pagination.state.page === 0}
onClick={() =>
pagination.fns.onSetPage(pagination.state.page - 1)
}
>
{"<"}
</button>
<span className="table__pages"> <span className="table__pages">
Page:{" "}
{pagination.state.getPages(data.nodes).map((_, index) => ( {pagination.state.getPages(data.nodes).map((_, index) => (
<button <button
key={index} key={index}
type="button" type="button"
style={{ className={
fontWeight: pagination.state.page === index
pagination.state.page === index ? "bold" : "normal" ? "page page--active "
}} : "page"
}
onClick={() => pagination.fns.onSetPage(index)} onClick={() => pagination.fns.onSetPage(index)}
> >
{index + 1} {index + 1}
</button> </button>
))} ))}
</span> </span>
<button
className={
pagination.state.page + 1 ===
pagination.state.getPages(data.nodes).length
? "switch disable"
: "switch"
}
type="button"
disabled={
pagination.state.page + 1 ===
pagination.state.getPages(data.nodes).length
}
onClick={() =>
pagination.fns.onSetPage(pagination.state.page + 1)
}
>
{">"}
</button>
</div> </div>
</> </>
) : ( ) : (

View File

@ -13,10 +13,13 @@
&__items { &__items {
display: flex; display: flex;
gap: 10px;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
background: white;
padding: 20px 0 30px;
border-radius: 7px;
} }
&__empty { &__empty {
font-size: 18px; font-size: 18px;
font-weight: 500; font-weight: 500;
@ -161,8 +164,18 @@
display: flex; display: flex;
width: 100%; width: 100%;
gap: 10px; gap: 10px;
font-size: 18px;
align-items: center; align-items: center;
padding: 0 18px 35px;
margin-bottom: 0;
font-size: 16px;
input {
background: #F0F2F5;
outline: none;
border-radius: 6px;
padding: 6px;
border: none;
}
} }
&__avatar { &__avatar {
@ -175,20 +188,85 @@
color: black; color: black;
font-size: 16px; font-size: 16px;
align-items: center; align-items: center;
.img__wrapper {
width: 22px;
height: 22px;
border-radius: 50px;
background: #D9D7D7;
display: flex;
align-items: center;
justify-content: center;
img {
width: 14px;
}
}
} }
&__pagination { &__pagination {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; font-size: 14px;
font-size: 16px;
align-items: center; align-items: center;
padding: 39px 34px 0;
column-gap: 12px;
button {
font-size: 14px;
width: 32px;
border-radius: 5px;
height: 32px;
color: #2E3A59;
}
.switch {
border: none;
background: #F0F2F5;
font-weight: 600;
}
.disable {
opacity: 0.7;
}
} }
&__pages { &__pages {
display: flex; display: flex;
column-gap: 5px; column-gap: 4px;
align-items: center; color: black;
background: white;
.page {
border: 1px solid #E8ECF8;
background: none;
&--active {
border: none;
background: #9DA65D;
color: white;
}
}
}
}
table {
th {
border-top: 0;
border-bottom: 1px solid #EDEDED;
color: #1458DD;
font-size: 14px;
font-weight: 700;
}
td {
border-top: 0;
border-bottom: 1px solid #EDEDED;
color: #2E3A59;
p {
font-weight: 500;
}
} }
} }
} }