⚰️ Remove dead code

This commit is contained in:
ajnart
2022-05-23 11:19:26 +02:00
parent 10d9ffc740
commit 72b3097ad1
3 changed files with 0 additions and 90 deletions

View File

@@ -1,82 +0,0 @@
import React from 'react';
import { createStyles, Text } from '@mantine/core';
import { useListState } from '@mantine/hooks';
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import AppShelf from './AppShelf/AppShelf';
const useStyles = createStyles((theme) => ({
item: {
...theme.fn.focusStyles(),
display: 'flex',
alignItems: 'center',
borderRadius: theme.radius.md,
border: `1px solid ${
theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[2]
}`,
padding: `${theme.spacing.sm}px ${theme.spacing.xl}px`,
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.white,
marginBottom: theme.spacing.sm,
},
itemDragging: {
boxShadow: theme.shadows.sm,
},
symbol: {
fontSize: 30,
fontWeight: 700,
width: 60,
},
}));
interface DndListProps {
data: {
position: number;
mass: number;
symbol: string;
name: string;
}[];
}
export function DndList({ data }: DndListProps) {
const { classes, cx } = useStyles();
const [state, handlers] = useListState(data);
const items = state.map((item, index) => (
<Draggable key={item.symbol} index={index} draggableId={item.symbol}>
{(provided, snapshot) => (
<div
className={cx(classes.item, { [classes.itemDragging]: snapshot.isDragging })}
{...provided.draggableProps}
{...provided.dragHandleProps}
ref={provided.innerRef}
>
<Text className={classes.symbol}>{item.symbol}</Text>
<div>
<Text>{item.name}</Text>
<Text color="dimmed" size="sm">
Position: {item.position} Mass: {item.mass}
</Text>
</div>
</div>
)}
</Draggable>
));
return (
<DragDropContext
onDragEnd={({ destination, source }) =>
handlers.reorder({ from: source.index, to: (destination && destination.index) ?? -1 })
}
>
<Droppable droppableId="dnd-list" direction="vertical">
{(provided) => (
<div {...provided.droppableProps} ref={provided.innerRef}>
{items}
{provided.placeholder}
</div>
)}
</Droppable>
</DragDropContext>
);
}