Skip to content

Commit

Permalink
Merge pull request #162 from chaeyeon-yang/feat/naverDirect
Browse files Browse the repository at this point in the history
feat: 모바일 반응형 카드 스타일 변경
  • Loading branch information
LeeJSYS authored Sep 29, 2023
2 parents c990fc0 + 17f497e commit 95430bb
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/atoms/LocationClassificationBtn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const LocationClassificationBtn = ({
};

return (
<div className="flex flex-wrap gap-2">
<div className="flex flex-wrap lg:max-w-540 lg:px-10 gap-2">
{classifications.map((item, index) => (
<button
key={item.id}
Expand Down
12 changes: 6 additions & 6 deletions src/components/molecules/Store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Store = ({
}, [selectedClassificationName, classifications]);

return (
<>
<div className="flex flex-col justify-center items-start lg:items-center">
{storeList.map((store, index) => (
<div key={index}>
<div
Expand All @@ -49,7 +49,7 @@ const Store = ({
)?.name
: ""}
</div>
<div className="grid grid-cols-3 grid-flow-row lg:grid-cols-2 gap-4">
<div className="grid grid-cols-3 grid-flow-row gap-4 lg:grid-cols-2 mdMaxlg:grid-cols-2">
{store.stores.map((storeItem, itemIndex) => (
<div
className="flex mb-12"
Expand All @@ -67,18 +67,18 @@ const Store = ({
}
}}
>
<div className="flex flex-col items-center">
<div className="flex flex-col items-center justify-center">
{storeItem.thumbnail ? (
<img
src={`${storeItem.thumbnail}`}
alt="Image"
className="w-248 h-174 rounded-12 sm:h-106 "
className="w-248 h-174 rounded-12 sm:w-152 sm:h-106 smMaxLg:h-204 smMaxLg:w-292"
/>
) : (
<img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATcAAACiCAMAAAATIHpEAAAAwFBMVEUNDQ3///9UxQMAAAAICAhdXV1RvwMYGBjr6+sAAA3Ly8vBwcHd3d2ampqsrKyAgIBWywFlZWWOjo4uZwn4+Ph0dHTQ0NA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gx0i0Jno1sE7qmfjW72xLTRzZ6cNrpZC0wb3WwFp41ulpaz0c3KSja62VjNRjcLhmx0C+f+WM1Gt1Bi2rwO3WzpafO6nZ7n0c2KyNbv9PvdJ7rZEI9tXvO5+TwY0s2CzDYav/weNHl8syCfSYev3f4bzws23F86m/fe7PX8aZvY9sF9XfIkHfSePj9EtqPTbR/dlxV4bOv0xj1PZuP7SGvIk/Rz1HseOGSzoKet6Y2euqO3F7JZ0NPmvb9+fAzH8iQ9Idsa8iQddkfj7pBpsyCyea+j5vsn02ZDTpsz6vc7e2SzEMjmeM7YIZsF99LwNiXZwgSnjWyWmLZYmLZYNk7bI9nWIFss7qWzt46znO0P0C5RpYuDlLsAAAAASUVORK5CYII="
alt="Image"
className="w-248 h-174 rounded-12 sm:h-106"
className="w-248 h-174 rounded-12 sm:w-152 sm:h-106 smMaxLg:h-204 smMaxLg:w-292"
/>
)}
<div className="text-gray-700 text-16 font-semibold mt-12">{storeItem.name}</div>
Expand All @@ -89,7 +89,7 @@ const Store = ({
</div>
</div>
))}
</>
</div>
);
};

Expand Down
30 changes: 30 additions & 0 deletions src/components/pages/RentalLocation/RentalLocationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import ClassificationsButtons from "@/components/pages/RentalLocation/Classifica
const RentalInfo = () => {
const { naver } = window;
const mapElement = useRef<HTMLDivElement | null>(null);

// Ref를 사용하여 맵의 너비 동적으로 가져오기
const mapWidth = mapElement.current?.offsetWidth ?? null;

Expand Down Expand Up @@ -119,6 +120,34 @@ const RentalInfo = () => {
storeListRes,
]);

useEffect(() => {
if (storeMarker.data && storeMarker.data.length > 0 && showInitialCard) {
const randomIndex = Math.floor(Math.random() * storeMarker.data.length);
const randomStore = storeMarker.data[randomIndex].id;
setSelectedStoreId(randomStore);
setShowInitialCard(false);
}
}, [storeMarker.data, showInitialCard]);

useEffect(() => {
if (userPosition && storeMarker.data && storeMarker.data.length > 0) {
const distances = storeMarker.data.map((store) =>
getDistanceFromLatLonInKm(
userPosition.lat,
userPosition.lng,
store.latitude,
store.longitude
)
);

const minDistanceIndex = distances.indexOf(Math.min(...distances));

if (!showInitialCard) {
setSelectedStoreId(storeMarker.data[minDistanceIndex].id);
}
}
}, [userPosition, storeMarker.data, showInitialCard]);

useEffect(() => {
getUserPosition().then(
(position) =>
Expand Down Expand Up @@ -153,6 +182,7 @@ const RentalInfo = () => {
}
}, [storeListRes, userPosition]);


return (
<div className="flex flex-col mt-24">
<div className="flex justify-center">
Expand Down
3 changes: 0 additions & 3 deletions src/components/pages/RentalLocation/webMarker.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/pages/rentalOffice/RentalOfficePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const RentalOfficePage = () => {
const { data: useGetStoreDetailData } = useGetStoreDetail(selectedStoreId ?? 1);

return (
<div className="flex justify-center mt-24 md:mt-0 md:flex-col sm:px-20">
<div className="flex justify-center mt-24 md:mt-0 md:flex-col sm:px-0">
<div className="flex mr-24 md:hidden lg:hidden">
{useGetStoreDetailData && <Card storeDetail={useGetStoreDetailData} />}
</div>
Expand Down
2 changes: 2 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default {
md: { max: "640px" },
mdMaxMin: { max: "640px", min: "360px" },
lg: { max: "1024px" },
smMaxLg: { max: "1024px", min: "360px" },
mdMaxlg: { max: "1279px", min: "1025px" },
lgMaxMin: { max: "1024px", min: "360px" },
xl: { min: "1025px" },
},
Expand Down

0 comments on commit 95430bb

Please sign in to comment.