Plan stuff. Log stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
830 B

  1. <script>
  2. import { createEventDispatcher } from 'svelte';
  3. import Link from "../Link.svelte";
  4. import Table from "../Table.svelte";
  5. export let items = [];
  6. const dispatch = createEventDispatcher();
  7. function onOption(name, id) {
  8. const item = items.find(i => i.id === id)
  9. dispatch("option", {name, item})
  10. }
  11. </script>
  12. <Table headers={["Name", "Multiplier", "Options"]} percentages={[60, 5, 35]}>
  13. {#each items as item (item.id)}
  14. <tr>
  15. <td class="ellipsis">{item.name}</td>
  16. <td>{item.multiplier.toFixed(2)}</td>
  17. <td>
  18. <Link on:click={() => onOption("item.stats", item.id)}>Stats</Link>,
  19. <Link on:click={() => onOption("item.edit", item.id)}>Edit</Link>,
  20. <Link on:click={() => onOption("item.remove", item.id)}>Delete</Link>
  21. </td>
  22. </tr>
  23. {/each}
  24. </Table>