-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from Weflo-A/develop
Develop
- Loading branch information
Showing
24 changed files
with
1,563 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,74 @@ | ||
export const brokenParts = [ | ||
{ | ||
parts: '모터', | ||
loc: '구동부 01', | ||
score: 2, | ||
warning: true, | ||
}, | ||
{ | ||
parts: 'ESC', | ||
loc: '구동부 02', | ||
score: 7, | ||
warning: true, | ||
}, | ||
{ | ||
parts: '모터', | ||
loc: '구동부 01', | ||
score: 20, | ||
warning: false, | ||
}, | ||
{ | ||
parts: '블라이드', | ||
loc: '구동부 01', | ||
score: 31, | ||
warning: false, | ||
}, | ||
{ | ||
parts: '모터', | ||
loc: '구동부 01', | ||
score: 20, | ||
warning: false, | ||
}, | ||
]; | ||
|
||
export const recycleParts = [ | ||
{ | ||
parts: '블레이드', | ||
loc: '구동부 01', | ||
name: '[DUALSKY] 28x8.0in(FE) Hybrid Carbon Prop', | ||
score: 90, | ||
price: 135000, | ||
}, | ||
{ | ||
parts: 'ESC', | ||
loc: '구동부 01', | ||
name: 'LittleBee 30A-S BLHeli_S ESC', | ||
score: 80, | ||
warning: true, | ||
price: 133000, | ||
}, | ||
{ | ||
parts: '모터', | ||
loc: '구동부 01', | ||
name: '[XEON] S2312-920KV Motor', | ||
score: 95, | ||
warning: false, | ||
price: 115000, | ||
}, | ||
{ | ||
parts: '블라이드', | ||
loc: '구동부 01', | ||
name: '[DUALSKY] 28x8.0in(FE) Hybrid Carbon Prop', | ||
score: 90, | ||
warning: false, | ||
price: 125000, | ||
}, | ||
{ | ||
parts: '모터', | ||
loc: '구동부 01', | ||
name: '[DUALSKY] 28x8.0in(FE) Hybrid Carbon Prop', | ||
score: 75, | ||
warning: false, | ||
price: 155000, | ||
}, | ||
]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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,91 @@ | ||
import { forwardRef, useImperativeHandle } from 'react'; | ||
import colors from 'src/constants/colors'; | ||
import styled from 'styled-components'; | ||
|
||
export interface PaginationHandles { | ||
goToNextPage: () => void; | ||
goToPrevPage: () => void; | ||
} | ||
|
||
interface PaginationProp { | ||
postsNum: number; | ||
postsPerPage: number; | ||
setCurrentPage: (page: number) => void; | ||
currentPage: number; | ||
} | ||
|
||
// | ||
// | ||
// | ||
|
||
const StyledButton = styled.button` | ||
padding: 0.375rem 0.75rem; | ||
border-radius: 0.5rem; | ||
border: none; | ||
background: white; | ||
color: ${colors.basic500}; | ||
&:hover { | ||
color: ${colors.primary100}; | ||
background: ${colors.primaryOpacity20}; | ||
} | ||
&.active { | ||
color: ${colors.primary100}; | ||
background: ${colors.primaryOpacity20}; | ||
} | ||
`; | ||
|
||
// | ||
// | ||
// | ||
|
||
const Pagination = forwardRef<PaginationHandles, PaginationProp>( | ||
({ postsNum, postsPerPage, setCurrentPage, currentPage }, ref) => { | ||
// 페이지 개수 (버튼 개수) | ||
const pageList = []; | ||
const totalPages = Math.ceil(postsNum / postsPerPage); | ||
|
||
for (let i = 1; i <= totalPages; i++) { | ||
pageList.push(i); | ||
} | ||
|
||
const goToNextPage = () => { | ||
setCurrentPage(currentPage + 1); | ||
}; | ||
|
||
const goToPrevPage = () => { | ||
setCurrentPage(currentPage - 1); | ||
}; | ||
|
||
if (totalPages === 1) { | ||
return null; | ||
} | ||
|
||
useImperativeHandle(ref, () => ({ | ||
goToNextPage, | ||
goToPrevPage, | ||
})); | ||
|
||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
width: '100%', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
{pageList.map((page) => ( | ||
<StyledButton | ||
key={page} | ||
onClick={() => setCurrentPage(page)} | ||
className={currentPage === page ? 'active' : ''} | ||
> | ||
{page} | ||
</StyledButton> | ||
))} | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
export default Pagination; |
Oops, something went wrong.