@stubber/ui 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<span slot="tooltip"> Copy stubberhandle </span>
|
|
30
30
|
</Tooltip>
|
|
31
31
|
<a class="mt-[17px] w-full" href={manageLink}>
|
|
32
|
-
<PrimaryButton label="
|
|
32
|
+
<PrimaryButton label="Personal Settings" variant="secondary-transparent" width="full" />
|
|
33
33
|
</a>
|
|
34
34
|
</div>
|
|
35
35
|
<a href={documentationLink}>
|
|
@@ -5,13 +5,21 @@
|
|
|
5
5
|
This component is *not* exported to the npm package.
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import { setContext } from "svelte";
|
|
8
9
|
import SideNavItem from "./SideNavItem.svelte";
|
|
9
10
|
import SideNavTitle from "./SideNavTitle.svelte";
|
|
11
|
+
|
|
12
|
+
setContext("side_nav_context", {
|
|
13
|
+
bg_color: "bg-red-500",
|
|
14
|
+
selected_bg_color: "bg-yellow-500",
|
|
15
|
+
hover_bg_color: "hover:bg-orange-500 hover:bg-opacity-[0.5]",
|
|
16
|
+
active_bg_color: "active:bg-surface-100",
|
|
17
|
+
});
|
|
10
18
|
</script>
|
|
11
19
|
|
|
12
|
-
<div class="p-4 bg-[
|
|
20
|
+
<div class="p-4 bg-white border-r border-suface-100 h-full w-[250px]">
|
|
13
21
|
<SideNavTitle title="General" />
|
|
14
|
-
<SideNavItem label="Recent" href="/" icon="far fa-home" />
|
|
22
|
+
<SideNavItem label="Recent" href="/" icon="far fa-home" is_selected={true} />
|
|
15
23
|
<SideNavItem label="Archive" href="/" icon="far fa-archive" />
|
|
16
24
|
<SideNavItem label="By Stub" href="/" icon="far fa-tilde" />
|
|
17
25
|
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { Label } from "../label/index.ts";
|
|
3
|
+
import { Button } from "../button/index.ts";
|
|
4
|
+
import { getContext } from "svelte";
|
|
5
|
+
|
|
2
6
|
export let label;
|
|
3
7
|
export let href;
|
|
4
8
|
export let icon;
|
|
5
9
|
export let indent_children = true;
|
|
6
10
|
export let is_selected = false;
|
|
7
11
|
|
|
12
|
+
let bg_color = "bg-transparent";
|
|
13
|
+
let selected_bg_color = "bg-surface-100";
|
|
14
|
+
let hover_bg_color = "hover:bg-surface-100 hover:bg-opacity-[0.5]";
|
|
15
|
+
let active_bg_color = "active:bg-surface-100";
|
|
16
|
+
|
|
17
|
+
// you can set the color for all nav items once using the context
|
|
18
|
+
const side_nav_context = getContext("side_nav_context");
|
|
19
|
+
if (side_nav_context) {
|
|
20
|
+
bg_color = side_nav_context.bg_color || bg_color;
|
|
21
|
+
selected_bg_color = side_nav_context.selected_bg_color || selected_bg_color;
|
|
22
|
+
hover_bg_color = side_nav_context.hover_bg_color || hover_bg_color;
|
|
23
|
+
active_bg_color = side_nav_context.active_bg_color || active_bg_color;
|
|
24
|
+
}
|
|
25
|
+
|
|
8
26
|
//states
|
|
9
27
|
let is_expanded = false;
|
|
10
28
|
|
|
@@ -13,30 +31,33 @@
|
|
|
13
31
|
}
|
|
14
32
|
</script>
|
|
15
33
|
|
|
16
|
-
<!-- If
|
|
34
|
+
<!-- If $slots.default == true, then it means this SideNavItem is a group item, i.e it has child elements in <slots/> -->
|
|
17
35
|
|
|
18
|
-
<
|
|
36
|
+
<Button
|
|
19
37
|
on:click={handle_click}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
variant="ghost"
|
|
39
|
+
class="group h-10 my-1 w-full flex items-center {is_selected
|
|
40
|
+
? selected_bg_color
|
|
41
|
+
: bg_color} {hover_bg_color} {active_bg_color}"
|
|
23
42
|
>
|
|
24
43
|
{#if $$slots.default}
|
|
25
|
-
<div class="h-10
|
|
44
|
+
<div class="h-10 w-2.5 flex items-center justify-center">
|
|
26
45
|
<i class="fas fa-caret-right {is_expanded ? 'rotate down' : 'rotate'}" />
|
|
27
46
|
</div>
|
|
28
47
|
{/if}
|
|
29
|
-
<a class="{$$slots.default ? '' : '
|
|
30
|
-
<div class="text-surface-900 w-fit flex items-center">
|
|
48
|
+
<a class="{$$slots.default ? '' : ''} w-full flex items-center" {href}>
|
|
49
|
+
<div class="text-surface-900 w-fit flex items-center gap-2">
|
|
31
50
|
<div class="h-10 aspect-square flex items-center justify-center">
|
|
32
|
-
<
|
|
51
|
+
<div class="bg-white rounded border w-7 h-7 flex items-center justify-center">
|
|
52
|
+
<i class="{icon} text-xs" />
|
|
53
|
+
</div>
|
|
33
54
|
</div>
|
|
34
|
-
<
|
|
55
|
+
<Label class=" font-medium">
|
|
35
56
|
{label}
|
|
36
|
-
</
|
|
57
|
+
</Label>
|
|
37
58
|
</div>
|
|
38
59
|
</a>
|
|
39
|
-
</
|
|
60
|
+
</Button>
|
|
40
61
|
{#if $$slots.default && is_expanded}
|
|
41
62
|
<div class={indent_children === true ? "ml-4" : ""}>
|
|
42
63
|
<slot />
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { Label } from "../label/index.ts";
|
|
3
|
+
|
|
2
4
|
export let title;
|
|
3
5
|
</script>
|
|
4
6
|
|
|
5
7
|
<div class="h-10 w-full flex items-center">
|
|
6
|
-
<
|
|
8
|
+
<Label class="ml-2 text-small font-medium text-surface-500">{title}</Label>
|
|
7
9
|
</div>
|