-
Notifications
You must be signed in to change notification settings - Fork 888
feat: manage provisioner tags in template editor #11600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
58532a5
77d27cd
9de069f
07b2241
94fecc5
95159b9
b62fd65
c7d327d
6d0c615
4b28359
cad35c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { chromatic } from "testHelpers/chromatic"; | ||
import { MockTemplateVersion } from "testHelpers/entities"; | ||
import { ProvisionerTagsPopover } from "./ProvisionerTagsPopover"; | ||
import { useArgs } from "@storybook/preview-api"; | ||
|
||
const meta: Meta<typeof ProvisionerTagsPopover> = { | ||
title: "component/ProvisionerTagsPopover", | ||
parameters: { | ||
chromatic, | ||
layout: "centered", | ||
}, | ||
component: ProvisionerTagsPopover, | ||
args: { | ||
tags: MockTemplateVersion.job.tags, | ||
}, | ||
render: function Render(args) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you are passing the component you don't need this render function at all. At least if you are using it just to test with Chromatic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted this to function in Storybook live, and my understanding was that this was the way to manipulate args getting passed into the component with |
||
const [{ tags }, updateArgs] = useArgs(); | ||
|
||
return ( | ||
<ProvisionerTagsPopover | ||
{...args} | ||
tags={tags} | ||
onSubmit={({ key, value }) => { | ||
updateArgs({ tags: { ...tags, [key]: value } }); | ||
}} | ||
onDelete={(key) => { | ||
const newTags = { ...tags }; | ||
delete newTags[key]; | ||
updateArgs({ tags: newTags }); | ||
}} | ||
/> | ||
); | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof ProvisionerTagsPopover>; | ||
|
||
export const Example: Story = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the
useArgs
hook I'm using to update state of a rendered component in storybook.