Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed Oct 19, 2024
1 parent c878cdf commit 9038fd0
Showing 1 changed file with 57 additions and 94 deletions.
151 changes: 57 additions & 94 deletions packages/website-astro/src/components/header/header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,28 @@ import Search from "./search.astro";
height: var(--header-height);
}
#header-drawer-button {
font-size: 1.5rem;
background: none;
border: none;
display: flex;
align-items: center;
background: none;
border: none;
}

.nav-content {
display: none;
}

.brand-item {
flex: 1;
}

.brand {
color: var(--colorNeutralForeground1);
}

li {
list-style: none;
}

@media screen and (max-width: 1023px) {
.nav-content[data-open="true"] {
display: block;
Expand All @@ -38,30 +49,26 @@ import Search from "./search.astro";
height: calc(100vh - var(--header-height));
overflow-y: auto;
}
}

.nav-content li {
padding: 1rem;
border-bottom: 1px solid var(--colorNeutralStroke1);
}

.brand-item {
flex: 1;
}

.brand {
color: var(--colorNeutralForeground1);
.nav-content .item {
border-bottom: 1px solid var(--colorNeutralStroke1);
padding: 1rem;
display: block;
}
}

@media screen and (min-width: 1024px) {
#header-drawer-button {
display: none;
}

.nav-content {
display: flex;
flex: 1;
position: relative;
}

.nav-content li {
border-bottom: 0;
.nav-content .item {
padding: 0 0.5rem;
}

Expand All @@ -85,51 +92,16 @@ import Search from "./search.astro";

.item {
display: inline-block;
/* padding: 0.25rem 0.75rem; */
}
.link {

.item.link {
cursor: pointer;
color: var(--colorNeutralForeground1);
}

.use-case-menu-btn {
display: flex;
align-items: center;
}
.github-link:hover {
opacity: 0.6;
}

.github-link:before {
/* cspell:disable-next-line */
background: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")
no-repeat;
content: "";
display: flex;
height: 24px;
width: 24px;
}

html[data-theme="dark"] .github-link:before {
/* cspell:disable-next-line */
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")
no-repeat;
}

.discord-link:before {
content: "";
width: 24px;
height: 19px;
display: flex;
/* cspell:disable-next-line */
background: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 71 55' fill='000000' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M60.105 4.898A58.55 58.55 0 0 0 45.653.415a.22.22 0 0 0-.233.11 40.784 40.784 0 0 0-1.8 3.697c-5.456-.817-10.886-.817-16.23 0-.485-1.164-1.201-2.587-1.828-3.697a.228.228 0 0 0-.233-.11 58.386 58.386 0 0 0-14.451 4.483.207.207 0 0 0-.095.082C1.578 18.73-.944 32.144.293 45.39a.244.244 0 0 0 .093.167c6.073 4.46 11.955 7.167 17.729 8.962a.23.23 0 0 0 .249-.082 42.08 42.08 0 0 0 3.627-5.9.225.225 0 0 0-.123-.312 38.772 38.772 0 0 1-5.539-2.64.228.228 0 0 1-.022-.378c.372-.279.744-.569 1.1-.862a.22.22 0 0 1 .23-.03c11.619 5.304 24.198 5.304 35.68 0a.219.219 0 0 1 .233.027c.356.293.728.586 1.103.865a.228.228 0 0 1-.02.378 36.384 36.384 0 0 1-5.54 2.637.227.227 0 0 0-.121.315 47.249 47.249 0 0 0 3.624 5.897.225.225 0 0 0 .249.084c5.801-1.794 11.684-4.502 17.757-8.961a.228.228 0 0 0 .092-.164c1.48-15.315-2.48-28.618-10.497-40.412a.18.18 0 0 0-.093-.084Zm-36.38 32.427c-3.497 0-6.38-3.211-6.38-7.156 0-3.944 2.827-7.156 6.38-7.156 3.583 0 6.438 3.24 6.382 7.156 0 3.945-2.827 7.156-6.381 7.156Zm23.593 0c-3.498 0-6.38-3.211-6.38-7.156 0-3.944 2.826-7.156 6.38-7.156 3.582 0 6.437 3.24 6.38 7.156 0 3.945-2.798 7.156-6.38 7.156Z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath d='M0 0h71v55H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")
no-repeat;
}

html[data-theme="dark"] .discord-link:before {
/* cspell:disable-next-line */
background: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 71 55' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M60.105 4.898A58.55 58.55 0 0 0 45.653.415a.22.22 0 0 0-.233.11 40.784 40.784 0 0 0-1.8 3.697c-5.456-.817-10.886-.817-16.23 0-.485-1.164-1.201-2.587-1.828-3.697a.228.228 0 0 0-.233-.11 58.386 58.386 0 0 0-14.451 4.483.207.207 0 0 0-.095.082C1.578 18.73-.944 32.144.293 45.39a.244.244 0 0 0 .093.167c6.073 4.46 11.955 7.167 17.729 8.962a.23.23 0 0 0 .249-.082 42.08 42.08 0 0 0 3.627-5.9.225.225 0 0 0-.123-.312 38.772 38.772 0 0 1-5.539-2.64.228.228 0 0 1-.022-.378c.372-.279.744-.569 1.1-.862a.22.22 0 0 1 .23-.03c11.619 5.304 24.198 5.304 35.68 0a.219.219 0 0 1 .233.027c.356.293.728.586 1.103.865a.228.228 0 0 1-.02.378 36.384 36.384 0 0 1-5.54 2.637.227.227 0 0 0-.121.315 47.249 47.249 0 0 0 3.624 5.897.225.225 0 0 0 .249.084c5.801-1.794 11.684-4.502 17.757-8.961a.228.228 0 0 0 .092-.164c1.48-15.315-2.48-28.618-10.497-40.412a.18.18 0 0 0-.093-.084Zm-36.38 32.427c-3.497 0-6.38-3.211-6.38-7.156 0-3.944 2.827-7.156 6.38-7.156 3.583 0 6.438 3.24 6.382 7.156 0 3.945-2.827 7.156-6.381 7.156Zm23.593 0c-3.498 0-6.38-3.211-6.38-7.156 0-3.944 2.826-7.156 6.38-7.156 3.582 0 6.437 3.24 6.38 7.156 0 3.945-2.798 7.156-6.38 7.156Z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath d='M0 0h71v55H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E")
no-repeat;
.icon {
font-size: 1.5rem;
color: var(--colorNeutralForeground1);
}

.group > summary {
Expand All @@ -146,9 +118,6 @@ import Search from "./search.astro";
box-shadow: var(--shadow4);
}

li {
list-style: none;
}
.group-content a {
display: flex;
}
Expand All @@ -161,53 +130,47 @@ import Search from "./search.astro";

<div id="header-nav-content" class="nav-content">
<div class="items">
<li>
<details class="group">
<summary>Use cases <Icon name="down-caret" /></summary>
<ul class="group-content">
<li><Link class="item link" href="/openapi">OpenAPI</Link></li>
<li><Link class="item link" href="/data-validation">Data Validation</Link></li>
<li><Link class="item link" href="/tooling">Tooling support</Link></li>
</ul>
</details>
</li>
<li><Link class="item link" href="/docs">Docs</Link></li>
<li><Link class="item link" href="/playground">Playground</Link></li>
<details class="group item">
<summary>Use cases <Icon name="down-caret" /></summary>
<ul class="group-content">
<li><Link class="item link" href="/openapi">OpenAPI</Link></li>
<li><Link class="item link" href="/data-validation">Data Validation</Link></li>
<li><Link class="item link" href="/tooling">Tooling support</Link></li>
</ul>
</details>
<Link class="item link" href="/docs">Docs</Link>
<Link class="item link" href="/playground">Playground</Link>
<!-- TODO: add blog -->
<!-- <Link class="item link" href="/blog">Blog</Link> -->
<li><Link class="item link" href="/community">Community</Link></li>
<Link class="item link" href="/community">Community</Link>
</div>
<div class="items right">
<li>
<Link
class="item github-link"
href="https://github.com/microsoft/typespec"
target="_blank"
rel="noopener noreferrer"
/>
</li>
<li>
<Link
class="item discord-link"
href="https://aka.ms/typespec/discord"
target="_blank"
rel="noopener noreferrer"
/>
</li>
<li>
<Link
class="item icon link"
href="https://github.com/microsoft/typespec"
target="_blank"
rel="noopener noreferrer"><Icon name="github" /></Link
>
<Link
class="item icon link"
href="https://aka.ms/typespec/discord"
target="_blank"
rel="noopener noreferrer"><Icon name="discord" /></Link
>
<div class="item">
<ThemePicker />
</li>
</div>
</div>
</div>
<Search />
<button id="header-drawer-button" type="button" class="lg:hidden" title="Show Menu">
<button id="header-drawer-button" type="button" class="lg:hidden icon" title="Show Menu">
<Icon name="bars" />
</button>
</nav>

<script>
const button = document.querySelector("#header-drawer-button") as HTMLElement;
const navcontent = document.querySelector("#header-nav-content") as HTMLElement;
const button = document.getElementById("header-drawer-button")!;
const navcontent = document.getElementById("header-nav-content")!;
button.addEventListener("click", () => {
if (navcontent.dataset.open === "true") {
navcontent.dataset.open = "false";
Expand Down

0 comments on commit 9038fd0

Please sign in to comment.