Skip to content

Commit

Permalink
feat: initial layout
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-ub committed Jul 26, 2024
1 parent 7227b56 commit 6ebb095
Show file tree
Hide file tree
Showing 37 changed files with 2,985 additions and 306 deletions.
30 changes: 22 additions & 8 deletions apps/www/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import tailwind from "@astrojs/tailwind";
// import angular from "@analogjs/astro-angular";
import angular from "@analogjs/astro-angular";

import { siteConfig } from "./src/config/site";

// https://astro.build/config
export default defineConfig({
site: "https://ui.adrianub.dev",
site: siteConfig.url,
integrations: [
// angular(),
angular(),
starlight({
title: "shadcn-ng",
title: siteConfig.name,
logo: {
dark: "./src/assets/logo-dark.svg",
light: "./src/assets/logo-light.svg",
},
favicon: "./src/assets/logo-dark.svg",
social: {
github: "https://github.com/adrian-ub/shadcn-ng",
github: siteConfig.links.github,
"x.com": siteConfig.links.twitter,
},
sidebar: [
{
Expand All @@ -27,9 +30,20 @@ export default defineConfig({
},
],
customCss: ["./src/tailwind.css"],
components: {
Header: "./src/components/starlight/header/Header.astro",
PageFrame: "./src/components/starlight/PageFrame.astro",
SiteTitle: "./src/components/starlight/SiteTitle.astro",
SocialIcons: "./src/components/starlight/SocialIcons.astro",
Search: "./src/components/starlight/Search.astro",
Hero: "./src/components/starlight/Hero.astro",
ContentPanel: "./src/components/starlight/ContentPanel.astro",
PageTitle: "./src/components/starlight/PageTitle.astro",
MarkdownContent: "./src/components/starlight/MarkdownContent.astro",
TwoColumnContent: "./src/components/starlight/TwoColumnContent.astro",
Sidebar: "./src/components/starlight/Sidebar.astro",
},
}),
tailwind({
applyBaseStyles: false,
}),
tailwind(),
],
});
28 changes: 15 additions & 13 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@
"astro": "astro"
},
"dependencies": {
"@analogjs/astro-angular": "^1.6.3",
"@angular-devkit/build-angular": "^18.1.1",
"@angular/animations": "^18.1.1",
"@analogjs/astro-angular": "^1.6.4",
"@angular-devkit/build-angular": "^18.1.2",
"@angular/animations": "^18.1.2",
"@angular/cdk": "^18.1.1",
"@angular/common": "^18.1.1",
"@angular/compiler": "^18.1.1",
"@angular/compiler-cli": "^18.1.1",
"@angular/core": "^18.1.1",
"@angular/language-service": "^18.1.1",
"@angular/platform-browser": "^18.1.1",
"@angular/platform-browser-dynamic": "^18.1.1",
"@angular/platform-server": "^18.1.1",
"@astrojs/check": "^0.8.2",
"@angular/common": "^18.1.2",
"@angular/compiler": "^18.1.2",
"@angular/compiler-cli": "^18.1.2",
"@angular/core": "^18.1.2",
"@angular/language-service": "^18.1.2",
"@angular/platform-browser": "^18.1.2",
"@angular/platform-browser-dynamic": "^18.1.2",
"@angular/platform-server": "^18.1.2",
"@astrojs/check": "^0.8.3",
"@astrojs/starlight": "^0.25.2",
"@astrojs/starlight-tailwind": "^2.0.3",
"@astrojs/tailwind": "^5.1.0",
"@pagefind/default-ui": "^1.1.0",
"@radix-ng/primitives": "^0.8.2",
"astro": "^4.12.2",
"class-variance-authority": "^0.7.0",
Expand All @@ -42,6 +43,7 @@
"zone.js": "^0.14.8"
},
"devDependencies": {
"@types/lodash.template": "^4.5.1"
"@types/lodash.template": "^4.5.1",
"prettier": "^3.3.3"
}
}
1 change: 1 addition & 0 deletions apps/www/src/components/starlight/ContentPanel.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<slot />
50 changes: 50 additions & 0 deletions apps/www/src/components/starlight/Hero.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
import type { Props } from "@astrojs/starlight/props";
import { buttonVariants } from "@/registry/new-york/ui/button.directive";
import { cn } from "@/lib/utils";
import { PAGE_TITLE_ID } from "../../constants";
const { data } = Astro.props.entry;
const { title = data.title, tagline, actions = [] } = data.hero || {};
---

<section
class="mx-auto flex flex-col items-start gap-2 px-4 py-8 md:py-12 md:pb-8 lg:py-12 lg:pb-10"
>
<h1
id={PAGE_TITLE_ID}
data-page-title
set:html={title}
class="text-3xl font-bold leading-tight tracking-tighter md:text-4xl lg:leading-[1.1]"
/>
{
tagline && (
<p
class="max-w-2xl text-lg font-light text-foreground"
set:html={tagline}
/>
)
}
{
actions.length > 0 && (
<div class="flex w-full items-center justify-start gap-2 py-2">
{actions.map(({ text, link, ...attrs }) => (
<a
href={link}
class={cn(
buttonVariants({
variant:
attrs.variant === "minimal" || attrs.variant === "primary"
? "default"
: "ghost",
size: "sm",
})
)}
set:html={text}
/>
// <CallToAction {...attrs} set:html={text} />
))}
</div>
)
}
</section>
5 changes: 5 additions & 0 deletions apps/www/src/components/starlight/MarkdownContent.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
import "../../style/markdown.css";
---

<div class="sl-markdown-content pb-12 pt-8"><slot /></div>
32 changes: 32 additions & 0 deletions apps/www/src/components/starlight/PageFrame.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
import MobileMenuToggle from "@astrojs/starlight/components/MobileMenuToggle.astro";
import type { Props } from "@astrojs/starlight/props";
const { hasSidebar, labels } = Astro.props;
---

<slot name="header" />
<main class="flex-1">
<div class="container relative">
{
hasSidebar ? (
<div class="border-b">
<div class="container flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10">
<aside
class="fixed top-14 z-30 -ml-2 hidden h-[calc(100vh-3.5rem)] w-full shrink-0 md:sticky md:block"
aria-label={labels["sidebarNav.accessibleLabel"]}
>
<div class="h-full py-6 pr-6 lg:py-8">
<MobileMenuToggle {...Astro.props} />
<slot name="sidebar" />
</div>
</aside>
<slot />
</div>
</div>
) : (
<slot />
)
}
</div>
</main>
59 changes: 59 additions & 0 deletions apps/www/src/components/starlight/PageTitle.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
import { cn } from "@/lib/utils";
import { PAGE_TITLE_ID } from "../../constants";
import type { Props } from "@astrojs/starlight/props";
import { badgeVariants } from "@/registry/new-york/ui/badge.directive";
---

<div
class="mb-4 flex items-center space-x-1 text-sm leading-none text-muted-foreground"
>
<div class="truncate">Docs</div>
<!-- <ChevronRightIcon class="h-3.5 w-3.5" /> -->
<div class="text-foreground">{Astro.props.entry.data.title}</div>
</div>

<div class="space-y-2">
<h1 class="scroll-m-20 text-3xl font-bold tracking-tight" id={PAGE_TITLE_ID}>
{Astro.props.entry.data.title}
</h1>
{
Astro.props.entry.data.description && (
<p class="text-base text-muted-foreground">
<span style="text-wrap: balance; display: inline-block; vertical-align: top; text-decoration: inherit; max-width: 454px;">
{Astro.props.entry.data.description}
</span>
</p>
)
}
</div>

{
Astro.props.entry.data.links ? (
<div class="flex items-center space-x-2 pt-4">
{Astro.props.entry.data.links.doc && (
<a
href={Astro.props.entry.data.links.doc}
target="_blank"
rel="noreferrer"
class={cn(badgeVariants({ variant: "secondary" }), "gap-1")}
>
Docs
{/* <ExternalLinkIcon class="h-3 w-3" /> */}
</a>
)}
{Astro.props.entry.data.links.api && (
<a
href={Astro.props.entry.data.links.api}
target="_blank"
rel="noreferrer"
class={cn(badgeVariants({ variant: "secondary" }), "gap-1")}
>
API Reference
{/* <ExternalLinkIcon class="h-3 w-3" /> */}
</a>
)}
</div>
) : null
}
Loading

0 comments on commit 6ebb095

Please sign in to comment.