Skip to content

Commit 3caf8a6

Browse files
authored
Merge pull request #23 from ChalkPE/master
Replace object type w/ proper type definitions
2 parents 0cd9622 + 87cb08e commit 3caf8a6

3 files changed

Lines changed: 30 additions & 8 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-daum-postcode
22

3-
리액트 컴포넌트로 만든 Daum 우편번호 검색 서비스입니다. Daum 우편번호 검색 서비스를 React환경에서 간편하게 이용할 수 있습니다.
3+
리액트 컴포넌트로 만든 Daum 우편번호 검색 서비스입니다. Daum 우편번호 검색 서비스를 React 환경에서 간편하게 이용할 수 있습니다.
44

55
## 설치
66

@@ -53,7 +53,7 @@ const Postcode = () => {
5353
- `autoResize` _[bool]_ - 우편번호를 검색할 때 검색 결과에 따라 컴포넌트의 세로 길이를 자동으로 조절합니다. 기본값: `false`
5454
- `animation` _[bool]_ - 우편번호를 검색할 때 애니메이션 효과를 줍니다. 기본값: `false`
5555
- `defaultQuery` _[string]_ - 우편번호 검색창에 미리 표시할 검색어입니다. 기본값: `null`
56-
- `theme` _[object]_ - Daum 우편번호 검색 모듈에 적용할 테마입니다. 테마의 설정은 [Daum 우편번호 서비스 가이드](http://postcode.map.daum.net/guide)를 참고해주세요. 기본값: `null`
56+
- `theme` _[object]_ - Daum 우편번호 검색 모듈에 적용할 테마입니다. 테마의 설정은 [Daum 우편번호 서비스 가이드](http://postcode.map.daum.net/guide#themeWizard)를 참고해주세요. 기본값: `null`
5757
- `style` _[object]_ - 우편번호 검색창을 감싸는 최상위 컴포넌트에 적용할 스타일입니다. 기본값: `null`
5858
- `scriptUrl` _[string]_ - 컴포넌트에서 사용할 Daum 우편번호 스크립트 주소입니다. 기본값: `'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js'`
5959
- `errorMessage` _[React element]_ - Daum 우편번호 스크립트가 로드되지 않을 때 나타낼 에러 메시지입니다. 기본값: `<p>현재 Daum 우편번호 서비스를 이용할 수 없습니다. 잠시 후 다시 시도해주세요.</p>`

index.d.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ declare module "react-daum-postcode" {
3838
count: number;
3939
}
4040

41+
type ThemeProps = {
42+
bgColor?: string;
43+
searchBgColor?: string;
44+
contentBgColor?: string;
45+
pageBgColor?: string;
46+
textColor?: string;
47+
queryTextColor?: string;
48+
postcodeTextColor?: string;
49+
emphTextColor?: string;
50+
outlineColor?: string;
51+
}
52+
4153
type DaumPostcodeProps = {
4254
onComplete(data: AddressData): void;
4355
onSearch?(data: SearchData): void;
@@ -57,18 +69,18 @@ declare module "react-daum-postcode" {
5769
scriptUrl?: string;
5870
shorthand?: boolean;
5971
showMoreHName?: boolean;
60-
style?: object;
61-
theme?: object;
72+
style?: React.CSSProperties;
73+
theme?: ThemeProps;
6274
useSuggest?: boolean;
6375
width?: number | string;
6476
submitMode?: boolean;
65-
focusInput?: boolean,
66-
focusContent?: boolean,
77+
focusInput?: boolean;
78+
focusContent?: boolean;
6779
}
6880

6981
class DaumPostcode extends React.Component<DaumPostcodeProps, any> {}
7082

71-
export { AddressData, DaumPostcodeProps, DaumPostcode };
83+
export { AddressData, SearchData, ThemeProps, DaumPostcodeProps, DaumPostcode };
7284

7385
export default DaumPostcode;
7486
}

src/DaumPostcode.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,17 @@ DaumPostcode.propTypes = {
137137
showMoreHName: PropTypes.bool,
138138
style: PropTypes.object,
139139
submitMode: PropTypes.bool,
140-
theme: PropTypes.object,
140+
theme: PropTypes.exact({
141+
bgColor: PropTypes.string,
142+
searchBgColor: PropTypes.string,
143+
contentBgColor: PropTypes.string,
144+
pageBgColor: PropTypes.string,
145+
textColor: PropTypes.string,
146+
queryTextColor: PropTypes.string,
147+
postcodeTextColor: PropTypes.string,
148+
emphTextColor: PropTypes.string,
149+
outlineColor: PropTypes.string,
150+
}),
141151
useSuggest: PropTypes.bool,
142152
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
143153
focusInput: PropTypes.bool,

0 commit comments

Comments
 (0)