budibase/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte

80 lines
1.5 KiB
Svelte
Raw Normal View History

2020-03-10 14:53:23 +01:00
<script>
2020-03-10 17:06:30 +01:00
import Select from "../../common/Select.svelte"
import ActionButton from "../../common/ActionButton.svelte"
2020-03-10 14:53:23 +01:00
let pages = [1, 2, 3]
2020-03-10 17:06:30 +01:00
export let data = [
{ name: "Joe", inStock: true },
{ name: "Mike", inStock: false },
{ name: "Martin", inStock: true },
]
export let headers = ["name", "inStock"]
2020-03-10 14:53:23 +01:00
export let pageSize = 10
</script>
<section>
2020-03-10 17:06:30 +01:00
<h4 class="budibase__title--3">Shoe database</h4>
<div class="table-controls">
<Select />
<ActionButton primary>Create new record</ActionButton>
</div>
2020-03-10 14:53:23 +01:00
<table class="uk-table">
<thead>
<tr>
2020-03-10 17:06:30 +01:00
<th>Edit</th>
{#each headers as header}
<th>{header}</th>
{/each}
2020-03-10 14:53:23 +01:00
</tr>
</thead>
<tbody>
2020-03-10 17:06:30 +01:00
{#each data as row}
<tr>
<td>
<i class="ri-more-line" />
</td>
{#each headers as header}
<td>{row[header]}</td>
{/each}
</tr>
{/each}
2020-03-10 14:53:23 +01:00
</tbody>
</table>
<div class="pagination">
<button>Previous</button>
<button>Next</button>
2020-03-10 17:06:30 +01:00
<!-- {#each data as page}
2020-03-10 14:53:23 +01:00
<button>{page}</button>
2020-03-10 17:06:30 +01:00
{/each} -->
2020-03-10 14:53:23 +01:00
</div>
</section>
<style>
table {
border: 1px solid #ccc;
2020-03-10 17:06:30 +01:00
background: #fff;
border-radius: 2px;
2020-03-10 14:53:23 +01:00
}
thead {
background: var(--background-button);
}
thead th {
color: var(--button-text);
text-transform: capitalize;
2020-03-10 17:06:30 +01:00
font-weight: 500;
2020-03-10 14:53:23 +01:00
}
2020-03-10 17:06:30 +01:00
2020-03-10 14:53:23 +01:00
tr {
border-bottom: 1px solid #ccc;
}
2020-03-10 17:06:30 +01:00
.table-controls {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>