test
This commit is contained in:
32
src/entities/DefaultDropDown/DefaultDropDown.tsx
Normal file
32
src/entities/DefaultDropDown/DefaultDropDown.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import React from "react";
|
||||
|
||||
import Dropdown from 'react-bootstrap/Dropdown';
|
||||
|
||||
type option = {
|
||||
name: string,
|
||||
link: string,
|
||||
id: number
|
||||
}
|
||||
|
||||
interface DefaultDropDownProps {
|
||||
title: string,
|
||||
options: option[]
|
||||
}
|
||||
|
||||
export const DefaultDropDown:React.FC<DefaultDropDownProps> = ({title, options}) => {
|
||||
return (
|
||||
<Dropdown data-bs-theme="dark">
|
||||
<Dropdown.Toggle id="dropdown-button-dark-example" variant="primary">
|
||||
{title}
|
||||
</Dropdown.Toggle>
|
||||
|
||||
<Dropdown.Menu>
|
||||
{options.map((option => {
|
||||
return <Dropdown.Item key={option.id} href={option.link}>
|
||||
{option.name}
|
||||
</Dropdown.Item>
|
||||
}))}
|
||||
</Dropdown.Menu>
|
||||
</Dropdown>
|
||||
);
|
||||
};
|
1
src/entities/DefaultDropDown/index.ts
Normal file
1
src/entities/DefaultDropDown/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { DefaultDropDown } from "./DefaultDropDown"
|
24
src/entities/DefaultPagination/DefaultPagination.tsx
Normal file
24
src/entities/DefaultPagination/DefaultPagination.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React, {ReactElement} from "react";
|
||||
|
||||
import Pagination from 'react-bootstrap/Pagination';
|
||||
|
||||
interface DefaultPaginationProps {
|
||||
pageCount: number,
|
||||
currentPage: number
|
||||
}
|
||||
|
||||
export const DefaultPagination:React.FC<DefaultPaginationProps> = ({pageCount, currentPage}) => {
|
||||
let items: ReactElement[] = [];
|
||||
for (let number = 1; number <= pageCount; number++) {
|
||||
items.push(
|
||||
<Pagination.Item key={number} active={number === currentPage}>
|
||||
{number}
|
||||
</Pagination.Item>,
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Pagination>
|
||||
{items}
|
||||
</Pagination>
|
||||
);
|
||||
};
|
1
src/entities/DefaultPagination/index.ts
Normal file
1
src/entities/DefaultPagination/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { DefaultPagination } from "./DefaultPagination"
|
Reference in New Issue
Block a user