({ label, id }: SimpleElement)
| 220 | }); |
| 221 | |
| 222 | function HookSetAny({ label, id }: SimpleElement) { |
| 223 | const set = useUpdateElement(id); |
| 224 | |
| 225 | return ( |
| 226 | <HTMLNode className="node"> |
| 227 | <button |
| 228 | className={BUTTON_CLASSNAME} |
| 229 | onClick={() => |
| 230 | set('position', (previous) => { |
| 231 | if (previous === undefined) { |
| 232 | return { x: 0, y: 0 }; |
| 233 | } |
| 234 | return { x: previous.x + 10, y: previous.y + 10 }; |
| 235 | }) |
| 236 | } |
| 237 | > |
| 238 | Set Position |
| 239 | </button> |
| 240 | <button |
| 241 | className={BUTTON_CLASSNAME} |
| 242 | onClick={() => |
| 243 | set('size', (previous) => { |
| 244 | if (previous === undefined) { |
| 245 | return { width: 0, height: 0 }; |
| 246 | } |
| 247 | return { width: previous.width + 10, height: previous.height + 10 }; |
| 248 | }) |
| 249 | } |
| 250 | > |
| 251 | Set Size |
| 252 | </button> |
| 253 | label: {label} |
| 254 | </HTMLNode> |
| 255 | ); |
| 256 | } |
| 257 | |
| 258 | export const SetAnyProperty: Story = makeStory<Story>({ |
| 259 | apiURL: API_URL, |
nothing calls this directly
no test coverage detected