Skip to content

Commit f563a77

Browse files
fix(site): bring the latest site fixes from the new-website workshop (anomalyco#62613)
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
1 parent 4d2aec2 commit f563a77

71 files changed

Lines changed: 426 additions & 141 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎services/site/DESIGN.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ To add a rule, add one line under its group. Mark a rule that is still being dec
7272
- Use `component/faq.tsx` for every accordion. → [Accordion](/dev/components#faq)
7373
- Every dropdown uses the shared Dropdown component; no one-off menus. On the site that is `SiteMenu` (`component/site/site-menu.tsx`), which brings the shared menu look, keyboard support and the phone sheet.
7474
- Open every dropdown with `placeMenu` (`component/site/place-menu.ts`; SiteMenu already does). It opens below the trigger, above only when below has no room, and in the top layer, so a scrolling box such as the carousel never cuts it off.
75+
- A dropdown that opens from a button with an icon starts at the button's inline-start edge, and its row icons and labels sit exactly under the button's icon and label (within 0.5px; mirrored in RTL). Set the rows' inset and gap from the button's own tokens (`--icon-inset`, `--icon-gap` in `site.css`), never per menu. Phone bottom sheets are not anchored to the button, so they don't follow this. → [Split button](/dev/components#split-button)
7576
- Turn dropdowns into the shared bottom sheet (`sheet.tsx`) on touch phones. → [Bottom sheet](/dev/components#sheet)
7677
- Give long pages the Contents rail (`OnThisPage`) and its phone bar (`ContentsMenu`). → [Contents](/dev/components#contents)
7778
- Draw breadcrumbs with muted ancestors, `|` separators and the current page in ink. → [Breadcrumbs](/dev/components#breadcrumb)
7879
- Confirm copy actions in place ("Copied") through a live region; the site has no toasts. → [Copy buttons](/dev/components#copy-buttons)
7980
- On docs pages, the left nav's first item, the content's first item and the right rail's first item share one top line (text tops for the nav and the title, the box top for the search box).
8081
- A sidebar that scrolls under fixed chrome (the docs nav under the logo and lockup) fades out at its edges with a mask, only while items are under that edge; phones keep hard cuts on sticky bars.
82+
- Beside the sidebar, the OpenCode logo and the lockup beside it (DOCS) never move: fixed in the top-left corner at the same place on every page, at rest and scrolled. Whatever passes under them (a sidebar leaving with the article at the page's end) fades out under a strip of the page colour, shown only while something is under it. Phones keep their top bar.
8183
- No flat greys inside callouts or other tinted surfaces; grey layers blend with the surface (mix-blend-mode), except code and table bodies, which stay solid. → [Code inside callouts](/dev/docs-components#blend)
8284
- Code blocks and tables inside a tinted surface blend their header and borders with mix-blend-mode, so they take the surface's hue; code and table bodies stay solid, on the code body colour. → [Code inside callouts](/dev/docs-components#blend)
8385
- Docs code blocks copy with a text-only button in the header: "Copy" turns to "Copied" (or "Failed"), right-aligned in the width of the longest label so nothing moves. → [Code blocks](/dev/docs-components#code-blocks)

‎services/site/script/check-client-bundle.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ const budgets: Record<string, number> = {
6868
"brand/index.tsx": 107,
6969
"changelog/[tag].tsx": 113,
7070
"changelog/index.tsx": 112,
71-
"desktop.tsx": 126.3,
71+
"desktop.tsx": 127.6,
7272
"devices.tsx": 51,
7373
"product/browse.tsx": 106,
7474
"font/index.tsx": 121,
75-
"ide.tsx": 126.3,
75+
"ide.tsx": 127.6,
7676
"index.tsx": 118,
7777
"legal/index.tsx": 148,
7878
"legal/privacy-policy/index.tsx": 137,
7979
"legal/terms-of-service/index.tsx": 135,
80-
"mini.tsx": 126.3,
81-
"mobile.tsx": 126.3,
80+
"mini.tsx": 127.6,
81+
"mobile.tsx": 127.6,
8282
"press/index.tsx": 112,
8383
"product/index.tsx": 114.7,
84-
"sdk.tsx": 126.3,
85-
"terminal.tsx": 126.3,
84+
"sdk.tsx": 127.6,
85+
"terminal.tsx": 127.6,
8686
"video-editor/index.tsx": 49,
8787
}
8888
type Chunk = { file: string; imports?: string[] }

‎services/site/src/component/site/doc-list.css‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
display: flex;
1212
flex-direction: column;
1313
gap: 0.25rem;
14-
padding: 1rem;
15-
margin-inline: -1rem;
14+
padding: var(--doc-row-pad);
15+
margin-inline: calc(-1 * var(--doc-row-pad));
1616
text-decoration: none;
1717
color: var(--text);
1818
outline: 2px solid transparent;
@@ -151,25 +151,25 @@
151151
/* "grey": the menus' hover in neutral grey whatever Menu color is: a light tint and a mid-grey
152152
bar on the left edge. No arrow. */
153153
&[data-hover="grey"] a:focus-visible {
154-
background: var(--bg-weak);
154+
background: var(--doc-row-fill);
155155
}
156156

157157
@media (hover: hover) and (pointer: fine) {
158158
&[data-hover="grey"] a:hover {
159-
background: var(--bg-weak);
159+
background: var(--doc-row-fill);
160160
}
161161
}
162162

163163
&[data-hover="grey"] a:active {
164-
background: var(--bg-weak);
164+
background: var(--doc-row-fill);
165165
}
166166

167167
&[data-hover="grey"] a::before {
168168
top: 0;
169169
bottom: 0;
170170
inset-inline-start: 0;
171171
width: 2px;
172-
background: light-dark(hsl(0, 0%, 50%), hsl(0, 0%, 46%));
172+
background: var(--doc-row-bar);
173173
}
174174

175175
&[data-hover="grey"] a:focus-visible::before {

‎services/site/src/component/site/docs-lockup.css‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -384,18 +384,15 @@
384384

385385
/* Every interactive segment of the lockup (the section word, its chevron, the combined trigger and
386386
the version) shares one set of states, as the Data and Console product names do
387-
(public/nav-demo/switcher.css): hover fills with the logo's inner square beside it (--logo-inner,
388-
site.css) with the text at full strength, pressed and open one step further from the page, and a
389-
2px ring for the keyboard. Neutral grey whatever Settings › Menu color. The visible fill is the
387+
(public/nav-demo/switcher.css): hover fills with half the logo's inner square beside it
388+
(--logo-inner, site.css) over the page, with the text at full strength; pressed and open take the
389+
full inner-square colour, the next step from the page; and a 2px ring for the keyboard. Neutral grey whatever Settings › Menu color. The visible fill is the
390390
logo mark's height (the lockup row is the mark's height and top); a transparent ::before keeps
391391
each hit area 32px tall beside the sidebar and 44px for touch. The separator isn't interactive. */
392392
[data-site] [data-component="docs-lockup"] {
393393
--segment-height: 32px;
394-
--lockup-hover: var(--logo-inner);
395-
--lockup-press: light-dark(
396-
color-mix(in srgb, var(--logo-inner) 94%, black),
397-
color-mix(in srgb, var(--logo-inner) 94%, white)
398-
);
394+
--lockup-hover: color-mix(in srgb, var(--logo-inner) 50%, transparent);
395+
--lockup-press: var(--logo-inner);
399396

400397
@media (max-width: 60rem), (pointer: coarse) {
401398
--segment-height: 44px;

‎services/site/src/component/site/github-link.css‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* The GitHub mark (site.tsx): the mark in the primary ink, the 40px circle round it the link. Beside the sidebar it is fixed in the top-right corner, centred on the logo row
2-
and on the same vertical axis as the voice orb in the bottom-right corner; on small screens it
2+
and as far from the right edge as from the top; on small screens it
33
sits in the top bar, left of the menu button. Bare pages (the font page) have no top bar, so
44
there it stays in the corner at every width. */
55
[data-site] {
@@ -14,6 +14,17 @@
1414
--github-right: calc(0.75rem + (4.5rem - var(--github-size)) / 2 + env(safe-area-inset-right, 0px));
1515
}
1616

17+
/* Beside the sidebar the mark mirrors the logo across the top: it sits as far from the right edge
18+
(of the window, or of the capped layout) as from the top. Its link is centred on the logo row, so
19+
the link's right inset equals its top inset, --top + --logo-height / 2 - --github-size / 2
20+
(the 20px mark then 27.5px from both edges at the default logo size). The controls that sit
21+
beside it or clear it follow --github-right. */
22+
@media (min-width: 60.0625rem) {
23+
--github-right: calc(
24+
var(--top) + var(--logo-height) / 2 - var(--github-size) / 2 + env(safe-area-inset-right, 0px)
25+
);
26+
}
27+
1728
/* The link is the full 40px target round the 20px mark. No backing: over a dark or light surface it takes that
1829
scheme's ink instead (below). */
1930
[data-component="github-link"] {

‎services/site/src/component/site/product-list.css‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,62 @@
9797
margin-inline-start: var(--gutter);
9898
}
9999

100+
/* From 40rem: the Press list's row model (doc-list.css). The row's content stays on the
101+
column's edge with its padding outside it, and the whole row is the link (the button's cover
102+
spans it): hover, press or keyboard focus fills it in the rows' grey and shows the bar at its
103+
start edge, both bleeding past the edge. The gap keeps the items the same distance apart. */
104+
@media (min-width: 40rem) {
105+
row-gap: calc(var(--product-list-gap) - 2 * var(--doc-row-pad));
106+
107+
li {
108+
padding: var(--doc-row-pad);
109+
margin-inline: calc(-1 * var(--doc-row-pad));
110+
transition: background-color 150ms ease;
111+
112+
&::after {
113+
content: "";
114+
position: absolute;
115+
top: 0;
116+
bottom: 0;
117+
inset-inline-start: 0;
118+
width: 2px;
119+
background: var(--doc-row-bar);
120+
opacity: 0;
121+
transition: opacity 150ms ease;
122+
}
123+
124+
&:has([data-slot="get"]:is(:active, :focus-visible)) {
125+
background: var(--doc-row-fill);
126+
127+
&::after {
128+
opacity: 1;
129+
}
130+
}
131+
132+
@media (hover: hover) and (pointer: fine) {
133+
&:hover {
134+
background: var(--doc-row-fill);
135+
136+
&::after {
137+
opacity: 1;
138+
}
139+
}
140+
}
141+
}
142+
143+
/* No press scale: a transform would make the button the box its cover is placed in, and a
144+
click on the row would end outside it. */
145+
[data-slot="get"] {
146+
transform: none !important;
147+
}
148+
149+
[data-slot="get"]::before {
150+
content: "";
151+
position: absolute;
152+
inset: 0;
153+
}
154+
}
155+
100156
/* The nav's corner arrow after an external item's name, as in the phone menu: 6px after the
101157
label and nudged up, in the name's colour. */
102158
[data-slot="name"] [data-slot="external"] {

‎services/site/src/component/site/products.css‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,15 @@
528528
justify-content: center;
529529
}
530530

531-
/* Exactly as wide as the button and its chevron together, from the button's left edge (the
532-
split is the menu's positioning box); a label that doesn't fit ends in an ellipsis. */
531+
/* From the button's inline-start edge (the split is the menu's positioning box), at least as wide
532+
as the button and its chevron together and wider when a row needs it (a shorter translated
533+
button, as in Arabic), so every label shows in full; placeMenu caps it 16px from the window's
534+
edges, and only then does a label end in an ellipsis. */
533535
[data-slot="menu"][data-slot="menu"] {
534536
inset-inline-start: 0;
535537
inset-inline-end: auto;
536-
width: 100%;
537-
min-width: 0;
538+
width: max-content;
539+
min-width: 100%;
538540
transform-origin: bottom var(--x-start, left);
539541

540542
[data-slot="store"] {

‎services/site/src/component/site/products.tsx‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ export function ProductAction(props: { slug: PageSlug; split?: boolean; both?: b
10701070
const storeRow = (item: (typeof stores)[number]) => (
10711071
<>
10721072
<PlatformIcon platform={item.beta ? "TestFlight" : item.platform} />
1073-
<span data-slot="label">
1073+
<span data-slot="label" dir="auto">
10741074
{item.label}
10751075
<Show when={item.beta}>
10761076
<NewTab />
@@ -1102,7 +1102,9 @@ export function ProductAction(props: { slug: PageSlug; split?: boolean; both?: b
11021102
{(item) => (
11031103
<a href={getDownloadHref(item.id)} data-slot="store" role="menuitem">
11041104
<PlatformIcon platform={item.platform} />
1105-
<span data-slot="label">{i18n.t(item.label)}</span>
1105+
<span data-slot="label" dir="auto">
1106+
{i18n.t(item.label)}
1107+
</span>
11061108
</a>
11071109
)}
11081110
</For>
@@ -1268,7 +1270,9 @@ export function ProductAction(props: { slug: PageSlug; split?: boolean; both?: b
12681270
aria-label={i18n.t("site.action.comingSoonFor", { os: item.device })}
12691271
>
12701272
<PlatformIcon platform={item.platform} />
1271-
<span data-slot="label">{item.device}</span>
1273+
<span data-slot="label" dir="auto">
1274+
{item.device}
1275+
</span>
12721276
<span data-slot="status">{i18n.t("site.action.comingSoon")}</span>
12731277
</span>
12741278
</Show>
@@ -1378,13 +1382,11 @@ export function ProductAction(props: { slug: PageSlug; split?: boolean; both?: b
13781382
<For each={desktopBuilds}>
13791383
{(item) => (
13801384
<li>
1381-
<a
1382-
href={getDownloadHref(item.id)}
1383-
data-slot="row"
1384-
on:click={() => sheetControl?.close()}
1385-
>
1385+
<a href={getDownloadHref(item.id)} data-slot="row" on:click={() => sheetControl?.close()}>
13861386
<PlatformIcon platform={item.platform} />
1387-
<span data-slot="label">{i18n.t(item.label)}</span>
1387+
<span data-slot="label" dir="auto">
1388+
{i18n.t(item.label)}
1389+
</span>
13881390
</a>
13891391
</li>
13901392
)}
@@ -1443,7 +1445,9 @@ export function ProductAction(props: { slug: PageSlug; split?: boolean; both?: b
14431445
aria-label={i18n.t("site.action.comingSoonFor", { os: item.device })}
14441446
>
14451447
<PlatformIcon platform={item.platform} />
1446-
<span data-slot="label">{item.device}</span>
1448+
<span data-slot="label" dir="auto">
1449+
{item.device}
1450+
</span>
14471451
<span data-slot="status">{i18n.t("site.action.comingSoon")}</span>
14481452
</button>
14491453
</Show>

‎services/site/src/component/site/rtl.css‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@
3434
unicode-bidi: isolate;
3535
}
3636

37-
/* Menu rows that end in an ellipsis: the cut goes at the end of the label's own text (Latin platform
38-
names and commands end on the right), while the row stays against the menu's start edge. */
39-
[dir="rtl"] [data-slot="menu"] [data-slot="label"] {
37+
/* Menu and phone sheet rows that end in an ellipsis: the cut goes at the end of the label's own text
38+
(Latin platform names and commands end on the right), while the row stays against the menu's
39+
start edge. */
40+
[dir="rtl"] :is([data-slot="menu"], [data-component="sheet"]) [data-slot="label"] {
4041
unicode-bidi: plaintext;
4142
text-align: right;
4243
}
4344

44-
[dir="rtl"] [data-slot="menu"] [data-slot="command"] {
45+
[dir="rtl"] :is([data-slot="menu"], [data-component="sheet"]) [data-slot="command"] {
4546
direction: ltr;
4647
unicode-bidi: isolate;
4748
text-align: right;

0 commit comments

Comments
 (0)