Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { makePageMetadata } from "@/seo/metadata";

export const metadata = makePageMetadata({
title: "PlanMate โ€” ๋กœ๊ทธ์ธ/ํšŒ์›๊ฐ€์ž…",
description: "PlanMate ๊ณ„์ •์œผ๋กœ ๋กœ๊ทธ์ธํ•˜๊ฑฐ๋‚˜ ํšŒ์›๊ฐ€์ž…ํ•˜์„ธ์š”.",
canonical: "/login",
});

export default function AuthLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}
8 changes: 8 additions & 0 deletions src/app/(marketing)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { makePageMetadata } from "@/seo/metadata";

export const metadata = makePageMetadata({
title: "PlanMate โ€” ๋งž์ถคํ˜• ๋ฐ์ผ๋ฆฌ ํ”Œ๋ž˜๋„ˆ",
description: "์›ํ•˜๋Š” ๋ชจ๋“ˆ์„ ์กฐํ•ฉํ•ด ๋‚˜๋งŒ์˜ ํ”Œ๋ž˜๋„ˆ๋ฅผ ๋งŒ๋“œ๋Š” PlanMate ๋žœ๋”ฉ ํŽ˜์ด์ง€",
canonical: "/",
});

export default function MarketingLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}
62 changes: 55 additions & 7 deletions src/app/(marketing)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { makePageMetadata } from "@/seo/metadata";
"use client";

import { Button } from "@/shared/button";
import { FeatureGroupButton } from "@/shared/feature-group-button";
import { Input } from "@/shared/input";
import { SpecialFeatureCard } from "@/shared/SpecialFeatureCard";
import { InputStatus } from "@/types/input";
import { Calendar, Laptop, Monitor, Smartphone } from "lucide-react";

export const metadata = makePageMetadata({
title: "PlanMate โ€” ๋งž์ถคํ˜• ๋ฐ์ผ๋ฆฌ ํ”Œ๋ž˜๋„ˆ",
description: "์›ํ•˜๋Š” ๋ชจ๋“ˆ์„ ์กฐํ•ฉํ•ด ๋‚˜๋งŒ์˜ ํ”Œ๋ž˜๋„ˆ๋ฅผ ๋งŒ๋“œ๋Š” PlanMate ๋žœ๋”ฉ ํŽ˜์ด์ง€",
canonical: "/",
});
import { useState } from "react";

export default function Home() {
const [email, setEmail] = useState("");
const [status, setStatus] = useState<InputStatus>("default");

return (
<div className="flex flex-col justify-center items-center gap-8">
{/* Hero CTA */}
Expand Down Expand Up @@ -50,6 +51,53 @@ export default function Home() {
<Button preset="auth" color="black">
๋กœ๊ทธ์ธ ํ•˜๊ธฐ
</Button>

<section className="space-y-2">
<h2 className="t-18-b">์—๋Ÿฌ ์ƒํƒœ</h2>
<div className="space-y-1">
<label htmlFor="email" className="t-14-m text-muted-foreground">
์ด๋ฉ”์ผ
</label>

{/** status: "default" | "error" */}
<Input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
status={status} // โœ… cva์™€ 1:1
placeholder="์ด๋ฉ”์ผ์„ ์ž…๋ ฅํ•˜์„ธ์š”"
aria-describedby={status === "error" ? "email-error" : undefined}
onFocus={() => setStatus("default")}
/>

{status === "error" && (
<p id="email-error" className="t-12-m text-destructive">
์ด๋ฉ”์ผ ํ˜•์‹์„ ํ™•์ธํ•˜์„ธ์š”.
</p>
)}

<div className="flex gap-2 pt-2">
<button
type="button"
onClick={() => setStatus((v: InputStatus) => (v === "error" ? "default" : "error"))}
className="rounded-md border px-3 py-1 text-sm"
>
์—๋Ÿฌ ํ† ๊ธ€
</button>
<button
type="button"
onClick={() => {
setEmail("");
setStatus("default");
}}
className="rounded-md border px-3 py-1 text-sm"
>
๊ฐ’ ์ดˆ๊ธฐํ™”
</button>
</div>
</div>
</section>
</div>
);
}
8 changes: 8 additions & 0 deletions src/app/(setup)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import { makePageMetadata } from "@/seo/metadata";

export const metadata = makePageMetadata({
title: "์ดˆ๊ธฐ ์„ค์ • โ€” MyPlanMate",
description: "๋ชจ๋“ˆ์„ ์„ ํƒํ•˜๊ณ  ๋ฐฐ์น˜ํ•ด ๋‚˜๋งŒ์˜ ํ”Œ๋ž˜๋„ˆ๋ฅผ ์‹œ์ž‘ํ•˜์„ธ์š”.",
canonical: "/setup",
});

export default function SetupLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}
11 changes: 11 additions & 0 deletions src/app/planner/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
import { makePageMetadata } from "@/seo/metadata";

export const metadata = {
...makePageMetadata({
title: "ํ”Œ๋ž˜๋„ˆ",
description: "PlanMate ํ”Œ๋ž˜๋„ˆ ๋Œ€์‹œ๋ณด๋“œ",
canonical: "/planner",
}),
robots: { index: false, follow: false }, // ๋ณดํ˜ธ ๊ตฌ์—ญ์€ ๊ฒ€์ƒ‰ ์ œ์™ธ
};

export default function PlannerLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>;
}
11 changes: 0 additions & 11 deletions src/app/planner/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
import { makePageMetadata } from "@/seo/metadata";

export const metadata = {
...makePageMetadata({
title: "ํ”Œ๋ž˜๋„ˆ",
description: "PlanMate ํ”Œ๋ž˜๋„ˆ ๋Œ€์‹œ๋ณด๋“œ",
canonical: "/planner",
}),
robots: { index: false, follow: false }, // ๋ณดํ˜ธ ๊ตฌ์—ญ์€ ๊ฒ€์ƒ‰ ์ œ์™ธ
};

export default function PlannerPage() {
return <div>ํ”Œ๋ž˜๋„ˆ ๋Œ€์‹œ๋ณด๋“œ</div>;
}
47 changes: 47 additions & 0 deletions src/lib/variants/input.auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// src/lib/variants/input.auth.ts
import { cva, type VariantProps } from "class-variance-authority";

/**
* ๋กœ๊ทธ์ธ ์ธํ’‹ ์ปดํฌ๋„ŒํŠธ์˜ ์Šคํƒ€์ผ variant
* - ๊ธฐ๋ณธ: 1px + gray-300
* - ํฌ์ปค์Šค: 1.5px + gray-900
* - ์—๋Ÿฌ: 1.5px + danger-600
* - ์—๋Ÿฌ ์ƒํƒœ์—์„œ ํฌ์ปค์Šค ์‹œ: ํฌ์ปค์Šค ๊ทœ์น™(gray-900)๋กœ ๋ณต๊ท€
*/
export const authInputVariants = cva(
[
// === ๊ธฐ๋ณธ ๋ ˆ์ด์•„์›ƒ ===
"w-[36.6rem] h-[4.6rem] px-6 rounded-lg bg-white t-14-m outline-none",

// === ํ”Œ๋ ˆ์ด์Šคํ™€๋” ===
"placeholder:text-[var(--color-gray-500)]",

// === ๊ธฐ๋ณธ ํ…Œ๋‘๋ฆฌ (1px + gray-300) ===
"border-[1.5px] border-[color:var(--color-gray-300)]",

// === ํฌ์ปค์Šค (1.5px + gray-900) ===
"focus:border-[2px] focus:border-[color:var(--color-gray-900)]",

// === ์ „ํ™˜ ํšจ๊ณผ ===
"transition-colors duration-150",
].join(" "),
{
variants: {
status: {
default: "",

error: [
"border-[2px]",
"border-[color:var(--color-danger-600)]",
"focus:border-[2px]",
"focus:border-[color:var(--color-gray-900)]",
].join(" "),
},
},
defaultVariants: {
status: "default",
},
},
);

export type AuthInputVariants = VariantProps<typeof authInputVariants>;
64 changes: 39 additions & 25 deletions src/shared/input.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
"use client";

import { cn } from "@/lib/utils";
import { authInputVariants } from "@/lib/variants/input.auth";
import type { InputProps } from "@/types/input";
import * as React from "react";

function Input({ className, type, ...props }: React.ComponentProps<"input">) {
/**
* AuthInput โ€” ๊ธฐ๋ณธ/ํฌ์ปค์Šค/์—๋Ÿฌ ์ƒํƒœ
* - status: "default" | "error"
* - ์—๋Ÿฌ ์ƒํƒœ์—์„œ ํฌ์ปค์Šค ์‹œ ์ž๋™์œผ๋กœ ๊ธฐ๋ณธ ์ƒํƒœ๋กœ ๋ณต๊ท€
*/
export const Input = React.forwardRef<
HTMLInputElement,
React.ComponentPropsWithoutRef<"input"> & InputProps
>(({ className, status = "default", ...rest }, ref) => {
const [currentStatus, setCurrentStatus] = React.useState<InputProps["status"]>(status);

// ์™ธ๋ถ€์—์„œ status๊ฐ€ ๋ฐ”๋€Œ๋ฉด ๋™๊ธฐํ™”
React.useEffect(() => {
setCurrentStatus(status);
}, [status]);

// ํฌ์ปค์Šค ์‹œ ์—๋Ÿฌ ์ƒํƒœ๋ฉด ๊ธฐ๋ณธ์œผ๋กœ ๋ณต๊ท€
const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {
if (currentStatus === "error") setCurrentStatus("default");
rest.onFocus?.(e);
};

const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
rest.onBlur?.(e);
};

return (
<input
type={type}
data-slot="input"
className={cn(
// ํฌ๊ธฐ/๋ ˆ์ด์•„์›ƒ
"h-12 w-full min-w-0 rounded-md px-3 py-2 text-sm outline-none transition-colors",
// ๊ธฐ๋ณธ ํ…์ŠคํŠธ/๋ฐฐ๊ฒฝ
"bg-white text-[#111827]",
// ๊ธฐ๋ณธ ํ…Œ๋‘๋ฆฌ(1px, ํšŒ์ƒ‰)
"border border-[var(--color-gray-300)]",
// ํ”Œ๋ ˆ์ด์Šคํ™€๋”
"placeholder:text-[#737373]",
// โœ… ํฌ์ปค์Šค(ํ™œ์„ฑํ™”): ํ…Œ๋‘๋ฆฌ ๋‘๊ป˜โ†‘(2px) + ์ƒ‰์ƒ #111827
"focus-visible:border-2 focus-visible:border-[#111827]",
// ์—๋Ÿฌ(์ ‘๊ทผ์„ฑ): aria-invalid=true โ†’ ํ…Œ๋‘๋ฆฌ #dc2626
"aria-invalid:border-[#dc2626]",
// ๋น„ํ™œ์„ฑ
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
// file input ๊ธฐ๋ณธ๊ฐ’(ํ•„์š” ์‹œ)
"file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
className,
)}
{...props}
ref={ref}
onFocus={handleFocus}
onBlur={handleBlur}
className={cn(authInputVariants({ status: currentStatus }), className)}
aria-invalid={currentStatus === "error" ? "true" : "false"}
data-invalid={currentStatus === "error" ? "true" : "false"}
{...rest}
Comment on lines 35 to +42

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Internal focus logic is bypassed when consumers pass handlers

The new auth input clears its error state in handleFocus/handleBlur, but the JSX spreads ...rest after wiring those handlers. Any consumer that passes its own onFocus or onBlur prop will overwrite the internal handlers, so the input never resets its status and the wrapped callbacks (rest.onFocus/rest.onBlur) are never invoked. This makes the error-clearing behaviour unreliable in typical form usage where custom focus handlers are common. Consider spreading rest before attaching the internal handlers or composing the handlers so both run.

Useful? React with ๐Ÿ‘ย / ๐Ÿ‘Ž.

/>
);
}
});

export { Input };
Input.displayName = "Input";
10 changes: 10 additions & 0 deletions src/types/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export type InputStatus = "default" | "error";

/** ์Šคํƒ€์ผ ์ƒํƒœ Props */
export interface InputStateProps {
/** ์ธํ’‹ ์ƒํƒœ โ€” ๊ธฐ๋ณธ(default) ๋˜๋Š” ์—๋Ÿฌ(error) */
status?: InputStatus;
}

/** ์ตœ์ข… ์ปดํฌ๋„ŒํŠธ Props */
export type InputProps = InputStateProps;