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
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { useState } from "react";

import { Checkbox } from "./Checkbox";

import type { Meta, StoryObj } from "@storybook/react";

const meta: Meta<typeof Checkbox> = {
title: "Components/Checkbox",
component: Checkbox,
argTypes: {
checked: { control: "boolean" },
disabled: { control: "boolean" },
},
args: {
checked: false,
disabled: false,
onChange: () => {},
},
};

export default meta;
type Story = StoryObj<typeof Checkbox>;

const PlaygroundCheckbox = (args: React.ComponentProps<typeof Checkbox>) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# React 네임스페이스가 전역으로 선언되어 있는지 확인
rg -n "declare global" -g '*.d.ts' packages/timo-design-system
rg -n "\"types\"" packages/timo-design-system/tsconfig.json

Repository: Team-Timo/Timo-client

Length of output: 159


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 파일 구조와 해당 스토리 파일, tsconfig, 그리고 React 타입 선언 여부를 확인
git ls-files packages/timo-design-system | sed -n '1,200p'

printf '\n--- Checkbox.stories.tsx ---\n'
cat -n packages/timo-design-system/src/components/checkbox/Checkbox.stories.tsx

printf '\n--- tsconfig files ---\n'
git ls-files 'packages/timo-design-system/*tsconfig*' 'packages/*/*tsconfig*' | sed -n '1,200p'

printf '\n--- React typings search ---\n'
rg -n "declare (global|namespace React)|namespace React|type ComponentProps|import type \{[^}]*ComponentProps" packages/timo-design-system . -g '*.d.ts' -g '*.ts' -g '*.tsx' -g 'tsconfig*.json'

Repository: Team-Timo/Timo-client

Length of output: 3332


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- packages/timo-design-system/tsconfig.json ---\n'
cat -n packages/timo-design-system/tsconfig.json

printf '\n--- packages/timo-design-system/package.json ---\n'
cat -n packages/timo-design-system/package.json

printf '\n--- React-related imports/usages in design-system ---\n'
rg -n "React\.ComponentProps|from \"react\"|from 'react'|namespace React|declare global" packages/timo-design-system/src packages/timo-design-system/.storybook -g '*.ts' -g '*.tsx' -g '*.d.ts'

Repository: Team-Timo/Timo-client

Length of output: 2649


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- react-library tsconfig ---\n'
rg -n "allowUmdGlobalAccess|jsx|types|moduleResolution|esModuleInterop|verbatimModuleSyntax" \
  -g 'react-library.json' -g '*.json' packages node_modules 2>/dev/null || true

printf '\n--- likely shared tsconfig files ---\n'
git ls-files | rg 'typescript-config/.+json$|tsconfig.*json$'

printf '\n--- React type definition clues in `@types/react` if vendored in repo ---\n'
rg -n "export as namespace React|declare namespace React|ComponentProps" \
  -g '*.d.ts' -g '*.ts' -g '*.tsx' .

Repository: Team-Timo/Timo-client

Length of output: 1914


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- packages/typescript-config/react-library.json ---\n'
cat -n packages/typescript-config/react-library.json

printf '\n--- packages/typescript-config/base.json ---\n'
cat -n packages/typescript-config/base.json

printf '\n--- checkbox story exact lines ---\n'
sed -n '1,40p' packages/timo-design-system/src/components/checkbox/Checkbox.stories.tsx

Repository: Team-Timo/Timo-client

Length of output: 2175


ComponentPropsreact에서 타입 import로 바꿔주세요.
이 파일은 이미 import가 있는 모듈이라 React UMD 네임스페이스가 보장되지 않고, 현재 설정에도 이를 허용하는 옵션이 없어 타입 에러로 이어질 수 있어요. import type { ComponentProps } from "react";로 바꾸면 깔끔합니다.
TypeScript의 UMD globals 문서도 참고하면 좋아요: https://www.typescriptlang.org/docs/handbook/declaration-files/library-structures.html#umd-globals

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/timo-design-system/src/components/checkbox/Checkbox.stories.tsx` at
line 25, `PlaygroundCheckbox` is using `React.ComponentProps`, which relies on
the React UMD namespace and can fail under the current TypeScript setup. Update
the story to import `ComponentProps` as a type from `react` and use that type in
the `PlaygroundCheckbox` signature, keeping the `Checkbox` prop typing intact
without depending on `React`.

const [checked, setChecked] = useState(args.checked);
return <Checkbox {...args} checked={checked} onChange={setChecked} />;
};

export const Playground: Story = {
render: (args) => <PlaygroundCheckbox {...args} />,
};

export const AllStates: Story = {
render: () => (
<div className="flex items-center gap-6">
<div className="flex flex-col items-center gap-2">
<Checkbox checked={false} onChange={() => {}} />
<p className="text-xs">Unchecked</p>
</div>
<div className="flex flex-col items-center gap-2">
<Checkbox checked={true} onChange={() => {}} />
<p className="text-xs">Checked</p>
</div>
<div className="flex flex-col items-center gap-2">
<Checkbox checked={true} disabled onChange={() => {}} />
<p className="text-xs">Disabled</p>
</div>
</div>
),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { cn } from "@lib";
import { useId } from "react";

export interface CheckboxProps {
checked: boolean;
onChange: (checked: boolean) => void;
disabled?: boolean;
className?: string;
}

export const Checkbox = ({
checked,
onChange,
disabled = false,
className,
}: CheckboxProps) => {
const id = useId();
return (
<label
htmlFor={id}
className={cn(
"relative inline-flex h-6 w-6 shrink-0 items-center justify-center",
disabled ? "cursor-not-allowed" : "cursor-pointer",
className,
)}
>
<input
Comment thread
coderabbitai[bot] marked this conversation as resolved.
id={id}
type="checkbox"
checked={checked}
onChange={(e) => onChange(e.target.checked)}
disabled={disabled}
className="peer sr-only"
/>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<span
className={cn(
"peer-focus-visible:ring-timo-blue-300 flex h-4.5 w-4.5 items-center justify-center rounded-[4px] border transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1",
!checked && "border-timo-gray-500",
checked && !disabled && "border-timo-blue-300 bg-timo-blue-300",
checked && disabled && "bg-timo-blue-100 border-timo-blue-100",
)}
>
{(checked || disabled) && (
<svg
width="10"
height="7"
viewBox="0 0 10 7"
overflow="visible"
fill="none"
aria-hidden="true"
className="text-timo-yellow-300"
>
<path
d="M0.75 3.5L3.5 6.25L9.25 0.75"
stroke="currentColor"
strokeWidth="1"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)}
Comment thread
jjangminii marked this conversation as resolved.
</span>
</label>
);
};
1 change: 1 addition & 0 deletions packages/timo-design-system/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { Checkbox } from "./checkbox/Checkbox";
export { Color } from "./color/Color";
export { Typography } from "./typography/Typography";
export { Tag } from "./tag/Tag";
Expand Down
Loading