Skip to content

Commit

Permalink
Slight site improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpetryk committed Mar 4, 2024
1 parent c9ed792 commit 583a671
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/app/guides/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export function GuideLink({ sectionTitle, guideSlug, children }: GuideLinkProps)
hover:text-blue-700 focus:text-blue-700
focus:z-10
dark:text-slate-300 dark:focus:text-blue-300 dark:hover:text-blue-300
transition
active:scale-[0.99]
${
active
? "text-blue-700 dark:text-blue-400 dark:focus:text-blue-400 dark:hover:text-blue-400 font-bold md:bg-slate-100 md:dark:bg-slate-800"
Expand Down
11 changes: 10 additions & 1 deletion docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "./globals.css"
import "../node_modules/@wooorm/starry-night/style/core.css"
import "../node_modules/@wooorm/starry-night/style/dark.css"
import { Metadata } from "next"
import mafsPkg from "../../package.json"

export const metadata: Metadata = {
title: "Mafs: React components for interactive math",
Expand All @@ -21,8 +22,16 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</head>
<body className="flex flex-col min-h-screen items-stretch dark:bg-gray-900">
<header className="sm:flex sm:space-x-6 sm:space-y-0 space-y-6 items-center p-6 self-center w-full max-w-5xl">
<div className="flex-shrink-0 flex justify-center md:block md:w-56 mx-auto lg:mx-0">
<div className="flex-shrink-0 flex justify-center items-center md:block md:w-56 mx-auto lg:mx-0 gap-4">
<Logo />

<Link
href={`https://github.com/stevenpetryk/mafs/releases`}
target="_blank"
className="text-sm px-3 py-1 bg-gray-100 rounded-lg text-gray-700 dark:text-gray-300 dark:bg-gray-800"
>
v{mafsPkg.version}
</Link>
</div>
<div className="flex-grow">
{/* The world isn't ready for search */}
Expand Down
11 changes: 11 additions & 0 deletions docs/components/PropTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from "react"
import ReactMarkdown from "react-markdown"

import DocgenInfo from "../generated-docgen"
import Link from "next/link"

export interface Docgen {
filePath: string
Expand Down Expand Up @@ -55,6 +56,16 @@ export function PropTable({ of: displayName }: PropTableProps) {
</>
)}
</code>

<div className="flex-1"></div>

<Link
target="_blank"
className="text-sm"
href={`https://github.com/stevenpetryk/mafs/tree/main/${docgenInfo.filePath}`}
>
View on GitHub
</Link>
</header>

<div className="overflow-x-auto text-sm">
Expand Down
7 changes: 6 additions & 1 deletion scripts/docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const parse = docgen.withCustomConfig(tsConfigPath, {
export function writeDocgenResults(docgenInfo: docgen.ComponentDoc[]) {
const writePath = path.join(projectRoot, "docs/generated-docgen.tsx")

docgenInfo = docgenInfo.map((inf) => ({
...inf,
filePath: path.relative(projectRoot, inf.filePath),
}))

fs.writeFileSync(
writePath,
[
Expand All @@ -26,7 +31,7 @@ export function writeDocgenResults(docgenInfo: docgen.ComponentDoc[]) {
console.log(`Docgen updated ${writePath}`)
}

const paths = fg.sync("src/**/*.tsx")
const paths = fg.sync("src/**/*.tsx", { ignore: ["src/index.tsx"] })

const docgenInfo = parse(paths)
writeDocgenResults(docgenInfo)

0 comments on commit 583a671

Please sign in to comment.