@create-figma-plugin/ui
Version:
Production-grade Preact components that replicate the Figma UI design
57 lines • 2.2 kB
JavaScript
import { h } from 'preact';
import { useState } from 'preact/hooks';
import { useInitialFocus } from '../../../hooks/use-initial-focus/use-initial-focus.js';
import { IconFrame16 } from '../../../icons/icon-16/icon-frame-16.js';
import { Layer } from '../layer.js';
export default {
parameters: {
fixedWidth: true
},
tags: ['1'],
title: 'Components/Layer/Frame Unselected'
};
export const Passive = function () {
const [value, setValue] = useState(false);
function handleChange(event) {
const newValue = event.currentTarget.checked;
console.log(newValue);
setValue(newValue);
}
return (h(Layer, { icon: h(IconFrame16, null), onChange: handleChange, value: value }, "Text"));
};
export const Focused = function () {
const [value, setValue] = useState(false);
function handleChange(event) {
const newValue = event.currentTarget.checked;
console.log(newValue);
setValue(newValue);
}
return (h(Layer, { ...useInitialFocus(), icon: h(IconFrame16, null), onChange: handleChange, value: value }, "Text"));
};
export const Bold = function () {
const [value, setValue] = useState(false);
function handleChange(event) {
const newValue = event.currentTarget.checked;
console.log(newValue);
setValue(newValue);
}
return (h(Layer, { bold: true, icon: h(IconFrame16, null), onChange: handleChange, value: value }, "Text"));
};
export const Description = function () {
const [value, setValue] = useState(false);
function handleChange(event) {
const newValue = event.currentTarget.checked;
console.log(newValue);
setValue(newValue);
}
return (h(Layer, { description: "Description", icon: h(IconFrame16, null), onChange: handleChange, value: value }, "Text"));
};
export const OnValueChange = function () {
const [value, setValue] = useState(false);
function handleValueChange(newValue) {
console.log(newValue);
setValue(newValue);
}
return (h(Layer, { icon: h(IconFrame16, null), onValueChange: handleValueChange, value: value }, "Text"));
};
//# sourceMappingURL=layer-frame-unselected.stories.js.map