From 1b4f69b00a3b92c29617b4c5416e20ca41c6e735 Mon Sep 17 00:00:00 2001 From: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com> Date: Sat, 8 Oct 2022 18:58:28 -0400 Subject: [PATCH] feat(guide): add github links for pages (#8725) --- packages/guide/astro.config.ts | 1 + packages/guide/src/components/ExternalLink.tsx | 10 ++++++++++ packages/guide/src/components/SidebarLayout.astro | 10 +++++++++- packages/guide/src/util/constants.ts | 2 ++ packages/guide/src/util/url.ts | 5 +++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 packages/guide/src/components/ExternalLink.tsx create mode 100644 packages/guide/src/util/url.ts diff --git a/packages/guide/astro.config.ts b/packages/guide/astro.config.ts index 3bbff8935..ceac0eb4c 100644 --- a/packages/guide/astro.config.ts +++ b/packages/guide/astro.config.ts @@ -93,6 +93,7 @@ export default defineConfig({ alias: { 'ariakit/button': fileURLToPath(new URL('node_modules/ariakit/esm/button/index.js', import.meta.url)), 'ariakit/disclosure': fileURLToPath(new URL('node_modules/ariakit/esm/disclosure/index.js', import.meta.url)), + 'ariakit/separator': fileURLToPath(new URL('node_modules/ariakit/esm/separator/index.js', import.meta.url)), 'ariakit-utils/dom': fileURLToPath(new URL('node_modules/ariakit-utils/esm/dom.js', import.meta.url)), 'ariakit-utils/events': fileURLToPath(new URL('node_modules/ariakit-utils/esm/events.js', import.meta.url)), 'ariakit-utils/focus': fileURLToPath(new URL('node_modules/ariakit-utils/esm/focus.js', import.meta.url)), diff --git a/packages/guide/src/components/ExternalLink.tsx b/packages/guide/src/components/ExternalLink.tsx new file mode 100644 index 000000000..8be7e899a --- /dev/null +++ b/packages/guide/src/components/ExternalLink.tsx @@ -0,0 +1,10 @@ +import { FiExternalLink } from 'react-icons/fi'; + +export function ExternalLink({ href, title }: { href: string; title: string }) { + return ( + +

{title}

+ +
+ ); +} diff --git a/packages/guide/src/components/SidebarLayout.astro b/packages/guide/src/components/SidebarLayout.astro index 41a60529a..33d67d644 100644 --- a/packages/guide/src/components/SidebarLayout.astro +++ b/packages/guide/src/components/SidebarLayout.astro @@ -1,13 +1,16 @@ --- +import { Separator } from 'ariakit/separator'; import type { MarkdownLayoutProps } from 'astro'; +import { ExternalLink } from './ExternalLink.jsx'; import { Navbar } from './Navbar.jsx'; import { Outline } from './Outline.jsx'; import { SidebarItems } from './SidebarItems.jsx'; +import { generateGithubURL } from '~/util/url.js'; const pages = await Astro.glob<{ category: string; title: string }>('../pages/**/*.mdx'); type Props = MarkdownLayoutProps<{}>; -const { headings } = Astro.props; +const { headings, url } = Astro.props; ---