From 0c5ad07f0e11c29223f3ec1c205173365ac283a8 Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Wed, 22 May 2024 11:51:49 +0900 Subject: [PATCH] feat: Update search bar component --- src/components/common/FilledButton.vue | 4 ++ src/components/common/KakaoMap.vue | 9 ++- src/components/common/SearchBox.vue | 51 +++++++++++++++ src/components/common/Select.vue | 26 +++++--- src/components/common/VSelect.vue | 20 ------ src/components/search/AttractionItem.vue | 5 ++ src/components/search/SearchBar.vue | 79 +++++++----------------- src/router/index.js | 32 +++++----- src/stores/attractionStore.js | 1 + src/views/TestView.vue | 25 -------- 10 files changed, 123 insertions(+), 129 deletions(-) create mode 100644 src/components/common/SearchBox.vue delete mode 100644 src/components/common/VSelect.vue delete mode 100644 src/views/TestView.vue diff --git a/src/components/common/FilledButton.vue b/src/components/common/FilledButton.vue index f9273cb..85e9eb7 100644 --- a/src/components/common/FilledButton.vue +++ b/src/components/common/FilledButton.vue @@ -35,6 +35,10 @@ button { transform 0.25s; } +button:active { + transform: scale(0.95); +} + button:disabled { cursor: initial; } diff --git a/src/components/common/KakaoMap.vue b/src/components/common/KakaoMap.vue index dc02c5c..3eae136 100644 --- a/src/components/common/KakaoMap.vue +++ b/src/components/common/KakaoMap.vue @@ -28,13 +28,12 @@ onMounted(() => { oldMarkers.forEach((marker) => marker.setMap(null)); newMarkers.forEach((marker) => marker.setMap(map)); target; - setTarget(newMarkers[0].getPosition()); + if (!oldMarkers[0] || !newMarkers[0].getPosition().equals(oldMarkers[0].getPosition())) { + setTarget(newMarkers[0].getPosition()); + } }); - watch(target, (newTarget, oldTarget) => { - if (oldTarget && newTarget.La === oldTarget.La && newTarget.Ma === oldTarget.Ma) { - return; - } + watch(target, (newTarget) => { map.panTo(newTarget); }); }); diff --git a/src/components/common/SearchBox.vue b/src/components/common/SearchBox.vue new file mode 100644 index 0000000..f20b87b --- /dev/null +++ b/src/components/common/SearchBox.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/components/common/Select.vue b/src/components/common/Select.vue index 452ce7e..187cc6c 100644 --- a/src/components/common/Select.vue +++ b/src/components/common/Select.vue @@ -1,9 +1,9 @@ - - \ No newline at end of file diff --git a/src/components/search/AttractionItem.vue b/src/components/search/AttractionItem.vue index 3ee4989..a4f3365 100644 --- a/src/components/search/AttractionItem.vue +++ b/src/components/search/AttractionItem.vue @@ -60,6 +60,11 @@ function handleClick() { border: 1px solid var(--color-border); background-color: var(--color-background); cursor: pointer; + transition: transform 0.25s; +} + +.attraction:active { + transform: scale(0.98); } .info { diff --git a/src/components/search/SearchBar.vue b/src/components/search/SearchBar.vue index 2f483e8..a97b47f 100644 --- a/src/components/search/SearchBar.vue +++ b/src/components/search/SearchBar.vue @@ -1,11 +1,12 @@ - - \ No newline at end of file