-
Notifications
You must be signed in to change notification settings - Fork 395
Expand file tree
/
Copy pathAllItemsView.svelte
More file actions
63 lines (55 loc) · 1.57 KB
/
AllItemsView.svelte
File metadata and controls
63 lines (55 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<script>
import PopupItem from "../PopupItem.svelte";
export let allItems = [];
export let toggleItem;
export let detailItem;
let disabled;
let rowColorsAll;
$: list = allItems.sort((a, b) => a.name.localeCompare(b.name));
$: if (list.length > 1 && list.length % 2 === 0) {
rowColorsAll = "even--all";
} else if (list.length > 1 && list.length % 2 !== 0) {
rowColorsAll = "odd--all";
} else {
rowColorsAll = undefined;
}
</script>
{#if allItems.length}
<div class="items view--all {rowColorsAll || ""}" class:disabled={disabled}>
{#each list as item (item.filename)}
<PopupItem
enabled={!item.disabled}
name={item.name}
subframe={item.subframe}
type={item.type}
request={!!item.request}
toggleItem={() => toggleItem(item)}
detailItem={() => detailItem(item)}
/>
{/each}
</div>
{:else}
<div class="none">No valid files found in directory</div>
{/if}
<style>
.items {
padding-bottom: 60px;
text-align: left;
}
.even--all :global(.item:nth-of-type(odd)),
.odd--all :global(.item:nth-of-type(even)) {
background-color: var(--color-bg-secondary);
}
.none {
align-items: center;
bottom: 0;
color: var(--text-color-disabled);
display: flex;
font-weight: 600;
justify-content: center;
left: 0;
position: absolute;
right: 0;
top: 0;
}
</style>