summaryrefslogtreecommitdiff
path: root/smoke/docs-main/src/components/LeftSidebar/SidebarContent.astro
blob: e50a8e7e0840a0a6c6f2695a4905e4b153f9acbf (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
const { type, defaultActiveTab, sidebarSections, currentPageMatch } = Astro.props;
---

{sidebarSections.length === 0 && (
	<li class={`nav-group ${type}`}>
		<div class="placeholder sm-hidden">No Translations Found</div>
		<a class="placeholder" href="/">
			View in English
		</a>
	</li>
)}
{sidebarSections.map((section) => (
	<li class={`nav-group ${type} ${defaultActiveTab === type ? 'active' : ''}`}>
		<div>
			<h2 class="nav-group-title">{section.text}</h2>
			<ul>
				{section.children.map((child) => (
					<li class="nav-link">
						<a href={`${Astro.site.pathname}${child.link}`} aria-current={`${currentPageMatch === child.link ? 'page' : 'false'}`}>
							{child.text}
						</a>
					</li>
				))}
			</ul>
		</div>
	</li>
))}

<style lang="scss">
	.nav-group {
		margin-top: 1.75rem;
	}
	.nav-group .placeholder {
		opacity: 0.6;
		text-align: center;
		display: block;
	}
	@media (max-width: 50em) {
		.sm-hidden {
			display: none !important;
		}
	}
	@media (min-width: 50em) {
		.nav-group {
			display: none;
		}
	}
	.nav-group.active {
		display: block;
	}
	.nav-group-title {
		font-size: 1rem;
		font-weight: 700;
		padding: 0.1rem 1rem;
		text-transform: uppercase;
		margin-bottom: 0.5rem;
	}

	.nav-link a {
		font-size: 1rem;
		margin: 1px;
		padding: 0.3rem 1rem;
		font: inherit;
		color: inherit;
		text-decoration: none;
		display: block;

		&:hover,
		&:focus {
			background-color: var(--theme-bg-hover);
		}

		&[aria-current='page'] {
			color: var(--theme-text-accent);
			background-color: var(--theme-bg-accent);
			font-weight: 600;
		}
	}

	:global(:root.theme-dark) .nav-link a[aria-current='page'] {
		color: hsla(var(--color-base-white), 100%, 1);
	}
</style>