Skip to content

Buttonによる完成状態の定義 - #108

Merged
touyou merged 13 commits into
mainfrom
refact/button-complete
Jul 17, 2025
Merged

Buttonによる完成状態の定義#108
touyou merged 13 commits into
mainfrom
refact/button-complete

Conversation

@touyou

@touyou touyou commented Jul 14, 2025

Copy link
Copy Markdown
Member

概要

Buttonを改めて実装して完成形を定義すること

変更内容

  • registryが実装できている
  • registryが最新化されている
  • Code Connectが実際に動いている
  • Buttonのプロパティ名とスタイルがFigmaと一致している
  • コメントがついている
  • テストが通っている
  • forwardRefは削除(TailwindCSS v4)
  • ストーリーが使いやすい状態で提供されている

動作確認

  • pnpm lint を実行
  • pnpm build を実行してプロジェクトが正常にビルドされることを確認
  • pnpm test を実行してテストがすべて成功することを確認

関連 Issue

touyou added 5 commits July 14, 2025 14:31
…ops mapping

- Changed Button component theme from secondary to neutral.
- Updated Figma connection URL and props mapping in index.figma.tsx.
- Refactored Button stories to reflect theme changes.
- Adjusted Button tests to validate neutral variant.
- Modified Button styles for better consistency and accessibility.
- Added new Breadcrumb and Tabs components with appropriate structure and styles.
- @figma/code-connectのバージョンを1.3.4にアップグレード
- icon-button、icon、spinnerコンポーネントのFigma接続を更新
- 自動生成されたコメントを修正し、Figmaプロパティのマッピングを明確化
- Iconコンポーネントのインポートパスを更新
- Spinnerコンポーネントのインポートパスを更新
- IconButtonコンポーネントのインポートパスを修正
- Spinnerコンポーネントのインポートパスを修正
…s; remove disabled styling test and ref forwarding test

fix(Modal): change button theme from secondary to neutral in stories; adjust modal content class for consistency

fix(Spinner): format code for consistency in Figma integration
@touyou
touyou requested a review from ore0 July 14, 2025 06:13
@touyou touyou self-assigned this Jul 14, 2025
Copilot AI review requested due to automatic review settings July 14, 2025 06:13
@vercel

vercel Bot commented Jul 14, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sparkle-design ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2025 5:33am

- Buttonコンポーネントをindex.tsからエクスポートするように変更しました。

This comment was marked as outdated.

- ボタンのテーマオプションを「secondary」から「neutral」に変更
- ストーリーのレンダリング方法を関数からオブジェクト形式に変更
- ボタンのスタイルを修正し、テキストカラーを「text-white」に更新

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR finalizes the Button component implementation and syncs Figma/registry configurations across multiple UI components.

  • Refactored Button with updated CVA classes, removed forwardRef, and revised prop types.
  • Updated Figma Code Connect integrations for Spinner, Icon, IconButton, and Button.
  • Adjusted theme values (secondaryneutral) in modal/dialog and refreshed registry metadata.

Reviewed Changes

Copilot reviewed 39 out of 41 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/components/ui/spinner/index.figma.tsx Updated Figma integration for Spinner
src/components/ui/modal/index.tsx Adjusted modal container styling (removed gap-4)
src/components/ui/modal/index.stories.tsx Changed Button theme in modal stories to neutral
src/components/ui/icon/index.figma.tsx Updated Figma integration for Icon
src/components/ui/icon-button/index.figma.tsx Updated Figma integration for IconButton
src/components/ui/dialog/index.tsx Changed DialogCancel theme to neutral
src/components/ui/button/item.json Reordered registry metadata for Button component
src/components/ui/button/index.tsx Refactored Button implementation and styling variants
src/components/ui/button/index.test.tsx Updated tests to match new Button classes and variants
src/components/ui/button/index.stories.tsx Revised Storybook meta typing and control options
src/components/ui/button/index.figma.tsx Updated Figma integration for Button
registry.json Reorganized registry entries and added Tabs component
public/r/textarea.json Enhanced Textarea registry documentation with examples
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)

src/components/ui/button/index.tsx:306

  • The Button component no longer forwards refs to its underlying element after removal of React.forwardRef, which is a breaking change for consumers relying on ref access. Consider restoring ref forwarding or documenting this change clearly.
function Button({

src/components/ui/button/index.tsx:340

  • The computed disabled attribute is set before spreading ...props, which allows an explicit disabled prop to override the computed state. Consider spreading ...props first or merging props to avoid unintended overrides.
      disabled={isButtonDisabled}

src/components/ui/modal/index.tsx:155

  • The gap-4 utility was removed from the modal content container, which may collapse the intended spacing between child elements. Consider reintroducing a suitable gap or adjusting the layout to preserve spacing.
          "z-50 flex flex-col gap-0 w-full max-h-[calc(100vh-80px)] bg-background border py-4 rounded-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] shadow-lg duration-200",

@touyou touyou left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

完全体定義にあたって基準表見ながらセルフチェック

  • theme使えてるか?→使えているはず。フォーカスリングなどの扱いだけ要議論かも(もしここまで整える場合はringのトークン定義が必要?)
  • cva→必要な場所なので問題なし。適宜join作戦で見やすくなったはず
  • registry...一旦最小限できちんと定義できているから問題ないはず?
  • Storybook...コメントを引っ張ってくる挙動などは再整理できた状態。複数コンポーネントならべるストーリーも書き方を直してControlsが使えるように。残論点もしあるとしたら各ストーリーに説明をつけるかどうか
  • README更新...済んでいる
  • Figma Code Connect...挙動確認までできた
  • テスト...t-wada方式で生成してもらったものがある

残論点

  • フォーカスリングなどの色定義について
  • registry,storybookの現状に何かもう少し要求あれば
  • リポジトリのリファクタリング、モノレポ→変えるイメージがあれば、なければこのままでも自分は良いかと考えてました
  • registryのgitignore...そもそも可能なのかが微妙なので優先度は下げたいです

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

code connectでspinnerのインスタンスに使われているタイポグラフィの大きさを取得してsizepropsにタイポグラフィのサイズを反映できるとより使い勝手が良くなりそうです。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

code connectでiconのインスタンスに使われているタイポグラフィの大きさとアイコン名を取得してpropsに反映できるとより使い勝手が良くなりそうです。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

アイコン周りはアイコンコンポーネントの修正時に考慮する方針で進めたいです。

},
example: props => (
<IconButton
icon="edit"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

iconの部分も取得できると良さそうです!

"shrink-0 outline-none",
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
].join(" "),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Arrayをjoin()する形式ってどう思います...?
Tabsを実装するときにcopilotに言われるがまま採用しちゃったんですけど、本当にいいアプローチなのか疑問に思ってきています。

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

自分はあまりにも長くなるので可読性の観点でいいのかなと思ってました。
何かバッドノウハウである明確な理由が見つかれば避ければいいとは思いますが、自分は好意的に捉えたので採用しています

Comment on lines +43 to +49
// No matching props could be found for these Figma properties:
// "isFocused": figma.boolean('isFocused'),
// "isSuffixIcon": figma.boolean('isSuffixIcon'),
// "isPrefixIcon": figma.boolean('isPrefixIcon'),
// "label": figma.string('label'),
// "prefixIcon": figma.instance('prefixIcon'),
// "suffixIcon": figma.instance('suffixIcon')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

この辺りは対応しない方針でしょうか?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

今回AIマッチングを使ってて生成したコードだったので、改めて一回コメントアウトして動くのか確認してみますね🙆‍♂️

- labelプロパティの名前を修正
- suffixIconとprefixIconの設定を追加
- アイコンボタンの例にアイコンのサイズとフィルを追加
- スピナーの例にサイズを追加
- フォーカスリングの色をカスタムプロパティに変更
Comment thread src/components/ui/button/index.tsx Outdated
"cursor-pointer disabled:cursor-not-allowed",
"shrink-0 outline-none",
"focus-visible:ring-2 focus-visible:ring-[var(--color-ring-normal)] focus-visible:ring-offset-2",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

aria-invalidの方針が決まって方針に伴う実装ができていれば後は問題なさそうです!

- aria-invalidのリングスタイルを削除しました。
- Updated the spinner component's Figma connection to include size as a prop.
- Created a new script to import icons from Figma, generating a file with connections for each icon component.

@ore0 ore0 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

@touyou
touyou merged commit 114314c into main Jul 17, 2025
@touyou
touyou deleted the refact/button-complete branch July 17, 2025 06:17
@touyou touyou mentioned this pull request Jul 18, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants