Skip to content

Commit bec7c5e

Browse files
committed
docs: refine comments and documentation for clarity
1 parent df3734b commit bec7c5e

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ This guide is for developers maintaining or contributing to this project.
6060
```bash
6161
.
6262
├── src/
63-
│ ├── app/ # Next.js App Router pages and layouts.
63+
│ ├── app/ # Next.js App Router pages and layouts
6464
│ ├── components/
65-
│ │ ├── sections/ # Reusable large components.
66-
│ │ ├── primitives/ # Reusable small components.
67-
│ │ └── ui/ # Unmodified shadcn/ui components.
68-
│ ├── lib/ # Utilities and site configuration.
69-
│ └── providers/ # App-wide context and state providers.
70-
├── public/ # Static assets (images, icons).
65+
│ │ ├── primitives/ # Small components that take little space on the screen
66+
│ │ ├── sections/ # Large components that can take up the entire screen
67+
│ │ └── ui/ # Only put shadcn/ui components here for clarity
68+
│ ├── lib/ # frequently reused functions and data
69+
│ └── providers/ # App-wide context and state providers
70+
├── public/ # non-code assets
7171
```
7272
7373
## Working with `shadcn/ui`

src/components/primitives/smart-link.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
// Will be imported by client components
34
import { isInternalHref } from "@/lib/utils";
45
import Link from "next/link";
56
import { forwardRef, type AnchorHTMLAttributes, type ReactNode } from "react";
@@ -29,6 +30,7 @@ export const SmartLink = forwardRef<HTMLAnchorElement, SmartLinkProps>(function
2930
}
3031

3132
const computedTarget = target ?? "_blank";
33+
// I like referrers; +rep for marketing people
3234
const computedRel = rel ?? (computedTarget === "_blank" ? "noopener" : undefined);
3335

3436
return (

src/components/sections/coming-soon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Construction } from "lucide-react";
44
export const comingSoonText = "We're working hard to bring you this page. Stay tuned for something amazing!";
55

66
export function ComingSoon({ title }: { title?: string }) {
7-
const heading = title ? `${title} is Coming Soon!` : "Coming Soon!";
7+
const heading = title ? `${title} is Coming Soon!` : "Coming Soon!"; // Make each "Coming Soon" page unique
88
return (
99
<div className="flex min-h-[calc(100vh-8rem)] flex-col items-center justify-center px-4 text-center">
1010
<Construction className="text-primary mb-4 h-16 w-16" />

src/components/sections/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export function Header() {
180180
>
181181
<motion.div
182182
initial={false}
183-
animate={isOpen ? { opacity: 1, height: "auto" } : { opacity: 0, height: 0 }}
183+
animate={isOpen ? { opacity: 1, height: "auto" } : { opacity: 0, height: 0 }} // Closing must be animated to reduce SPA page navigation flash
184184
transition={{ duration: 0.3, ease: "easeInOut" }}
185185
className="absolute right-0 left-0 overflow-hidden"
186186
>

src/components/sections/resource-iframe.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { cn, isInternalHref, noReturnDebounce } from "@/lib/utils";
77
import { CSSProperties, RefObject, useCallback, useEffect, useRef, useState } from "react";
88

99
const IFRAME_DEFAULTS = {
10-
WIDTH: 1440,
10+
WIDTH: 1440, // Magic! Experiment with this for different iframed websites
1111
HEIGHT: 600,
1212
} as const;
1313

@@ -31,7 +31,7 @@ function createScaleTransformStyle(scale: number, hideTopPx: number = 0) {
3131
}
3232

3333
/**
34-
* A hook to calculate the responsive scale of an element based on its container's width.
34+
* Resize the iframe zoom level to fit the container width to make it look normal
3535
*/
3636
function useResponsiveScale(targetRef: RefObject<HTMLElement | null>, sourceWidth: number): number {
3737
const [scale, setScale] = useState(1);
@@ -58,17 +58,14 @@ type ResourceIframeProps = {
5858
className?: string;
5959
scale?: number;
6060
desktopWidth?: number;
61-
/** Can be a number (px) or CSS height string (e.g. "100dvh"). */
6261
containerHeight?: number | CSSProperties["height"];
63-
/** Number of pixels to hide from the top of the iframe content (pre-scale units). */
62+
/** Adjust this to hide Wix/WordPress ad headers */
6463
hideTopPx?: number;
65-
/** Internal link to a full-page view. If provided, the header button links here instead of external site. */
64+
/** We host the iframe fullscreen ourselves, so we can link to it */
6665
fullPageHref?: string;
67-
/** If true, omits the header (useful for full-page variant). */
66+
/** Useful for the full-page variant, which is just the iframe */
6867
hideHeader?: boolean;
69-
/** If true, shows the iframe on mobile as well (not just md+). */
7068
showOnMobile?: boolean;
71-
/** Optional small text line to display the author information. */
7269
authorLine?: string;
7370
};
7471

src/lib/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function buildPageMetadata(
7474
title: label,
7575
description,
7676
alternates: {
77-
canonical: path === "/" ? "/" : path.replace(/\/$/, ""),
77+
canonical: path === "/" ? "/" : path.replace(/\/$/, ""), // Google Search Console; prevents {www.}alphahku.page subdomain issues
7878
},
7979
openGraph: {
8080
title: label,

src/lib/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function noReturnDebounce<T extends unknown[]>(
1919
};
2020
}
2121

22+
// For SPA route detection
2223
export function isInternalHref(href: string): boolean {
2324
if (!href) return false;
2425
if (!href.startsWith("/")) return false;

0 commit comments

Comments
 (0)