Skip to content

Commit 73d8832

Browse files
authored
feat(site): promote browse, hex and opentunnel on the product pages (#62485)
1 parent 2307be1 commit 73d8832

62 files changed

Lines changed: 349 additions & 162 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/src/component/site/companions.css‎

Lines changed: 99 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
/* "More open source products": the apps in one row on the four-column card grid,
2-
one app per column, so three apps leave the last column empty. On phones the row scrolls
3-
sideways with the next app peeking in. */
4-
[data-site] [data-component="companions"] {
5-
margin-top: 2rem;
1+
/* "Works great with OpenCode": the apps in one row on the four-column card grid, one app per
2+
column, so three apps leave the last column empty. On phones the row scrolls sideways with the
3+
next app peeking in. */
4+
5+
/* The shelf takes its own row under the label, across all four columns, like the changelog's
6+
timeline. */
7+
[data-site] [data-component="block"][data-slot="product-companions"] > [data-component="companions"] {
8+
grid-column: 1 / -1;
9+
margin-top: 3.5rem;
610

11+
@media (max-width: 60rem) {
12+
margin-top: 1.5rem;
13+
}
14+
}
15+
16+
[data-site] [data-component="companions"] {
717
[data-slot="track"] {
818
display: grid;
919
grid-template-columns: repeat(4, minmax(0, 1fr));
@@ -13,71 +23,94 @@
1323
list-style: none;
1424
}
1525

26+
/* The icon spans both rows; the name sits over the category, and the button on the right. */
1627
[data-component="companion"] {
1728
position: relative;
1829
display: grid;
1930
grid-template-columns: 3.5rem minmax(0, 1fr) auto;
31+
grid-template-rows: auto auto;
2032
align-items: center;
2133
/* The icons carry a 10% margin of their own, so the visible gap to the text is about 14px. */
2234
column-gap: 0.5rem;
35+
row-gap: 0.125rem;
2336
/* Each app sits on its own light grey tile with an even 1rem of visible space on every side.
2437
The icon carries a 0.35rem margin of its own, so the sides it touches pad less. */
2538
padding-block: calc(1rem - 0.35rem);
2639
padding-inline: calc(1rem - 0.35rem) 1rem;
2740
background: var(--bg-weak);
2841
}
2942

30-
/* A black placeholder in the app-icon shape until the icons are final: a 10% margin and a 22.5%
31-
corner on the tile. */
43+
/* The icon and name are one link; it lays them out on the row's grid. */
44+
[data-slot="link"] {
45+
grid-column: 1 / 3;
46+
grid-row: 1 / 3;
47+
display: grid;
48+
grid-template-columns: subgrid;
49+
grid-template-rows: subgrid;
50+
align-items: center;
51+
color: var(--text-strong);
52+
text-decoration: none;
53+
transition: color 150ms ease;
54+
55+
/* The whole row is the link's target. */
56+
&::after {
57+
content: "";
58+
position: absolute;
59+
inset: 0;
60+
}
61+
62+
&:focus-visible {
63+
outline: none;
64+
}
65+
66+
&:focus-visible::after {
67+
outline: 2px solid var(--link);
68+
outline-offset: -2px;
69+
}
70+
}
71+
72+
/* The app's own icon, which carries a 10% margin and its rounded corners. */
3273
[data-slot="icon"] {
74+
grid-column: 1;
75+
grid-row: 1 / 3;
76+
display: block;
3377
width: 3.5rem;
3478
height: 3.5rem;
35-
padding: 0.35rem;
36-
background: #0a0a0a;
37-
background-clip: content-box;
38-
border-radius: calc(0.35rem + 2.8rem * 0.225);
39-
}
4079

41-
[data-slot="text"] {
42-
display: flex;
43-
flex-direction: column;
44-
gap: 0.125rem;
45-
min-width: 0;
80+
img {
81+
display: block;
82+
width: 100%;
83+
height: 100%;
84+
}
4685
}
4786

4887
[data-slot="name"] {
88+
grid-column: 2;
89+
grid-row: 1;
90+
align-self: end;
4991
overflow: hidden;
5092
text-overflow: ellipsis;
5193
white-space: nowrap;
5294
font-family: var(--font-mono);
5395
font-size: var(--title-size);
5496
line-height: 1.3;
5597
-webkit-text-stroke: var(--title-stroke);
56-
color: var(--text-strong);
57-
58-
/* The whole row is the link's target. */
59-
&::after {
60-
content: "";
61-
position: absolute;
62-
inset: 0;
63-
}
6498
}
6599

66100
/* A card column is narrow, so the category may wrap to a second line rather than clip. */
67101
[data-slot="body"] {
102+
grid-column: 2;
103+
grid-row: 2;
104+
align-self: start;
105+
min-width: 0;
68106
color: var(--text-weak);
69107
line-height: 1.3;
70108
text-wrap: balance;
71109
}
72110

73-
[data-slot="action"] {
74-
display: flex;
75-
flex-direction: column;
76-
align-items: center;
77-
gap: 0.375rem;
78-
}
79-
80111
[data-slot="get"] {
112+
grid-column: 3;
113+
grid-row: 1 / 3;
81114
position: relative;
82115
z-index: 1;
83116
display: grid;
@@ -97,22 +130,37 @@
97130
}
98131
}
99132

133+
/* Hovering anywhere on the row colours the name like the site's other links. */
100134
@media (hover: hover) and (pointer: fine) {
101135
[data-component="companion"]:hover {
136+
[data-slot="link"] {
137+
color: var(--link);
138+
}
139+
102140
[data-slot="get"] {
103141
background: var(--bg-strong-hover);
104142
}
105143
}
106144
}
107145

108146
[data-component="companion"]:active {
147+
[data-slot="link"] {
148+
color: var(--link);
149+
}
150+
109151
[data-slot="get"] {
110152
background: var(--bg-strong-hover);
111153
}
112154
}
113155

114-
[data-component="companion"]:has(:focus-visible) [data-slot="get"] {
115-
background: var(--bg-strong-hover);
156+
[data-component="companion"]:has(:focus-visible) {
157+
[data-slot="link"] {
158+
color: var(--link);
159+
}
160+
161+
[data-slot="get"] {
162+
background: var(--bg-strong-hover);
163+
}
116164
}
117165

118166
/* Below about 1408px a quarter column is too narrow for the name, category and button, so the
@@ -165,32 +213,39 @@
165213
&[data-style="outline compact"],
166214
&[data-style="list"] {
167215
[data-component="companion"] {
168-
grid-template-columns: 2.5rem minmax(0, 1fr) auto;
216+
grid-template-columns: 2.5rem auto minmax(0, 1fr) auto;
217+
grid-template-rows: auto;
169218
column-gap: 0.375rem;
170219
}
171220

221+
[data-slot="link"] {
222+
grid-row: 1;
223+
}
224+
172225
[data-slot="icon"] {
226+
grid-row: 1;
173227
width: 2.5rem;
174228
height: 2.5rem;
175-
padding: 0.25rem;
176-
border-radius: calc(0.25rem + 2rem * 0.225);
177-
}
178-
179-
[data-slot="text"] {
180-
flex-direction: row;
181-
align-items: baseline;
182-
gap: 0.75rem;
183229
}
184230

185231
[data-slot="name"] {
186-
flex-shrink: 0;
232+
align-self: center;
187233
}
188234

189235
[data-slot="body"] {
236+
grid-column: 3;
237+
grid-row: 1;
238+
align-self: center;
239+
padding-inline-start: 0.375rem;
190240
overflow: hidden;
191241
text-overflow: ellipsis;
192242
white-space: nowrap;
193243
}
244+
245+
[data-slot="get"] {
246+
grid-column: 4;
247+
grid-row: 1;
248+
}
194249
}
195250

196251
&[data-style="outline compact"] [data-component="companion"] {
Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,65 @@
11
import { useArea } from "~/i18n/content"
22
import { appsSource } from "~/i18n/content/areas/apps"
33
import { useI18n } from "~/context/i18n"
4+
import { useLanguage } from "~/context/language"
45
import "./companions.css"
5-
import { For } from "solid-js"
6+
import { For, Show } from "solid-js"
67
import { NewTab } from "./icons"
7-
import { anomalyApps } from "./links"
8-
import type { PageSlug } from "./product-data"
8+
import { anomalyApps, appLink } from "./links"
9+
import { SectionHeading } from "./on-this-page"
910
import { siteSettings } from "./settings"
1011

11-
const [hex, opentunnel] = anomalyApps
12-
13-
export const companions: Record<PageSlug, (typeof anomalyApps)[number][]> = {
14-
desktop: [hex, opentunnel],
15-
terminal: [opentunnel, hex],
16-
mobile: [hex, opentunnel],
17-
sdk: [opentunnel, hex],
18-
ide: [opentunnel, hex],
19-
mini: [opentunnel, hex],
20-
}
21-
2212
/**
23-
* "More open source products": the apps in one row, like an app store shelf (icon,
24-
* name, category, Free button). On phones the row scrolls sideways. The `companionStyle` setting
25-
* swaps the grey tiles for a ruled grid or a ruled list.
13+
* "Works great with OpenCode": Anomaly's apps in one row, like an app store shelf (icon, name,
14+
* category, Free button), the same on every product page. On phones the row scrolls sideways. The
15+
* `companionStyle` setting swaps the ruled grid for grey tiles or a ruled list.
2616
*/
27-
export function Companions(props: { product: PageSlug }) {
17+
export function Companions() {
2818
const i18n = useI18n()
19+
const language = useLanguage()
2920
const appCopy = useArea("apps", appsSource)
3021
return (
31-
<section
32-
data-component="companions"
33-
data-section="companions"
34-
data-design="companionStyle"
35-
data-style={siteSettings.companionStyle}
36-
aria-label={i18n.t("site.companions")}
37-
>
38-
<ul data-slot="track">
39-
<For each={companions[props.product]}>
40-
{(app) => (
41-
<li data-component="companion">
42-
<span data-slot="icon" aria-hidden="true" />
43-
<span data-slot="text">
44-
<a data-slot="name" href={app.href} target="_blank" rel="noopener">
45-
{app.name}
46-
<NewTab />
47-
</a>
48-
<span data-slot="body">{appCopy()[app.id].category}</span>
49-
</span>
50-
<span data-slot="action">
51-
{/* The same link as the name, so screen readers and the tab order skip it. */}
52-
<a data-slot="get" href={app.href} target="_blank" rel="noopener" tabindex="-1" aria-hidden="true">
53-
{i18n.t("site.companions.free")}
54-
</a>
55-
</span>
56-
</li>
57-
)}
58-
</For>
59-
</ul>
22+
<section data-component="block" data-slot="product-companions" data-section="companions">
23+
<SectionHeading id="works-with-opencode" title={i18n.t("site.companions")} label />
24+
<div data-component="companions" data-design="companionStyle" data-style={siteSettings.companionStyle}>
25+
<ul data-slot="track">
26+
<For each={anomalyApps}>
27+
{(app) => {
28+
const link = appLink(app, language.route)
29+
const target = link.external ? "_blank" : undefined
30+
const rel = link.external ? "noopener" : undefined
31+
return (
32+
<li data-component="companion">
33+
{/* The icon and name are one link, the row's only stop; the row is its target. */}
34+
<a data-slot="link" href={link.href} target={target} rel={rel}>
35+
<span data-slot="icon" aria-hidden="true">
36+
<img src={app.icon} width="56" height="56" alt="" loading="lazy" />
37+
</span>
38+
<span data-slot="name">
39+
{app.name}
40+
<Show when={link.external}>
41+
<NewTab />
42+
</Show>
43+
</span>
44+
</a>
45+
<span data-slot="body">{appCopy()[app.id].category}</span>
46+
{/* The same link again, so screen readers and the tab order skip it. */}
47+
<a
48+
data-slot="get"
49+
href={link.href}
50+
target={target}
51+
rel={rel}
52+
tabindex="-1"
53+
aria-hidden="true"
54+
>
55+
{i18n.t("site.companions.free")}
56+
</a>
57+
</li>
58+
)
59+
}}
60+
</For>
61+
</ul>
62+
</div>
6063
</section>
6164
)
6265
}

‎services/site/src/component/site/design-overlay.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const settingControls: Record<string, Control> = {
313313
productVideos: setting("productVideos", "Product videos", videoSetIds),
314314
featureClipStyle: setting("featureClipStyle", "Feature clips", () => featureClipStyles),
315315
featureClipCount: setting("featureClipCount", "Feature clips count", () => featureClipCounts),
316-
companionStyle: setting("companionStyle", "More products", () => companionStyles),
316+
companionStyle: setting("companionStyle", "Works great with OpenCode", () => companionStyles),
317317
docsSwitcher: setting("docsSwitcher", "Docs switcher", () => docsSwitchers),
318318
docsSubmenu: setting("docsSubmenu", "Docs submenu", () => docsSubmenus),
319319
docsNav: setting("docsNav", "Docs nav", () => docsNavs),

‎services/site/src/component/site/extension-page.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function ExtensionPage(props: { slug: ExtensionSlug; path?: string }) {
3737
const slug = extensionPages[(index + step + extensionPages.length) % extensionPages.length].slug
3838
return { slug, name: extensionCopy()[slug].name }
3939
}
40-
const markdown = useMarkdown(path(), (_, pages) => pages.extensionMarkdown(props.slug)())
40+
const markdown = useMarkdown(path(), (context, pages) => pages.extensionMarkdown(props.slug)(context))
4141
const command = () => data().install.command
4242

4343
onMount(() => {
@@ -158,7 +158,7 @@ export function ExtensionPage(props: { slug: ExtensionSlug; path?: string }) {
158158

159159
<ExtensionDownload lead={extension().install} command={command()} />
160160

161-
<MoreFromAnomaly slot="more-from-anomaly" />
161+
<MoreFromAnomaly slot="more-from-anomaly" exclude={props.slug} />
162162
</Site>
163163
)
164164
}

0 commit comments

Comments
 (0)