From 39873c3a86504f651511e7f76b2dded66b6bf702 Mon Sep 17 00:00:00 2001 From: YG Date: Tue, 26 Nov 2024 16:36:43 +0900 Subject: [PATCH] feat: apply designed styles --- .../BuildingDetailSheet.mobile.tsx | 33 ++++- .../BuildingDetailSheet.style.ts | 45 ++++++ .../BuildingDetailSheet/PlaceCard.style.ts | 133 +++++++----------- app/modals/BuildingDetailSheet/PlaceCard.tsx | 104 ++++++-------- .../_template/RightSheet/RightSheet.style.ts | 1 + .../_template/RightSheet/RightSheet.tsx | 2 +- 6 files changed, 166 insertions(+), 152 deletions(-) diff --git a/app/modals/BuildingDetailSheet/BuildingDetailSheet.mobile.tsx b/app/modals/BuildingDetailSheet/BuildingDetailSheet.mobile.tsx index e444d79..d2912a7 100644 --- a/app/modals/BuildingDetailSheet/BuildingDetailSheet.mobile.tsx +++ b/app/modals/BuildingDetailSheet/BuildingDetailSheet.mobile.tsx @@ -1,6 +1,7 @@ import { BasicModalProps } from "@reactleaf/modal" import { useQueryClient } from "@tanstack/react-query" import { useAtom } from "jotai" +import Image from "next/image" import { useEffect, useMemo, useState } from "react" import { useQuestBuilding } from "@/lib/apis/api" @@ -58,12 +59,6 @@ export default function BuildingDetailSheet({ building: initialData, questId, vi const title = (
{building.name}
- - 정복 완료 {conquered.length} / {building.places.length} - - - {view === "card" ? : } - @@ -72,6 +67,32 @@ export default function BuildingDetailSheet({ building: initialData, questId, vi return ( + + + {conquered.length === building.places.length ? ( + <> + 정복 완료 + flag + + ) : ( + <> + 퀘스트 상태 {conquered.length}/{building.places.length} +
+ *정복여부는 계단정복지도 앱에 장소 등록 시 자동으로 반영됩니다. + + )} +
+
+ + 폐업 + 접근불가 + {sortedPlaces.map((place) => ( ))} diff --git a/app/modals/BuildingDetailSheet/BuildingDetailSheet.style.ts b/app/modals/BuildingDetailSheet/BuildingDetailSheet.style.ts index f505a48..e0d5c31 100644 --- a/app/modals/BuildingDetailSheet/BuildingDetailSheet.style.ts +++ b/app/modals/BuildingDetailSheet/BuildingDetailSheet.style.ts @@ -35,6 +35,51 @@ export const ReloadButton = styled("button", { }, }) +export const GuideMessage = styled("div", { + base: { + padding: "12px 20px", + margin: "0 16px", + backgroundColor: "var(--leaf-primary-98)", + }, +}) + +export const Status = styled("p", { + base: { + fontSize: 15, + fontWeight: 500, + textAlign: "center", + "& b": { + color: "var(--leaf-primary-70)", + }, + "& small": { + fontSize: 12, + color: "var(--leaf-grey-70)", + letterSpacing: "-0.03em", + }, + }, +}) + +export const Header = styled("div", { + base: { + display: "flex", + paddingTop: 16, + paddingBottom: 4, + margin: "0 16px", + justifyContent: "flex-end", + }, +}) + +export const ChcekcboxLabel = styled("span", { + base: { + display: "inline-block", + width: 50, + textAlign: "center", + fontSize: 14, + fontWeight: 500, + whiteSpace: "pre", + }, +}) + export const ViewToggle = styled("button", { base: { position: "absolute", diff --git a/app/modals/BuildingDetailSheet/PlaceCard.style.ts b/app/modals/BuildingDetailSheet/PlaceCard.style.ts index 638ce85..5146418 100644 --- a/app/modals/BuildingDetailSheet/PlaceCard.style.ts +++ b/app/modals/BuildingDetailSheet/PlaceCard.style.ts @@ -2,68 +2,94 @@ import { styled } from "@/styles/jsx" export const PlaceCard = styled("div", { base: { - margin: "8px 16px", - padding: "16px 20px", - boxShadow: "0px 0px 4px 1px rgba(0,0,0,0.2)", - borderRadius: 4, + display: "flex", + gap: 16, + margin: "0 16px 24px", + alignItems: "flex-end", }, }) -export const Header = styled("div", { +export const NameColumn = styled("div", { base: { display: "flex", - justifyContent: "space-between", - alignItems: "center", - gap: 8, + flexDirection: "column", + width: "calc(100% - 148px)", + flex: 1, + }, +}) + +export const Badges = styled("div", { + base: { + display: "flex", + gap: 4, + marginBottom: 4, + }, +}) + +export const ActionsColumn = styled("div", { + base: { + display: "flex", + flex: "0 0 100px", + gap: 4, + lineHeight: 1, }, }) export const PlaceName = styled("h3", { base: { + display: "flex", + alignItems: "center", + gap: 6, fontSize: 16, - fontWeight: 600, + fontWeight: 500, + "& span": { + whiteSpace: "pre", + textOverflow: "ellipsis", + overflow: "hidden", + }, + }, +}) + +export const CheckboxWrapper = styled("div", { + base: { + width: 48, + textAlign: "center", }, }) export const PlaceStatusBadge = styled("span", { base: { display: "inline-block", - marginLeft: 4, - padding: "2px 4px", + padding: "6px 7px", + borderRadius: 4, fontSize: 12, + lineHeight: 1, color: "white", - borderRadius: 4, verticalAlign: "bottom", }, variants: { status: { + normal: { + backgroundColor: "var(--leaf-primary-95)", + color: "var(--leaf-primary-60)", + }, good: { backgroundColor: "var(--leaf-primary-60)", }, - bad: { - backgroundColor: "#cf3c3b", - }, warn: { - backgroundColor: "#da952e", + backgroundColor: "#FF9202", }, unknown: { - backgroundColor: "#6dd1ad", + backgroundColor: "var(--leaf-grey-95)", + color: "var(--leaf-grey-70)", }, }, }, }) -export const Buttons = styled("div", { - base: { - display: "flex", - justifyContent: "flex-end", - gap: 4, - flexShrink: 0, - }, -}) - export const Button = styled("button", { base: { + flexShrink: 0, border: "1px solid #ccc", borderRadius: 4, background: "white", @@ -71,58 +97,3 @@ export const Button = styled("button", { cursor: "pointer", }, }) - -export const Body = styled("div", { - base: { - display: "flex", - justifyContent: "space-between", - alignItems: "center", - gap: 8, - paddingTop: 16, - }, -}) - -export const ActionButton = styled("button", { - base: { - width: "50%", - height: 36, - borderRadius: 4, - fontSize: 14, - cursor: "pointer", - fontWeight: 500, - }, -}) - -export const ClosedConfirm = styled(ActionButton, { - base: { - border: "1px solid #861500", - color: "#861500", - background: "white", - fontSize: 12, - }, -}) - -export const NotAccessible = styled(ActionButton, { - base: { - border: "1px solid #861500", - color: "#861500", - background: "white", - fontSize: 12, - }, -}) - -export const ConquerButton = styled(ActionButton, { - base: { - background: "var(--leaf-primary-90)", - color: "white", - }, -}) - -export const RevertButton = styled(ActionButton, { - base: { - width: "100%", - background: "white", - border: "1px solid var(--leaf-grey-70)", - color: "var(--leaf-grey-10)", - }, -}) diff --git a/app/modals/BuildingDetailSheet/PlaceCard.tsx b/app/modals/BuildingDetailSheet/PlaceCard.tsx index d5fd4d9..0728d00 100644 --- a/app/modals/BuildingDetailSheet/PlaceCard.tsx +++ b/app/modals/BuildingDetailSheet/PlaceCard.tsx @@ -6,6 +6,8 @@ import { toast } from "react-toastify" import { updateQuestStatus } from "@/lib/apis/api" import { QuestPlace } from "@/lib/models/quest" +import Checkbox from "@/components/Checkbox" + import naverMapIcon from "../../../public/naver_map.jpg" import * as S from "./PlaceCard.style" @@ -18,8 +20,6 @@ interface Props { export default function PlaceCard({ place, questId, view, onUpdate }: Props) { const [isClosed, setClosed] = useState(place.isClosed) const [isNotAccessible, setNotAccessible] = useState(place.isNotAccessible) - const visited = place.isConquered || isClosed || isNotAccessible - const isReversible = !place.isConquered && (isClosed || isNotAccessible) const queryClient = useQueryClient() const updateStatus = useMutation({ @@ -48,6 +48,7 @@ export default function PlaceCard({ place, questId, view, onUpdate }: Props) { } const updateClosed = async (isClosed: boolean) => { + console.log("updateClosed", isClosed) await updateStatus.mutateAsync({ questId, buildingId: place.buildingId, @@ -69,76 +70,51 @@ export default function PlaceCard({ place, questId, view, onUpdate }: Props) { setNotAccessible(isNotAccessible) } - const revertUpdate = () => { - if (isNotAccessible) { - updateNotAccessible(false) - } - if (isClosed) { - updateClosed(false) - } - } - - if (view === "list") { - return ( - - - - {place.name} - {place.isConquered && 정복} - {!place.isConquered && !isClosed && place.isClosedExpected && ( - 폐업추정 - )} - {isClosed && 폐업확인} - {isNotAccessible && 접근불가} - - - - 네이버 지도 - - - - - - - - - - - ) - } - return ( - - - {place.name} - {place.isConquered && 정복} + + + {!place.isConquered && !isClosed && !isNotAccessible && ( + 정복대상 + )} + {place.isConquered && 정복완료} + {isClosed && 폐업확인} + {isNotAccessible && 접근불가} {!place.isConquered && !isClosed && place.isClosedExpected && ( - 폐업추정 + 폐업추정 )} - {isClosed && 폐업확인} - {isNotAccessible && 접근불가} - - - - 네이버 지도 - - - + + + {place.name} + + - - - {(isReversible || !visited) && ( - - {isReversible && 다시 입력할게요} - {!visited && 정복하기} - {!visited && updateClosed(true)}>폐업했어요} - {!visited && updateNotAccessible(true)}>접근불가} - - )} + + 네이버 지도 + + + + + + + + + + + ) } diff --git a/app/modals/_template/RightSheet/RightSheet.style.ts b/app/modals/_template/RightSheet/RightSheet.style.ts index cc9b0a7..9c8b608 100644 --- a/app/modals/_template/RightSheet/RightSheet.style.ts +++ b/app/modals/_template/RightSheet/RightSheet.style.ts @@ -58,6 +58,7 @@ export const SheetTitle = styled("h5", { export const CloseButton = styled("button", { base: { position: "absolute", + zIndex: 1, top: 16, left: 16, display: "flex", diff --git a/app/modals/_template/RightSheet/RightSheet.tsx b/app/modals/_template/RightSheet/RightSheet.tsx index 733aed1..c47da2e 100644 --- a/app/modals/_template/RightSheet/RightSheet.tsx +++ b/app/modals/_template/RightSheet/RightSheet.tsx @@ -18,7 +18,7 @@ export default function RightSheet({ title, actionButton, style, children, visib - {title} + {typeof title == "string" ? {title} : title} {actionButton} )}