-
Notifications
You must be signed in to change notification settings - Fork 0
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 weahforsage#8 from rouge3351/convert-to-typescript
Convert Typescript this project
- Loading branch information
Showing
9 changed files
with
183 additions
and
125 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
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
File renamed without changes.
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,16 @@ | ||
import { Animated } from 'react-native'; | ||
import { IDotStyle } from '../../util/DotUtils'; | ||
|
||
export interface IPropsDot { | ||
idx: number; | ||
curPage: number; | ||
maxPage: number; | ||
activeColor: string; | ||
} | ||
|
||
export interface IStateDot { | ||
animVal:Animated.Value; | ||
animate: boolean; | ||
prevType: IDotStyle; | ||
type: IDotStyle; | ||
} |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
export interface IDotStyle { | ||
size:number; | ||
opacity:number; | ||
} | ||
|
||
export enum EnumDotType { | ||
ACTIVE, | ||
INACTIVE, | ||
MEDIUM, | ||
SMALL, | ||
} | ||
|
||
const DotStyle = { | ||
[EnumDotType.INACTIVE] : { | ||
size: 8, | ||
opacity: 0.2, | ||
}, | ||
[EnumDotType.ACTIVE]:{ | ||
size: 8, | ||
opacity: 1.0, | ||
}, | ||
[EnumDotType.MEDIUM]:{ | ||
size: 5, | ||
opacity: 0.2, | ||
}, | ||
[EnumDotType.SMALL]:{ | ||
size: 3, | ||
opacity: 0.2, | ||
} | ||
|
||
} | ||
|
||
export type getDotStylePayload = { | ||
idx: number; | ||
curPage: number; | ||
maxPage: number; | ||
} | ||
|
||
export const getDotStyle = ({ idx, curPage, maxPage }:getDotStylePayload):IDotStyle => { | ||
let type = EnumDotType.SMALL; | ||
|
||
if (maxPage < 5) { | ||
//5개 이하인 경우는 단수이기 때문에 큰 Dot으로만 구성 | ||
// return ( idx === curPage ) ? EnumDotType.ACTIVE : EnumDotType.INACTIVE; | ||
return DotStyle[(idx === curPage) ? EnumDotType.ACTIVE : EnumDotType.INACTIVE]; | ||
} | ||
|
||
if (curPage < 3) { | ||
// 현재 페이지가 3 이하일때는 별도로 배열을 지정해줌 | ||
// 배열 | ||
// 큰 큰 큰 중 | ||
if (idx < 3) { | ||
type = EnumDotType.INACTIVE; | ||
if (curPage === idx) { | ||
type = EnumDotType.ACTIVE; | ||
} | ||
} else if (idx < 4) { | ||
type = EnumDotType.MEDIUM; | ||
} else { | ||
type = EnumDotType.SMALL; | ||
|
||
} | ||
} else if (curPage === 3) { | ||
//4번째 페이지 일때 배열은 별도로 지정해줌 | ||
// 배열 | ||
// 중 큰 큰 큰 중 | ||
if (idx < 4) { | ||
if (idx === 0) { | ||
type = EnumDotType.MEDIUM | ||
} else { | ||
type = EnumDotType.INACTIVE; | ||
|
||
if (curPage === idx) { | ||
type = EnumDotType.ACTIVE | ||
} | ||
} | ||
} else if (curPage + 1 === idx) { | ||
type = EnumDotType.MEDIUM | ||
} else { | ||
type = EnumDotType.SMALL | ||
} | ||
} else { | ||
//기타는 모두 동일한 로직으로 돌아가도록 | ||
if (idx > curPage) { | ||
if (idx === curPage + 1) { | ||
type = EnumDotType.MEDIUM | ||
} | ||
} else if (idx < curPage) { | ||
if (idx >= curPage - 2) { | ||
type = EnumDotType.INACTIVE | ||
} else if (idx === curPage - 3) { | ||
type = EnumDotType.MEDIUM | ||
} | ||
} else { | ||
type = EnumDotType.ACTIVE; | ||
} | ||
} | ||
|
||
return DotStyle[type]; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.