Skip to content

Commit 74acff7

Browse files
author
Mat Jones
committed
add list-box.tsx and drag-and-drop-list-box.tsx
1 parent 918cbbf commit 74acff7

File tree

9 files changed

+486
-7
lines changed

9 files changed

+486
-7
lines changed

.storybook/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { setDefaults } from "@storybook/addon-info";
33
import { withKnobs } from "@storybook/addon-knobs";
44
import { withInfo } from "@storybook/addon-info";
55
import "./storybook.css";
6-
import "assets/scss/andculturecode-javascript-react-components.scss";
7-
import { IconUtils } from "utilities/icon-utils";
8-
import { SvgIcons } from "atoms/constants/svg-icons";
6+
import "../src/assets/scss/andculturecode-javascript-react-components.scss";
7+
import { IconUtils } from "../src/utilities/icon-utils";
8+
import { SvgIcons } from "../src/atoms/constants/svg-icons";
99

1010
IconUtils.register(SvgIcons);
1111

package-lock.json

Lines changed: 67 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@reach/menu-button": "0.10.2",
2525
"@tippyjs/react": "4.0.2",
2626
"@types/react": "16.9.11",
27+
"@types/react-beautiful-dnd": "13.0.0",
2728
"@types/react-dom": "16.9.3",
2829
"@types/react-router-dom": "5.1.5",
2930
"andculturecode-javascript-core": "0.1.5",
@@ -34,6 +35,7 @@
3435
"i18next": "19.4.5",
3536
"immutable": "4.0.0-rc.12",
3637
"react": "16.13.1",
38+
"react-beautiful-dnd": "13.0.0",
3739
"react-dom": "16.13.1",
3840
"react-i18next": "11.6.0",
3941
"react-router-dom": "5.1.2",

src/atoms/interfaces/svg-icon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FunctionComponent, SVGProps } from "react";
2-
import { Icons } from "atoms/constants/icons";
2+
import { Icons } from "../constants/icons";
33

44
export interface SvgIcon {
55
base: FunctionComponent<SVGProps<SVGSVGElement>>;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React, { useState } from "react";
2+
import DragAndDropListBox from "./drag-and-drop-list-box";
3+
import { ListBoxItem } from "./list-box";
4+
import { Paragraph } from "../../atoms/typography/paragraph";
5+
6+
export default {
7+
title: "Molecules | Lists / DragAndDropListBox",
8+
component: DragAndDropListBox,
9+
};
10+
11+
export const DragAndDropListBoxDefault = () => {
12+
const [items, setItems] = useState<Array<ListBoxItem<number>>>([
13+
{
14+
id: 0,
15+
label: "0",
16+
text: "Item Number 0",
17+
},
18+
{
19+
id: 1,
20+
label: "1",
21+
text: "Item Number 1",
22+
},
23+
{
24+
id: 2,
25+
label: "2",
26+
text: "Item Number 2",
27+
},
28+
{
29+
id: 3,
30+
label: "3",
31+
text: "Item Number 3",
32+
},
33+
]);
34+
35+
return (
36+
<React.Fragment>
37+
<Paragraph>Drag and drop items to reorder them.</Paragraph>
38+
<DragAndDropListBox
39+
droppableId="drag-and-drop-list-box.tsx"
40+
items={items}
41+
onReordered={setItems}
42+
/>
43+
</React.Fragment>
44+
);
45+
};

0 commit comments

Comments
 (0)