Skip to content

Commit 2793ceb

Browse files
authored
Perseus documentation improvements (#2778)
## Summary: Perseus documentation improvements: 1. Add favicon Perseus logo <img width="90" height="44" alt="image" src="https://github.com/user-attachments/assets/27c03f24-86b7-45a7-ba2c-38f7ef05948a" /> 2. Adjust TOC width | | | | ------- | ----- | | Before | <img width="506" height="284" alt="Screenshot 2025-08-08 at 10 12 19 AM" src="https://github.com/user-attachments/assets/2b0665c8-d1da-4455-b0d0-9c89144a4deb" /> | | After | <img width="537" height="238" alt="Screenshot 2025-08-08 at 10 58 30 AM" src="https://github.com/user-attachments/assets/15e1d659-beb8-4b46-bc3f-118b73255869" /> | Author: ivyolamit Reviewers: SonicScrewdriver, ivyolamit Required Reviewers: Approved By: SonicScrewdriver Checks: ✅ 10 checks were successful Pull Request URL: #2778
1 parent 1bc1464 commit 2793ceb

File tree

7 files changed

+176
-1
lines changed

7 files changed

+176
-1
lines changed

.changeset/thirty-candles-taste.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.storybook/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body {
1313
"Helvetica", "Corbel", sans-serif;
1414
font-size: 14px;
1515
margin: 0;
16-
color: var(--wb-semanticColor-text-primary);
16+
color: var(--wb-semanticColor-core-foreground-neutral-strong);
1717
line-height: 1.4;
1818
min-width: 0;
1919
}

.storybook/manager-head.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<link rel="icon" type="image/svg+xml" href="./perseus-favicon.svg" />
2+
<link rel="shortcut icon" href="./perseus-favicon.svg" />

.storybook/preview-head.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,25 @@
5757
/>
5858

5959
<link rel="stylesheet" href="./lato.css" />
60+
61+
<link
62+
rel="stylesheet"
63+
href="https://fonts.googleapis.com/css?family=Inconsolata"
64+
/>
65+
<link
66+
href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&display=swap"
67+
rel="stylesheet"
68+
/>
69+
<link rel="stylesheet" href="./storybook-styles/preview.css" />
70+
<style>
71+
body {
72+
font-family: "Lato", sans-serif;
73+
font-size: 16px !important;
74+
}
75+
76+
/* Overrides the ArgTypes table tabs to avoid some z-index issues with
77+
components that rely on PopperJS (specially Dropdown) */
78+
.os-padding {
79+
z-index: initial !important;
80+
}
81+
</style>

.storybook/preview.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ const preview: Preview = {
131131
},
132132
docs: {
133133
toc: {
134+
// Useful for MDX pages
134135
headingSelector: "h2, h3",
136+
// Prevents including generic headings like "Stories" and "Usage".
137+
ignoreSelector:
138+
".docs-story h2, .docs-story h3, .sbdocs #stories, .sbdocs #usage, .sbdocs-subtitle, .sbdocs h2:first-of-type, .sbdocs .sb-anchor[id='stories'] + h2, .sbdocs .sb-anchor[id='usage'] + h2",
135139
},
136140
},
137141
},

static/perseus-favicon.svg

Lines changed: 86 additions & 0 deletions
Loading

static/storybook-styles/preview.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Overrides for the Storybook preview iframe.
3+
*/
4+
html {
5+
font-size: 62.5%;
6+
}
7+
8+
/* These overrides depend on a Base 10 font size */
9+
.sb-show-main.sb-main-padded {
10+
padding: 0.8rem;
11+
}
12+
13+
.sbdocs.sbdocs-wrapper {
14+
padding: 0 2rem 3.2rem 2rem;
15+
gap: 2.4rem;
16+
}
17+
18+
.sbdocs ul,
19+
.sbdocs li,
20+
.sbdocs p,
21+
.sbdocs p *:not(a) {
22+
color: var(--wb-semanticColor-core-foreground-neutral-strong);
23+
font-size: var(--wb-font-size-small);
24+
line-height: var(--wb-font-lineHeight-small);
25+
}
26+
27+
.sbdocs .docblock-argstable p,
28+
.sbdocs .docblock-argstable ul,
29+
.sbdocs .docblock-argstable li {
30+
font-size: 1em;
31+
}
32+
33+
/* TOC wrapper */
34+
.sbdocs-content + div {
35+
width: 14rem;
36+
}
37+
38+
.sbdocs-content + div > * {
39+
width: 14rem;
40+
padding-top: 6.4rem;
41+
padding-bottom: 3.2rem;
42+
}
43+
44+
/* TOC navigation styling */
45+
.sbdocs aside {
46+
width: 26rem !important;
47+
}
48+
49+
.sbdocs aside nav {
50+
width: 21rem !important;
51+
}
52+
53+
/* Hide unwanted headings in TOC navigation */
54+
.sbdocs aside nav a[href="#stories"],
55+
.sbdocs aside nav a[href="#usage"],
56+
.sbdocs aside nav a[title="Stories"],
57+
.sbdocs aside nav a[title="Usage"] {
58+
display: none !important;
59+
}

0 commit comments

Comments
 (0)