pass direction as an arg in the list demo

This commit is contained in:
Roman Pominov committed 2022-08-03 11:33:27 +03:00
1 parent c5e8619924
commit c8f5b8a341
1 file changed
+10 -14
@@ -38,11 +38,11 @@ const Item = ({
};
export const SortableList = ({
direction = "vertical",
reversed = false,
direction,
reversed,
}: {
direction?: "horizontal" | "vertical" | "wrap";
reversed?: boolean;
direction: "horizontal" | "vertical" | "wrap";
reversed: boolean;
}) => {
const [data, setData] = useState([
{ id: "0", text: "First" },
@@ -183,18 +183,14 @@ export const SortableList = ({
);
};
export const SortableListHorizontal = (args: Args) => (
<SortableList direction="horizontal" {...args} />
);
export const SortableListWrap = (args: Args) => (
<SortableList direction="wrap" {...args} />
);
type Args = { reversed: boolean };
export default {
args: {
direction: "vertical",
reversed: false,
},
argTypes: {
direction: {
control: { type: "select", options: ["horizontal", "vertical", "wrap"] },
},
},
} as ComponentMeta<typeof SortableList>;