Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions apps/docs/src/components/layout/ShowcaseLayout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
import '../../styles/fonts.css';
import '@shift-css/core';
import ThemeToggle from '../ui/ThemeToggle.astro';
import ThemeCustomizer from '../ui/ThemeCustomizer.astro';

interface Props {
title: string;
description?: string;
}

const { title, description = 'Shift CSS Showcase' } = Astro.props;
const siteTitle = `${title} | Shift CSS Showcase`;
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
const canonicalURL = new URL(Astro.url.pathname, 'https://getshiftcss.com');
---

<!doctype html>
<html lang="en" style="color-scheme: light dark">
<head>
<script is:inline>
(function () {
var stored = localStorage.getItem('shift-docs-theme');
if (stored) {
document.documentElement.style.colorScheme = stored;
}
})();
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content={description} />
<title>{siteTitle}</title>

<link rel="canonical" href={canonicalURL} />

<meta property="og:type" content="website" />
<meta property="og:url" content={canonicalURL} />
<meta property="og:title" content={siteTitle} />
<meta property="og:description" content={description} />
<meta property="og:site_name" content="Shift CSS" />

<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content={siteTitle} />
<meta name="twitter:description" content={description} />

<link rel="icon" type="image/svg+xml" href={`${base}/favicon.svg`} />

<link rel="preload" href={`${base}/fonts/inter-latin-400-normal.woff2`} as="font" type="font/woff2" crossorigin />
<link rel="preload" href={`${base}/fonts/jetbrains-mono-latin-400-normal.woff2`} as="font" type="font/woff2" crossorigin />
</head>
<body>
<slot />
<div class="showcase-controls">
<ThemeToggle />
</div>
<ThemeCustomizer />
</body>
</html>

<style is:global>
html {
scroll-behavior: smooth;
}

body {
font-family:
'Inter',
var(--s-font-sans),
system-ui,
-apple-system,
sans-serif;
background: var(--s-surface-base);
color: var(--s-text-primary);
overflow-x: hidden;
}

code,
pre,
kbd {
font-family:
'JetBrains Mono',
var(--s-font-mono),
ui-monospace,
monospace;
}

:focus-visible {
outline: 2px solid var(--s-interactive-primary);
outline-offset: 2px;
}

/* Theme toggle positioning */
.showcase-controls {
position: fixed;
bottom: var(--s-space-6);
left: var(--s-space-6);
z-index: 100;
}

.showcase-controls .theme-toggle {
background: var(--s-surface-raised);
border: 1px solid var(--s-border-default);
box-shadow: var(--s-shadow-lg);
width: 48px;
height: 48px;
border-radius: var(--s-radius-full);
}

/* Theme fade transition */
.theme-transitioning::before {
content: '';
position: fixed;
inset: 0;
z-index: 9999;
background: oklch(10% 0 0);
animation: theme-fade 0.3s ease-in-out forwards;
pointer-events: none;
}

@keyframes theme-fade {
0%, 100% { opacity: 0; }
50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}

@media (max-width: 640px) {
.showcase-controls {
bottom: var(--s-space-4);
left: var(--s-space-4);
}
}
</style>
15 changes: 15 additions & 0 deletions apps/docs/src/components/navigation/MobileMenu.astro
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,24 @@ const navigation = getNavigation(base);
const isActive =
item.href === currentPath ||
item.href === currentPath.replace(/\/$/, '');
const isShowcase = item.href.includes('/showcase/');

return (
<a
href={item.href}
class="docs-sidebar-link"
aria-current={isActive ? 'page' : undefined}
target={isShowcase ? '_blank' : undefined}
rel={isShowcase ? 'noopener' : undefined}
data-mobile-link
>
{item.label}
{isShowcase && (
<>
<span s-sr-only>(opens in new tab)</span>
<span class="external-icon" aria-hidden="true">↗</span>
</>
)}
</a>
);
})}
Expand Down Expand Up @@ -93,6 +102,12 @@ const navigation = getNavigation(base);
flex-direction: column;
gap: var(--s-space-1);
}

.external-icon {
font-size: 0.75em;
opacity: 0.6;
margin-left: var(--s-space-1);
}
</style>

<script>
Expand Down
15 changes: 15 additions & 0 deletions apps/docs/src/components/navigation/SidebarGroup.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@ const { group, currentPath } = Astro.props;
group.items.map((item) => {
const isActive =
item.href === currentPath || item.href === currentPath.replace(/\/$/, '');
const isShowcase = item.href.includes('/showcase/');

return (
<a
href={item.href}
class="docs-sidebar-link"
aria-current={isActive ? 'page' : undefined}
target={isShowcase ? '_blank' : undefined}
rel={isShowcase ? 'noopener' : undefined}
>
{item.label}
{isShowcase && (
<>
<span s-sr-only>(opens in new tab)</span>
<span class="external-icon" aria-hidden="true">↗</span>
</>
)}
</a>
);
})
Expand All @@ -37,4 +46,10 @@ const { group, currentPath } = Astro.props;
flex-direction: column;
gap: var(--s-space-1);
}

.external-icon {
font-size: 0.75em;
opacity: 0.6;
margin-left: var(--s-space-1);
}
</style>
8 changes: 8 additions & 0 deletions apps/docs/src/data/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ const navigationData: NavEntry[] = [
{ label: 'Typography', href: '/tokens/typography' },
],
},
{
label: 'Showcase',
items: [
{ label: 'Dashboard', href: '/showcase/dashboard' },
{ label: 'Landing Page', href: '/showcase/landing' },
{ label: 'Article', href: '/showcase/article' },
],
},
];

export function isNavGroup(entry: NavEntry): entry is NavGroup {
Expand Down
Loading