-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbreadcrumb.tsx
59 lines (56 loc) · 1.7 KB
/
breadcrumb.tsx
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
import { Component, Show } from 'solid-js';
import { BreadcrumbWithNames } from '../../core/types';
import Icon from '../icon';
import { A } from '@solidjs/router';
type NoteBreadcrumbProps = BreadcrumbWithNames & {
class?: string
}
const NoteBreadcrumb: Component<NoteBreadcrumbProps> = (props) => {
const extraClass = () => {
if (props.class !== undefined) return " " + props.class
return ""
}
return (
<div class={"p-2 text-sm breadcrumbs rounded-md shadow-md bg-base-200 flex" + extraClass()}>
<ul>
<Show when={props.username}>
<li>
<A
activeClass="btn-disabled"
end={true}
href={`/${props.username}`}
>
<Icon name="user" size={16} />
<span class="ml-1">{props.username}</span>
</A>
</li>
<Show when={props.bookSlug}>
<li>
<A
activeClass="btn-disabled"
end={true}
href={`/${props.username}/${props.bookSlug}`}
>
<Icon name="folder" size={16} />
<span class="ml-1">{props.bookName}</span>
</A>
</li>
<Show when={props.noteSlug}>
<li>
<A
activeClass="btn-disabled"
end={true}
href={`/${props.username}/${props.bookSlug}/${props.noteSlug}`}
>
<Icon name="file" size={16} />
<span class="ml-1">{props.noteName}</span>
</A>
</li>
</Show>
</Show>
</Show>
</ul>
</div>
)
}
export default NoteBreadcrumb;