-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎹 Pagination: Create Overview demo page. (#28469)
Co-authored-by: Sergey Arzamasov <[email protected]>
- Loading branch information
1 parent
2577c3d
commit 758f3cf
Showing
16 changed files
with
1,212 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
apps/demos/Demos/Pagination/Overview/React/EmployeeCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
|
||
interface Employee { | ||
ID: number; | ||
FullName: string; | ||
Title: string; | ||
Employee_Picture: string; | ||
Picture: string; | ||
MobilePhone: string; | ||
} | ||
|
||
interface EmployeeCardProps { | ||
employee: Employee; | ||
} | ||
|
||
const EmployeeCard = ({ employee }: EmployeeCardProps) => { | ||
return ( | ||
<div className="employees__card"> | ||
<div className="employees__img-wrapper"> | ||
<img | ||
className="employees__img" | ||
src={employee.Picture} | ||
alt={employee.FullName} | ||
/> | ||
</div> | ||
<div className="employees__info"> | ||
<div className="employees__info-row"> | ||
<span className="employees__info-label">Full Name:</span> | ||
<span className="employees__info-value">{employee.FullName}</span> | ||
</div> | ||
|
||
<div className="employees__info-row"> | ||
<span className="employees__info-label">Position:</span> | ||
<span className="employees__info-value">{employee.Title}</span> | ||
</div> | ||
|
||
<div className="employees__info-row"> | ||
<span className="employees__info-label">Phone:</span> | ||
<span className="employees__info-value">{employee.MobilePhone}</span> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EmployeeCard; |
35 changes: 35 additions & 0 deletions
35
apps/demos/Demos/Pagination/Overview/React/EmployeesGallery.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import EmployeeCard from './EmployeeCard.tsx'; | ||
|
||
interface Employee { | ||
ID: number; | ||
FullName: string; | ||
Title: string; | ||
Employee_Picture: string; | ||
Picture: string; | ||
MobilePhone: string; | ||
} | ||
|
||
interface EmployeeGalleryProps { | ||
employees: Employee[]; | ||
pageSize: number; | ||
pageIndex: number; | ||
} | ||
|
||
const EmployeeGallery = ({ employees, pageSize, pageIndex }: EmployeeGalleryProps) => { | ||
const cardsNumber = pageSize === 4 ? 'employees--forth' : 'employees--six'; | ||
const pageEmployees = employees.slice((pageIndex - 1) * pageSize, pageIndex * pageSize); | ||
|
||
return ( | ||
<div className={`employees ${cardsNumber}`}> | ||
{pageEmployees.map((employee) => ( | ||
<EmployeeCard | ||
key={employee.ID} | ||
employee={employee} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default EmployeeGallery; |
Oops, something went wrong.