Skip to content

Commit

Permalink
Merge pull request #118 from LikeLionHGU/#109/Detail-yeji
Browse files Browse the repository at this point in the history
fix: 디자인 디테일 수정
  • Loading branch information
skwldwld authored Aug 6, 2024
2 parents 985c450 + cbf23de commit 5f65c67
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export const selectedDateState = atom({
});
export const selectedPriceState = atom({
key: "selectedPrice",
default: { min: 0, max: 100000 },
default: {},
// default: { min: 0, max: 100000 },
});
2 changes: 1 addition & 1 deletion src/components/Common/MapCon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function MapCon() {
const OverlayWrapper = styled.div`
background-color: #4aabf9;
width: 191px;
height: 34px;
height: 20px;
border-radius: 10px;
padding: 11px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
Expand Down
21 changes: 15 additions & 6 deletions src/components/MainPage/SelectedContentBox.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React from "react";
import React, { useEffect } from "react";
import styled from "styled-components";
import { useRecoilState } from "recoil";
import { selectedRegionState } from "../../atom";
import { selectedSportTypeState } from "../../atom";
import { selectedDisabilityTypeState } from "../../atom";
import { selectedDateState } from "../../atom";
import { selectedPriceState } from "../../atom";
import { useLocation } from "react-router-dom";

const SelectedContentBox = ({ handleClearSelection, regionOptions = [] }) => {
const location = useLocation();
const currentPath = location.pathname;
const [selectedRegion, setsSlectedRegion] =
useRecoilState(selectedRegionState);
const [selectedSportType, setSelectedSportType] = useRecoilState(
Expand Down Expand Up @@ -35,6 +38,10 @@ const SelectedContentBox = ({ handleClearSelection, regionOptions = [] }) => {
return mainRegion ? mainRegion.name : null;
};

useEffect(() => {
if (currentPath === "/") setSelectedPrice({});
}, []);

return (
<>
{selectedRegion.map((item, index) => {
Expand Down Expand Up @@ -88,11 +95,13 @@ const SelectedContentBox = ({ handleClearSelection, regionOptions = [] }) => {
</ClearButton>
</SelectedContent>
))}
<SelectedPriceContent>
<Hashtag>#</Hashtag>
{selectedPrice.min.toLocaleString()}원 ~{" "}
{selectedPrice.max.toLocaleString()}
</SelectedPriceContent>
{selectedPrice.min !== undefined && selectedPrice.max !== undefined && (
<SelectedPriceContent>
<Hashtag>#</Hashtag>
{selectedPrice.min.toLocaleString()}원 ~{" "}
{selectedPrice.max.toLocaleString()}
</SelectedPriceContent>
)}
</>
);
};
Expand Down

0 comments on commit 5f65c67

Please sign in to comment.