Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make demos selectable in <App /> component #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 38 additions & 13 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
import { DndExample } from './basic'
// import { DndExample } from './basic_without_use'
// import { DndExample } from './drag_overlay'
// import { DndExample } from './conditional_drop'
// import { DndExample } from './drag_handle'
// import { DndExample } from './custom_transform_rotate'
// import { DndExample } from './custom_transform_limit_x'
// import { DndExample } from './arbitrary_drag_move'
// import { DndExample } from './sortable_list_vertical'
// import { DndExample } from './multiple_lists'
import { createSignal } from "solid-js";
import { DndExample as Basic } from './basic'
import { DndExample as BasicWithoutUse } from './basic_without_use'
import { DndExample as DragOverlay } from './drag_overlay'
import { DndExample as ConditionalDrop } from './conditional_drop'
import { DndExample as DragHandle } from './drag_handle'
import { DndExample as CustomTransformRotate } from './custom_transform_rotate'
import { DndExample as CustomTransformLimitX } from './custom_transform_limit_x'
import { DndExample as ArbitraryDragMove } from './arbitrary_drag_move'
import { DndExample as SortableListVertical } from './sortable_list_vertical'
import { DndExample as MultipleLists } from './multiple_lists'

const options = {
"Basic": Basic,
"Basic Without Use": BasicWithoutUse,
"Drag Overlay": DragOverlay,
"Conditional Drop": ConditionalDrop,
"Drag Handle": DragHandle,
"Custom Transform Rotate": CustomTransformRotate,
"Custom Transform LimitX": CustomTransformLimitX,
"Arbitrary Drag Move": ArbitraryDragMove,
"Sortable List Vertical": SortableListVertical,
"Multiple Lists": MultipleLists
}

function App() {
const [selected, setSelected] = createSignal("Basic");

return (
<div class="p-20">
<DndExample />
</div>
<>
<div class="p-20">
<div className="max-w-64 mx-auto mb-12">
<select class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 " value={selected()} onInput={e => setSelected(e.currentTarget.value)}>
<For each={Object.keys(options)}>{
color => <option value={color}>{color}</option>
}</For>
</select>
</div>
<Dynamic component={options[selected()]} />
</div>
</>
);
}

Expand Down