MCPcopy
hub / github.com/clientIO/joint / HookSetSize

Function HookSetSize

packages/joint-react/src/hooks/use-update-element.stories.tsx:120–141  ·  view source on GitHub ↗
({ label, id }: SimpleElement)

Source from the content-addressed store, hash-verified

118});
119
120function HookSetSize({ label, id }: SimpleElement) {
121 const set = useUpdateElement(id, 'size');
122
123 return (
124 <HTMLNode className="node">
125 <button
126 className={BUTTON_CLASSNAME}
127 onClick={() =>
128 set((previous) => {
129 if (previous === undefined) {
130 return { width: 0, height: 0 };
131 }
132 return { width: previous.width + 10, height: previous.height + 10 };
133 })
134 }
135 >
136 Set size
137 </button>
138 label: {label}
139 </HTMLNode>
140 );
141}
142
143export const SetSize: Story = makeStory<Story>({
144 component: () => <RenderItemDecorator renderElement={HookSetSize} />,

Callers

nothing calls this directly

Calls 2

useUpdateElementFunction · 0.90
setFunction · 0.50

Tested by

no test coverage detected