feat: ordered list
This commit is contained in:
parent
d82dee9319
commit
f2ebc485bf
22
src/App.tsx
22
src/App.tsx
@ -13,7 +13,7 @@ function loadPlayers() {
|
|||||||
"August",
|
"August",
|
||||||
"Beate",
|
"Beate",
|
||||||
"Ceasar",
|
"Ceasar",
|
||||||
"Doofus",
|
"Daedalus",
|
||||||
"Elli",
|
"Elli",
|
||||||
"Ford P.",
|
"Ford P.",
|
||||||
"Gabriel",
|
"Gabriel",
|
||||||
@ -27,12 +27,16 @@ function loadPlayers() {
|
|||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
function PlayerList(props: Partial<ReactSortableProps<any>>) {
|
type PlayerListProps = Partial<ReactSortableProps<any>> & {
|
||||||
|
orderedList?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
function PlayerList(props: PlayerListProps) {
|
||||||
return (
|
return (
|
||||||
<ReactSortable {...props} animation={200} className="dragbox">
|
<ReactSortable {...props} animation={200} className="dragbox">
|
||||||
{props.list?.map((item) => (
|
{props.list?.map((item, index) => (
|
||||||
<div key={item.id} className="item">
|
<div key={item.id} className="item">
|
||||||
{item.name}
|
{props.orderedList ? index + 1 + ". " + item.name : item.name}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</ReactSortable>
|
</ReactSortable>
|
||||||
@ -87,6 +91,7 @@ function App() {
|
|||||||
list={playersRight}
|
list={playersRight}
|
||||||
setList={setPlayersRight}
|
setList={setPlayersRight}
|
||||||
group={"shared"}
|
group={"shared"}
|
||||||
|
orderedList
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="box">
|
<div className="box">
|
||||||
@ -103,6 +108,7 @@ function App() {
|
|||||||
list={playersLeft}
|
list={playersLeft}
|
||||||
setList={setPlayersLeft}
|
setList={setPlayersLeft}
|
||||||
group={"shared"}
|
group={"shared"}
|
||||||
|
orderedList
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -114,9 +120,11 @@ function App() {
|
|||||||
>
|
>
|
||||||
submit
|
submit
|
||||||
</button>
|
</button>
|
||||||
<p className="grey">
|
<footer>
|
||||||
something not working? message <a href="https://t.me/x0124816">me</a>.
|
<p className="grey">
|
||||||
</p>
|
something not working? message <a href="https://t.me/x0124816">me</a>.
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user