-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0aacfed
commit 6697790
Showing
9 changed files
with
1,819 additions
and
1,926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,38 @@ | ||
--- | ||
import { CollectionEntry, getCollection } from "astro:content"; | ||
import { array as A, number as N } from "fp-ts"; | ||
import { pipe } from "fp-ts/lib/function"; | ||
import { contramap } from "fp-ts/lib/Ord"; | ||
import { getCollection } from "astro:content"; | ||
import { getDocPathname } from "../utils/docs"; | ||
const allDocs = await getCollection("docs"); | ||
const byOrder = pipe( | ||
N.Ord, | ||
contramap((p: CollectionEntry<"docs">) => p.data.sortOrder) | ||
); | ||
function bySortOrder<T extends { data: { sortOrder: number } }>(a: T, b: T) { | ||
return a.data.sortOrder - b.data.sortOrder; | ||
} | ||
--- | ||
|
||
<aside | ||
class="hidden md:block fixed flex-shrink-0 w-full md:w-64 md:sticky z-10 top-16 self-start overflow-y-auto transform-none" | ||
> | ||
<ul class="p-4 space-y-1"> | ||
{ | ||
pipe( | ||
allDocs, | ||
A.sortBy([byOrder]), | ||
A.map((doc) => { | ||
const docPathname = getDocPathname(doc.slug); | ||
allDocs.sort(bySortOrder).map((doc) => { | ||
const docPathname = getDocPathname(doc.slug); | ||
|
||
// https://github.com/withastro/astro/issues/4547 | ||
const isActive = Astro.url.pathname.startsWith(docPathname); | ||
// https://github.com/withastro/astro/issues/4547 | ||
const isActive = Astro.url.pathname.startsWith(docPathname); | ||
|
||
return ( | ||
<li> | ||
<a | ||
class="block no-underline px-2 py-[0.375rem] font-medium select-none rounded text-sm hover:bg-emerald-50 active-link:bg-emerald-100 active-link:font-semibold" | ||
aria-current={isActive ? "page" : "false"} | ||
href={docPathname} | ||
> | ||
{doc.data.title} | ||
</a> | ||
</li> | ||
); | ||
}) | ||
) | ||
return ( | ||
<li> | ||
<a | ||
class="block no-underline px-2 py-[0.375rem] font-medium select-none rounded text-sm hover:bg-emerald-50 active-link:bg-emerald-100 active-link:font-semibold" | ||
aria-current={isActive ? "page" : "false"} | ||
href={docPathname} | ||
> | ||
{doc.data.title} | ||
</a> | ||
</li> | ||
); | ||
}) | ||
} | ||
</ul> | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
6697790
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
react-awesome-reveal – ./
react-awesome-reveal-git-main-morellodev.vercel.app
react-awesome-reveal-morellodev.vercel.app
react-awesome-reveal.morello.dev