권주희

display the kakao map in main page

- display the kakao map in main page
- add search location box
- create the marker to each map
...@@ -1274,6 +1274,24 @@ ...@@ -1274,6 +1274,24 @@
1274 "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", 1274 "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz",
1275 "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" 1275 "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg=="
1276 }, 1276 },
1277 + "@emotion/is-prop-valid": {
1278 + "version": "0.8.8",
1279 + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz",
1280 + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==",
1281 + "requires": {
1282 + "@emotion/memoize": "0.7.4"
1283 + }
1284 + },
1285 + "@emotion/memoize": {
1286 + "version": "0.7.4",
1287 + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz",
1288 + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw=="
1289 + },
1290 + "@emotion/unitless": {
1291 + "version": "0.7.5",
1292 + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz",
1293 + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg=="
1294 + },
1277 "@hapi/address": { 1295 "@hapi/address": {
1278 "version": "2.1.4", 1296 "version": "2.1.4",
1279 "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", 1297 "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
...@@ -2848,6 +2866,22 @@ ...@@ -2848,6 +2866,22 @@
2848 "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz", 2866 "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz",
2849 "integrity": "sha512-1aGDUfL1qOOIoqk9QKGIo2lANk+C7ko/fqH0uIyC71x3PEGz0uVP8ISgfEsFuG+FKmjHTvFK/nNM8dowpmUxLA==" 2867 "integrity": "sha512-1aGDUfL1qOOIoqk9QKGIo2lANk+C7ko/fqH0uIyC71x3PEGz0uVP8ISgfEsFuG+FKmjHTvFK/nNM8dowpmUxLA=="
2850 }, 2868 },
2869 + "babel-plugin-styled-components": {
2870 + "version": "1.10.7",
2871 + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.7.tgz",
2872 + "integrity": "sha512-MBMHGcIA22996n9hZRf/UJLVVgkEOITuR2SvjHLb5dSTUyR4ZRGn+ngITapes36FI3WLxZHfRhkA1ffHxihOrg==",
2873 + "requires": {
2874 + "@babel/helper-annotate-as-pure": "^7.0.0",
2875 + "@babel/helper-module-imports": "^7.0.0",
2876 + "babel-plugin-syntax-jsx": "^6.18.0",
2877 + "lodash": "^4.17.11"
2878 + }
2879 + },
2880 + "babel-plugin-syntax-jsx": {
2881 + "version": "6.18.0",
2882 + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz",
2883 + "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY="
2884 + },
2851 "babel-plugin-syntax-object-rest-spread": { 2885 "babel-plugin-syntax-object-rest-spread": {
2852 "version": "6.13.0", 2886 "version": "6.13.0",
2853 "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", 2887 "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz",
...@@ -3160,6 +3194,11 @@ ...@@ -3160,6 +3194,11 @@
3160 "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", 3194 "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
3161 "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" 3195 "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
3162 }, 3196 },
3197 + "bootstrap": {
3198 + "version": "3.4.1",
3199 + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.4.1.tgz",
3200 + "integrity": "sha512-yN5oZVmRCwe5aKwzRj6736nSmKDX7pLYwsXiCj/EYmo16hODaBiT4En5btW/jhBF/seV+XMx3aYwukYC3A49DA=="
3201 + },
3163 "brace-expansion": { 3202 "brace-expansion": {
3164 "version": "1.1.11", 3203 "version": "1.1.11",
3165 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 3204 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
...@@ -3447,6 +3486,11 @@ ...@@ -3447,6 +3486,11 @@
3447 "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 3486 "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
3448 "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" 3487 "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
3449 }, 3488 },
3489 + "camelize": {
3490 + "version": "1.0.0",
3491 + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz",
3492 + "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs="
3493 + },
3450 "caniuse-api": { 3494 "caniuse-api": {
3451 "version": "3.0.0", 3495 "version": "3.0.0",
3452 "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", 3496 "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz",
...@@ -4087,6 +4131,11 @@ ...@@ -4087,6 +4131,11 @@
4087 "postcss": "^7.0.5" 4131 "postcss": "^7.0.5"
4088 } 4132 }
4089 }, 4133 },
4134 + "css-color-keywords": {
4135 + "version": "1.0.0",
4136 + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz",
4137 + "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU="
4138 + },
4090 "css-color-names": { 4139 "css-color-names": {
4091 "version": "0.0.4", 4140 "version": "0.0.4",
4092 "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", 4141 "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
...@@ -4170,6 +4219,23 @@ ...@@ -4170,6 +4219,23 @@
4170 "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", 4219 "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz",
4171 "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==" 4220 "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w=="
4172 }, 4221 },
4222 + "css-to-react-native": {
4223 + "version": "2.3.2",
4224 + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-2.3.2.tgz",
4225 + "integrity": "sha512-VOFaeZA053BqvvvqIA8c9n0+9vFppVBAHCp6JgFTtTMU3Mzi+XnelJ9XC9ul3BqFzZyQ5N+H0SnwsWT2Ebchxw==",
4226 + "requires": {
4227 + "camelize": "^1.0.0",
4228 + "css-color-keywords": "^1.0.0",
4229 + "postcss-value-parser": "^3.3.0"
4230 + },
4231 + "dependencies": {
4232 + "postcss-value-parser": {
4233 + "version": "3.3.1",
4234 + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
4235 + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ=="
4236 + }
4237 + }
4238 + },
4173 "css-tree": { 4239 "css-tree": {
4174 "version": "1.0.0-alpha.37", 4240 "version": "1.0.0-alpha.37",
4175 "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", 4241 "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz",
...@@ -4361,6 +4427,11 @@ ...@@ -4361,6 +4427,11 @@
4361 } 4427 }
4362 } 4428 }
4363 }, 4429 },
4430 + "daum-map-api": {
4431 + "version": "1.0.2",
4432 + "resolved": "https://registry.npmjs.org/daum-map-api/-/daum-map-api-1.0.2.tgz",
4433 + "integrity": "sha1-3hbrEB11Ea5dZC/CZsl/lHmJiqQ="
4434 + },
4364 "debug": { 4435 "debug": {
4365 "version": "2.6.9", 4436 "version": "2.6.9",
4366 "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 4437 "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
...@@ -7391,6 +7462,11 @@ ...@@ -7391,6 +7462,11 @@
7391 "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 7462 "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
7392 "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 7463 "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
7393 }, 7464 },
7465 + "is-what": {
7466 + "version": "3.8.0",
7467 + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.8.0.tgz",
7468 + "integrity": "sha512-UKeBoQfV8bjlM4pmx1FLDHdxslW/1mTksEs8ReVsilPmUv5cORd4+2/wFcviI3cUjrLybxCjzc8DnodAzJ/Wrg=="
7469 + },
7394 "is-windows": { 7470 "is-windows": {
7395 "version": "1.0.2", 7471 "version": "1.0.2",
7396 "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", 7472 "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
...@@ -8453,6 +8529,11 @@ ...@@ -8453,6 +8529,11 @@
8453 "p-is-promise": "^2.0.0" 8529 "p-is-promise": "^2.0.0"
8454 } 8530 }
8455 }, 8531 },
8532 + "memoize-one": {
8533 + "version": "5.1.1",
8534 + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz",
8535 + "integrity": "sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA=="
8536 + },
8456 "memory-fs": { 8537 "memory-fs": {
8457 "version": "0.4.1", 8538 "version": "0.4.1",
8458 "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", 8539 "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
...@@ -8491,6 +8572,14 @@ ...@@ -8491,6 +8572,14 @@
8491 } 8572 }
8492 } 8573 }
8493 }, 8574 },
8575 + "merge-anything": {
8576 + "version": "2.4.4",
8577 + "resolved": "https://registry.npmjs.org/merge-anything/-/merge-anything-2.4.4.tgz",
8578 + "integrity": "sha512-l5XlriUDJKQT12bH+rVhAHjwIuXWdAIecGwsYjv2LJo+dA1AeRTmeQS+3QBpO6lEthBMDi2IUMpLC1yyRvGlwQ==",
8579 + "requires": {
8580 + "is-what": "^3.3.1"
8581 + }
8582 + },
8494 "merge-deep": { 8583 "merge-deep": {
8495 "version": "3.0.2", 8584 "version": "3.0.2",
8496 "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.2.tgz", 8585 "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.2.tgz",
...@@ -11132,6 +11221,19 @@ ...@@ -11132,6 +11221,19 @@
11132 "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", 11221 "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
11133 "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" 11222 "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
11134 }, 11223 },
11224 + "react-kakao-maps": {
11225 + "version": "0.0.13",
11226 + "resolved": "https://registry.npmjs.org/react-kakao-maps/-/react-kakao-maps-0.0.13.tgz",
11227 + "integrity": "sha512-1ZHGbdvucFpq3rPSee1UB8cY/61QloQeH2Kh1SMSvIoL2kIUIo1lbF8FnwkHo3zrbpqcS4kIFPvvDB5xs27MdA==",
11228 + "requires": {
11229 + "@babel/runtime-corejs3": "^7.6.2",
11230 + "babel-runtime": "^6.26.0",
11231 + "react": "^16.9.0",
11232 + "react-dom": "^16.9.0",
11233 + "scriptjs": "^2.5.9",
11234 + "styled-components": "^4.3.2"
11235 + }
11236 + },
11135 "react-lifecycles-compat": { 11237 "react-lifecycles-compat": {
11136 "version": "3.0.4", 11238 "version": "3.0.4",
11137 "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", 11239 "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
...@@ -11867,6 +11969,11 @@ ...@@ -11867,6 +11969,11 @@
11867 "ajv-keywords": "^3.4.1" 11969 "ajv-keywords": "^3.4.1"
11868 } 11970 }
11869 }, 11971 },
11972 + "scriptjs": {
11973 + "version": "2.5.9",
11974 + "resolved": "https://registry.npmjs.org/scriptjs/-/scriptjs-2.5.9.tgz",
11975 + "integrity": "sha512-qGVDoreyYiP1pkQnbnFAUIS5AjenNwwQBdl7zeos9etl+hYKWahjRTfzAZZYBv5xNHx7vNKCmaLDQZ6Fr2AEXg=="
11976 + },
11870 "select-hose": { 11977 "select-hose": {
11871 "version": "2.0.0", 11978 "version": "2.0.0",
11872 "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", 11979 "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
...@@ -12817,6 +12924,36 @@ ...@@ -12817,6 +12924,36 @@
12817 } 12924 }
12818 } 12925 }
12819 }, 12926 },
12927 + "styled-components": {
12928 + "version": "4.4.1",
12929 + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-4.4.1.tgz",
12930 + "integrity": "sha512-RNqj14kYzw++6Sr38n7197xG33ipEOktGElty4I70IKzQF1jzaD1U4xQ+Ny/i03UUhHlC5NWEO+d8olRCDji6g==",
12931 + "requires": {
12932 + "@babel/helper-module-imports": "^7.0.0",
12933 + "@babel/traverse": "^7.0.0",
12934 + "@emotion/is-prop-valid": "^0.8.1",
12935 + "@emotion/unitless": "^0.7.0",
12936 + "babel-plugin-styled-components": ">= 1",
12937 + "css-to-react-native": "^2.2.2",
12938 + "memoize-one": "^5.0.0",
12939 + "merge-anything": "^2.2.4",
12940 + "prop-types": "^15.5.4",
12941 + "react-is": "^16.6.0",
12942 + "stylis": "^3.5.0",
12943 + "stylis-rule-sheet": "^0.0.10",
12944 + "supports-color": "^5.5.0"
12945 + },
12946 + "dependencies": {
12947 + "supports-color": {
12948 + "version": "5.5.0",
12949 + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
12950 + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
12951 + "requires": {
12952 + "has-flag": "^3.0.0"
12953 + }
12954 + }
12955 + }
12956 + },
12820 "stylehacks": { 12957 "stylehacks": {
12821 "version": "4.0.3", 12958 "version": "4.0.3",
12822 "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", 12959 "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz",
...@@ -12839,6 +12976,16 @@ ...@@ -12839,6 +12976,16 @@
12839 } 12976 }
12840 } 12977 }
12841 }, 12978 },
12979 + "stylis": {
12980 + "version": "3.5.4",
12981 + "resolved": "https://registry.npmjs.org/stylis/-/stylis-3.5.4.tgz",
12982 + "integrity": "sha512-8/3pSmthWM7lsPBKv7NXkzn2Uc9W7NotcwGNpJaa3k7WMM1XDCA4MgT5k/8BIexd5ydZdboXtU90XH9Ec4Bv/Q=="
12983 + },
12984 + "stylis-rule-sheet": {
12985 + "version": "0.0.10",
12986 + "resolved": "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz",
12987 + "integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw=="
12988 + },
12842 "supports-color": { 12989 "supports-color": {
12843 "version": "6.1.0", 12990 "version": "6.1.0",
12844 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", 12991 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
......
...@@ -6,9 +6,12 @@ ...@@ -6,9 +6,12 @@
6 "@testing-library/jest-dom": "^4.2.4", 6 "@testing-library/jest-dom": "^4.2.4",
7 "@testing-library/react": "^9.3.2", 7 "@testing-library/react": "^9.3.2",
8 "@testing-library/user-event": "^7.1.2", 8 "@testing-library/user-event": "^7.1.2",
9 + "bootstrap": "^3.4.1",
10 + "daum-map-api": "^1.0.2",
9 "react": "^16.13.1", 11 "react": "^16.13.1",
10 "react-bootstrap": "^1.0.1", 12 "react-bootstrap": "^1.0.1",
11 "react-dom": "^16.13.1", 13 "react-dom": "^16.13.1",
14 + "react-kakao-maps": "0.0.13",
12 "react-router-dom": "^5.2.0", 15 "react-router-dom": "^5.2.0",
13 "react-scripts": "3.4.1" 16 "react-scripts": "3.4.1"
14 }, 17 },
......
...@@ -10,6 +10,16 @@ ...@@ -10,6 +10,16 @@
10 content="Web site created using create-react-app" 10 content="Web site created using create-react-app"
11 /> 11 />
12 <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> 12 <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13 + <script
14 + type="text/javascript"
15 + src="//dapi.kakao.com/v2/maps/sdk.js?appkey=61abec34d0855ba1d434ea222263d4a5&libraries=services,clusterer,drawing"
16 + ></script>
17 + <link
18 + rel="stylesheet"
19 + href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
20 + integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
21 + crossorigin="anonymous"
22 + />
13 <!-- 23 <!--
14 manifest.json provides metadata used when your web app is installed on a 24 manifest.json provides metadata used when your web app is installed on a
15 user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ 25 user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
...@@ -24,7 +34,7 @@ ...@@ -24,7 +34,7 @@
24 work correctly both with client-side routing and a non-root public URL. 34 work correctly both with client-side routing and a non-root public URL.
25 Learn how to configure a non-root public URL by running `npm run build`. 35 Learn how to configure a non-root public URL by running `npm run build`.
26 --> 36 -->
27 - <title>React App</title> 37 + <title>HowsTheWeather</title>
28 </head> 38 </head>
29 <body> 39 <body>
30 <noscript>You need to enable JavaScript to run this app.</noscript> 40 <noscript>You need to enable JavaScript to run this app.</noscript>
......
...@@ -3,6 +3,10 @@ import logo from "./logo.svg"; ...@@ -3,6 +3,10 @@ import logo from "./logo.svg";
3 import "./App.css"; 3 import "./App.css";
4 import Button from "react-bootstrap/Button"; 4 import Button from "react-bootstrap/Button";
5 import "./home.css"; 5 import "./home.css";
6 +import { Map, Marker, MarkerClusterer, Polyline } from "react-kakao-maps";
7 +import "bootstrap/dist/css/bootstrap.min.css";
8 +
9 +/* global kakao */
6 10
7 export default class Home extends Component { 11 export default class Home extends Component {
8 constructor(props) { 12 constructor(props) {
...@@ -10,10 +14,210 @@ export default class Home extends Component { ...@@ -10,10 +14,210 @@ export default class Home extends Component {
10 this.state = { 14 this.state = {
11 map: null, 15 map: null,
12 markers: [], 16 markers: [],
17 + markers: [],
18 + curMarker: new kakao.maps.Marker({
19 + position: new kakao.maps.LatLng(37.503716, 127.044844),
20 + }),
21 + placeSearch: new kakao.maps.services.Places(),
22 + infoWindow: new kakao.maps.CustomOverlay({}),
23 + region: "은평구청",
13 24
14 - curAirCondition: null, 25 + // curAirCondition: null,
15 - routeInformation: null, 26 + // routeInformation: null,
16 }; 27 };
28 + this.removeAllChildNods = this.removeAllChildNods.bind(this);
29 + }
30 +
31 + searchPlaces() {
32 + var keyword = document.getElementById("keyword").value;
33 +
34 + if (!keyword.replace(/^\s+|\s+$/g, "")) {
35 + alert("키워드를 입력해주세요!");
36 + return false;
37 + }
38 + // 장소검색 객체를 통해 키워드로 장소검색을 요청합니다
39 + this.state.placeSearch.keywordSearch(
40 + keyword,
41 + this.placesSearchCB.bind(this)
42 + );
43 + }
44 +
45 + // 장소검색이 완료됐을 때 호출되는 콜백함수 입니다
46 + placesSearchCB(data, status, pagination) {
47 + if (status === kakao.maps.services.Status.OK) {
48 + // 정상적으로 검색이 완료됐으면
49 + // 검색 목록과 마커를 표출합니다
50 + this.displayPlaces(data);
51 +
52 + // 페이지 번호를 표출합니다
53 + this.displayPagination(pagination);
54 + } else if (status === kakao.maps.services.Status.ZERO_RESULT) {
55 + alert("검색 결과가 존재하지 않습니다.");
56 + return;
57 + } else if (status === kakao.maps.services.Status.ERROR) {
58 + alert("검색 결과 중 오류가 발생했습니다.");
59 + return;
60 + }
61 + }
62 +
63 + displayPlaces(places) {
64 + var listEl = document.getElementById("placesList"),
65 + menuEl = document.getElementById("menu_wrap"),
66 + fragment = document.createDocumentFragment(),
67 + bounds = new kakao.maps.LatLngBounds(),
68 + listStr = "";
69 +
70 + // 검색 결과 목록에 추가된 항목들을 제거합니다
71 + // 페이지별로 보여주기 때문에 추가한 것 같음.
72 + this.removeAllChildNods(listEl);
73 +
74 + // 지도에 표시되고 있는 마커를 제거합니다
75 + this.removeMarker();
76 +
77 + for (var i = 0; i < places.length; i++) {
78 + // 마커를 생성하고 지도에 표시합니다
79 + var placePosition = new kakao.maps.LatLng(places[i].y, places[i].x),
80 + marker = this.addMarker(placePosition, i),
81 + itemEl = this.getListItem(i, places[i]); // 검색 결과 항목 Element를 생성합니다
82 +
83 + // 검색된 장소 위치를 기준으로 지도 범위를 재설정하기위해
84 + // LatLngBounds 객체에 좌표를 추가합니다
85 + bounds.extend(placePosition);
86 +
87 + // 마커와 검색결과 항목에 mouseover 했을때
88 + // 해당 장소에 인포윈도우에 장소명을 표시합니다
89 + // mouseout 했을 때는 인포윈도우를 닫습니다
90 +
91 + // 함수를 조건문처럼 사용하여 해당 함수가 true일때 marker,places[i].place_name함수가 불리워짐.
92 +
93 + fragment.appendChild(itemEl);
94 + }
95 +
96 + // 검색결과 항목들을 검색결과 목록 Elemnet에 추가합니다
97 + listEl.appendChild(fragment);
98 + menuEl.scrollTop = 0;
99 +
100 + // 검색된 장소 위치를 기준으로 지도 범위를 재설정합니다
101 + this.state.map.setBounds(bounds);
102 + }
103 + // 커스텀 오버레이를 닫기 위해 호출되는 함수입니다
104 + closeOverlay() {
105 + this.state.infoWindow.setMap(null);
106 + }
107 +
108 + getListItem(index, places) {
109 + var el = document.createElement("li"),
110 + itemStr =
111 + '<span class="markerbg marker_' +
112 + (index + 1) +
113 + '"></span>' +
114 + '<div class="info">' +
115 + " <h5>" +
116 + places.place_name +
117 + "</h5>";
118 +
119 + if (places.road_address_name) {
120 + itemStr +=
121 + " <span>" +
122 + places.road_address_name +
123 + "</span>" +
124 + ' <span class="jibun gray">' +
125 + places.address_name +
126 + "</span>";
127 + } else {
128 + itemStr += " <span>" + places.address_name + "</span>";
129 + }
130 +
131 + itemStr += ' <span class="tel">' + places.phone + "</span>" + "</div>";
132 +
133 + el.innerHTML = itemStr;
134 + el.className = "item";
135 +
136 + return el;
137 + }
138 +
139 + addMarker(position, idx, title) {
140 + var imageSrc =
141 + "http://t1.daumcdn.net/localimg/localimages/07/mapapidoc/marker_number_blue.png", // 마커 이미지 url, 스프라이트 이미지를 씁니다
142 + imageSize = new kakao.maps.Size(36, 37), // 마커 이미지의 크기
143 + imgOptions = {
144 + spriteSize: new kakao.maps.Size(36, 691), // 스프라이트 이미지의 크기
145 + spriteOrigin: new kakao.maps.Point(0, idx * 46 + 10), // 스프라이트 이미지 중 사용할 영역의 좌상단 좌표
146 + offset: new kakao.maps.Point(13, 37), // 마커 좌표에 일치시킬 이미지 내에서의 좌표
147 + },
148 + markerImage = new kakao.maps.MarkerImage(imageSrc, imageSize, imgOptions),
149 + marker = new kakao.maps.Marker({
150 + position: position, // 마커의 위치
151 + image: markerImage,
152 + });
153 +
154 + marker.setMap(this.state.map); // 지도 위에 마커를 표출합니다
155 + this.setState({ curMarker: marker });
156 + this.state.markers.push(marker); // 배열에 생성된 마커를 추가합니다
157 +
158 + return marker;
159 + }
160 +
161 + // 지도 위에 표시되고 있는 마커를 모두 제거합니다
162 + removeMarker() {
163 + for (var i = 0; i < this.state.markers.length; i++) {
164 + this.state.markers[i].setMap(null);
165 + }
166 + this.setState({
167 + markers: [],
168 + });
169 + }
170 +
171 + // 검색결과 목록 하단에 페이지번호를 표시는 함수입니다
172 + displayPagination(pagination) {
173 + var paginationEl = document.getElementById("pagination"),
174 + fragment = document.createDocumentFragment(),
175 + i;
176 +
177 + // 기존에 추가된 페이지번호를 삭제합니다
178 + while (paginationEl.hasChildNodes()) {
179 + paginationEl.removeChild(paginationEl.lastChild);
180 + }
181 +
182 + for (i = 1; i <= pagination.last; i++) {
183 + var el = document.createElement("a");
184 + el.href = "#";
185 + el.innerHTML = i;
186 +
187 + if (i === pagination.current) {
188 + el.className = "on";
189 + } else {
190 + el.onclick = (function (i) {
191 + return function () {
192 + pagination.gotoPage(i);
193 + };
194 + })(i);
195 + }
196 +
197 + fragment.appendChild(el);
198 + }
199 + paginationEl.appendChild(fragment);
200 + }
201 +
202 + removeAllChildNods(el) {
203 + while (el.hasChildNodes()) {
204 + el.removeChild(el.lastChild);
205 + }
206 + }
207 +
208 + componentDidMount() {
209 + // 컴포넌트가 만들어지고, render 함수가 호출된 이후에 호출되는 메소
210 + // AJAX나 타이머를 생성하는 코드를 작성하는 파트이다.
211 + let el = document.getElementById("map");
212 + this.setState({
213 + map: new kakao.maps.Map(el, {
214 + //map option 설정
215 + center: new kakao.maps.LatLng(37.503716, 127.044844),
216 + level: 3,
217 + }),
218 + });
219 + this.searchPlaces();
220 + // marker.setMap(map);
17 } 221 }
18 222
19 render() { 223 render() {
...@@ -28,7 +232,11 @@ export default class Home extends Component { ...@@ -28,7 +232,11 @@ export default class Home extends Component {
28 <div className="map_wrap"> 232 <div className="map_wrap">
29 <div 233 <div
30 id="map" 234 id="map"
31 - style={{ width: "1000px", height: "600px", align: "middle" }} 235 + style={{
236 + width: "1000px",
237 + height: "600px",
238 + align: "middle",
239 + }}
32 ></div> 240 ></div>
33 <div id="menu_wrap" className="bg_white"> 241 <div id="menu_wrap" className="bg_white">
34 <div className="option"> 242 <div className="option">
......