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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Sparkle Design のバッジは、コンポーネントが Sparkle Design を使
| ----------------- | ---- | --------- | ---------- | ------------------ | ------------- |
| Avatar | ❌ | ❌ | ❌ | ❌ | ❌ |
| Badge | ✅ | ✅ | ✅ | ✅ | ❌ |
| Breadcrumb | ✅ | ✅ | ✅ | | ❌ |
| Breadcrumb | ✅ | ✅ | ✅ | | ❌ |
| Button | ✅ | ✅ | ✅ | ✅ | ❌ |
| Calendar | ❌ | ❌ | ❌ | ❌ | ❌ |
| Card | ✅ | ✅ | ✅ | ❌ | ❌ |
Expand Down
42 changes: 42 additions & 0 deletions src/components/ui/breadcrumb/index.figma.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import figma from "@figma/code-connect";
import {
Breadcrumb,
BreadcrumbList,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbSeparator,
BreadcrumbPage,
} from "./index";

/**
* -- This file was auto-generated by Code Connect --
* `props` includes a mapping from your code props to Figma properties.
* You should check this is correct, and update the `example` function
* to return the code example you'd like to see in Figma
*/

/**
* 基本的なBreadcrumbナビゲーション
* en: Basic breadcrumb navigation
*/
figma.connect(
"breadcrumb",
"https://www.figma.com/design/UMKFYVERnT3YM5Ht8bLJkf/-all-playground?node-id=2755-25149&t=nSzq9SKlxNkN6D14-4",
{
props: {},
example: props => (
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator>/</BreadcrumbSeparator>
<BreadcrumbItem>
<BreadcrumbPage>Current Page</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
),
}
);
29 changes: 26 additions & 3 deletions src/components/ui/breadcrumb/index.stories.tsx
Comment thread
touyou marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import {
Breadcrumb,
BreadcrumbList,
Expand All @@ -11,6 +12,9 @@ import {
const meta: Meta<typeof Breadcrumb> = {
title: "Components/Breadcrumb",
component: Breadcrumb,
subcomponents: {
BreadcrumbLink,
},
parameters: {
layout: "centered",
},
Expand All @@ -26,15 +30,34 @@ export const Default: Story = {
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
<BreadcrumbLink
href="/"
onClick={e => {
e.preventDefault();
action("breadcrumb link clicked")({ href: "/", label: "Home" });
}}
>
Home
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbLink href="/components">Components</BreadcrumbLink>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

これはLinkコンポーネントも同様なのでうまくいったら横展開できればというところなんですが

onClick={(e) => {
    e.preventDefault();
    action('anchor clicked')(e);
  }}

などをして実際の遷移をしないようにしておくと動作確認がしやすそうと思いました

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

対応しようとするとStroybookのサンプルコードにもイベントハンドラが表示されますけど、これは致し方なしなんですかね。
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

そこのコードはそもそもrender関数がそのまま出ちゃうので参考にだけしてあくまで綺麗なサンプルはドキュメントの方の使用例を見てもらう運用にする、で割と今のフォーマットのままいける気がするのでいいかと思いました🙆‍♂️

どうしても気になるようであればargsに定義できるようにしておいてそっちで指定したら出なくなるとかあるかも?ですね

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

対応しました!
eb9fa85

<BreadcrumbLink
href="/link"
onClick={e => {
e.preventDefault();
action("breadcrumb link clicked")({
href: "/link",
label: "Link",
});
}}
>
Link
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
<BreadcrumbPage>Current Page</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
Expand Down
Loading