Skip to content

Commit

Permalink
docs(website): improve document structure
Browse files Browse the repository at this point in the history
  • Loading branch information
uhyo committed Aug 24, 2023
1 parent b06f26c commit 80a2bc6
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 208 deletions.
26 changes: 12 additions & 14 deletions website/src/app/(docs)/_toc/Outline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ export const Outline: React.FC<{
}> = ({ toc, currentHeading }) => {
return (
<nav>
<div>
<h2>On this page</h2>
<ul>
{toc.map((item) => (
<li
key={item.id}
data-level={item.level}
data-current={item.id === currentHeading ? "true" : undefined}
>
<a href={`#${item.id}`}>{item.text}</a>
</li>
))}
</ul>
</div>
<h2>On this page</h2>
<ul>
{toc.map((item) => (
<li
key={item.id}
data-level={item.level}
data-current={item.id === currentHeading ? "true" : undefined}
>
<a href={`#${item.id}`}>{item.text}</a>
</li>
))}
</ul>
</nav>
);
};
6 changes: 3 additions & 3 deletions website/src/app/(docs)/_toc/Toc.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
div.toc {
display: grid;
grid-template-columns: 1fr var(--toc-width);
grid-area: toc;
width: var(--toc-width);
}

div.toc nav {
font-size: 0.9rem;
}

div.toc nav > div {
div.toc nav {
position: sticky;
left: 0;
top: 0;
Expand Down
2 changes: 1 addition & 1 deletion website/src/app/(docs)/_toc/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const Toc: React.FC<React.PropsWithChildren> = ({ children }) => {

return (
<>
{children}
<div className="toc">
{children}
<Outline toc={toc} currentHeading={currentHeading} />
</div>
</>
Expand Down
1 change: 0 additions & 1 deletion website/src/app/(docs)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Footer } from "../_utils/Footer";
import { Header } from "../_utils/Header";
import { Toc } from "./_toc";

export default function DocsLayout({
children,
Expand Down
14 changes: 7 additions & 7 deletions website/src/app/(toppage)/page.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.main hgroup {
.header hgroup {
max-width: 90vw;
min-height: 12em;
margin-inline: auto;
Expand All @@ -9,37 +9,37 @@
font-family: var(--font-outfit);
}

.main hgroup > p:first-of-type {
.header hgroup > p:first-of-type {
grid-column: 1;
grid-row: 1 / span 2;
align-self: center;
}

.main hgroup img {
.header hgroup img {
max-width: 30vw;
height: auto;
}

.main hgroup h1 {
.header hgroup h1 {
display: flex;
flex-flow: row nowrap;
align-items: center;
font-size: min(5em, 15vw);
}

.main hgroup h1 > span {
.header hgroup h1 > span {
background: var(--nitrogql-gradient);
color: transparent;
background-clip: text;
-webkit-background-clip: text;
}

.main hgroup > p:last-of-type {
.header hgroup > p:last-of-type {
font-size: 1.5em;
font-weight: bold;
}

.main main > p {
main.main > p {
font-size: 1.2em;
}

Expand Down
Loading

0 comments on commit 80a2bc6

Please sign in to comment.