Skip to content

Commit 0fdff42

Browse files
authored
feat(site): carousel arrows, a full logo grid, and three ways to show every provider (#62398)
1 parent e1989fc commit 0fdff42

32 files changed

Lines changed: 765 additions & 30 deletions
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
/* Settings › Subscriptions style A, B and C (byos-options.tsx). Development only until one is chosen:
2+
every option renders, and the section's data-style shows one and its lead in place of the
3+
section's own. */
4+
[data-page="home"][data-site] [data-component="block"][data-section="byos"] {
5+
[data-slot="lead"] > [data-option],
6+
[data-slot="options"] > [data-option] {
7+
display: none;
8+
}
9+
10+
&:is([data-style="A rows"], [data-style="B wall"], [data-style="C names"]) [data-slot="lead"] > :not([data-option]) {
11+
display: none;
12+
}
13+
14+
&[data-style="A rows"] [data-option="A rows"],
15+
&[data-style="B wall"] [data-option="B wall"],
16+
&[data-style="C names"] [data-option="C names"] {
17+
display: revert;
18+
}
19+
20+
[data-slot="options"] {
21+
display: flex;
22+
flex-direction: column;
23+
max-width: var(--two-cards);
24+
}
25+
26+
[data-slot="options"] [data-slot="mark"] {
27+
display: inline-block;
28+
flex-shrink: 0;
29+
width: var(--mark, 16px);
30+
height: var(--mark, 16px);
31+
background: currentColor;
32+
mask: var(--logo) center / contain no-repeat;
33+
}
34+
35+
[data-slot="options"] a {
36+
color: var(--text-strong);
37+
text-decoration: underline;
38+
text-decoration-color: var(--border-strong);
39+
text-underline-offset: 0.2em;
40+
transition: text-decoration-color 150ms ease;
41+
42+
@media (hover: hover) and (pointer: fine) {
43+
&:hover {
44+
text-decoration-color: currentColor;
45+
}
46+
}
47+
}
48+
49+
/* A: a ruled list, one row per way in. The kind sits in a narrow mono column, like the split
50+
style's headings; on phones it stacks above its row. */
51+
&[data-style="A rows"] [data-slot="options"] > [data-option="A rows"] {
52+
display: flex;
53+
flex-direction: column;
54+
margin: 0;
55+
border-bottom: 1px solid var(--border);
56+
57+
> div {
58+
display: grid;
59+
grid-template-columns: 8.5rem minmax(0, 1fr);
60+
gap: 0.75rem var(--gutter);
61+
padding-block: 1.25rem;
62+
border-top: 1px solid var(--border);
63+
64+
@media (max-width: 40rem) {
65+
grid-template-columns: minmax(0, 1fr);
66+
}
67+
}
68+
69+
dt {
70+
padding-top: 0.125rem;
71+
font-family: var(--font-mono);
72+
font-size: var(--fs-meta);
73+
letter-spacing: 0.08em;
74+
text-transform: uppercase;
75+
color: var(--text-weak);
76+
}
77+
78+
dd {
79+
display: flex;
80+
flex-direction: column;
81+
align-items: flex-start;
82+
gap: 1rem;
83+
margin: 0;
84+
}
85+
86+
ul {
87+
display: flex;
88+
flex-wrap: wrap;
89+
margin: 0;
90+
padding: 0;
91+
list-style: none;
92+
}
93+
94+
[data-slot="names"] {
95+
gap: 0.625rem 1.5rem;
96+
font-size: var(--fs-read);
97+
color: var(--text-strong);
98+
99+
li {
100+
display: flex;
101+
align-items: center;
102+
gap: 0.5rem;
103+
}
104+
}
105+
106+
[data-slot="marks"] {
107+
--mark: 20px;
108+
gap: 1rem 1.25rem;
109+
color: var(--text-weak);
110+
111+
li {
112+
display: grid;
113+
place-items: center;
114+
transition: color 150ms ease;
115+
116+
@media (hover: hover) and (pointer: fine) {
117+
&:hover {
118+
color: var(--text-strong);
119+
}
120+
}
121+
}
122+
}
123+
124+
dd > a {
125+
font-family: var(--font-mono);
126+
font-size: var(--fs-meta);
127+
}
128+
}
129+
130+
/* B: every mark in the tools grid's ruled cells, six across, then four (a multiple of twelve fills
131+
every row), and the count under it. */
132+
&[data-style="B wall"] [data-slot="options"] > [data-option="B wall"] {
133+
display: flex;
134+
flex-direction: column;
135+
gap: 1.25rem;
136+
137+
ul {
138+
--mark: 28px;
139+
display: grid;
140+
grid-template-columns: repeat(6, minmax(0, 1fr));
141+
margin: 0;
142+
padding: 0;
143+
list-style: none;
144+
border-top: 1px solid var(--border);
145+
border-inline-start: 1px solid var(--border);
146+
147+
@media (max-width: 60rem) {
148+
grid-template-columns: repeat(4, minmax(0, 1fr));
149+
}
150+
151+
@media (max-width: 40rem) {
152+
--mark: 24px;
153+
}
154+
}
155+
156+
li {
157+
display: grid;
158+
place-items: center;
159+
height: 4.5rem;
160+
161+
@media (max-width: 40rem) {
162+
height: 4rem;
163+
}
164+
border-inline-end: 1px solid var(--border);
165+
border-bottom: 1px solid var(--border);
166+
color: var(--text);
167+
transition: color 150ms ease;
168+
169+
@media (hover: hover) and (pointer: fine) {
170+
&:hover {
171+
color: var(--text-strong);
172+
}
173+
}
174+
}
175+
176+
p {
177+
margin: 0;
178+
font-family: var(--font-mono);
179+
font-size: var(--fs-meta);
180+
color: var(--text-weak);
181+
}
182+
}
183+
184+
/* C: the names as one wrapping run of text, subscriptions in ink and the rest muted, each mark the
185+
height of its name. */
186+
&[data-style="C names"] [data-slot="options"] > [data-option="C names"] {
187+
--mark: 1em;
188+
display: flex;
189+
flex-wrap: wrap;
190+
gap: 0.5rem 1.375rem;
191+
margin: 0;
192+
padding: 0;
193+
list-style: none;
194+
font-size: var(--fs-lead);
195+
line-height: 1.5;
196+
color: var(--text-weak);
197+
198+
@media (max-width: 40rem) {
199+
gap: 0.375rem 1rem;
200+
font-size: var(--fs-read);
201+
}
202+
203+
li {
204+
display: inline-flex;
205+
align-items: center;
206+
gap: 0.4em;
207+
white-space: nowrap;
208+
}
209+
210+
[data-kind="subscription"] {
211+
color: var(--text-strong);
212+
}
213+
}
214+
}
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
import "./byos-options.css"
2+
import { For, Show } from "solid-js"
3+
import { useI18n } from "~/context/i18n"
4+
import { rich } from "~/i18n/rich"
5+
import { byos } from "~/lib/byos"
6+
import { byosOptions } from "~/lib/byos-options"
7+
import { docsUrl } from "~/lib/docs"
8+
import { linkPhrases } from "~/lib/home-content"
9+
import { providerLogo, providerMarks } from "~/lib/providers"
10+
import { Rich } from "./rich-text"
11+
12+
/**
13+
* Settings › Subscriptions style A, B and C in "Bring your own subs" (lib/byos-options.ts): ways
14+
* to show that OpenCode works with nearly every subscription, provider and model. Like the section's
15+
* other styles, every option renders in development and the section's data-style shows one
16+
* (byos-options.css); production renders none while the default is "grid" (script/fold-settings.ts).
17+
*/
18+
19+
// The providers with a mark (lib/providers.ts), never Anthropic's.
20+
const marks = providerMarks.filter((provider) => provider.id !== "anthropic")
21+
// Marks the subscriptions and local rows already show.
22+
const shown = new Set(["github-copilot", "gitlab", "ollama", "lmstudio"])
23+
const providers = marks.filter((provider) => !shown.has(provider.id))
24+
25+
/** Each option's lead, in place of the section's own (inside its lead paragraph). */
26+
export function ByosOptionLeads() {
27+
const link = (text: string) => (
28+
<Rich
29+
value={linkPhrases(
30+
text,
31+
byos.planLinks.map((phrase) => ({ text: phrase, href: byos.plansHref })),
32+
)}
33+
/>
34+
)
35+
return (
36+
<>
37+
<span data-option="A rows">{link(byosOptions.leads.rows)}</span>
38+
<span data-option="B wall">{link(byosOptions.leads.wall)}</span>
39+
<span data-option="C names">{link(byosOptions.leads.names)}</span>
40+
</>
41+
)
42+
}
43+
44+
export function ByosOptions() {
45+
const i18n = useI18n()
46+
const providersLink = docsUrl("/providers/")
47+
return (
48+
<div data-slot="options">
49+
{/* A: a ruled row for each way in, its kind in the first column. */}
50+
<dl data-option="A rows">
51+
<div>
52+
<dt>{byosOptions.rows.subscriptions}</dt>
53+
<dd>
54+
<ul data-slot="names">
55+
<For each={byosOptions.subscriptions}>
56+
{(item) => (
57+
<li>
58+
<Mark logo={item.logo} />
59+
{item.name}
60+
</li>
61+
)}
62+
</For>
63+
</ul>
64+
</dd>
65+
</div>
66+
<div>
67+
<dt>{byosOptions.rows.providers}</dt>
68+
<dd>
69+
<ul data-slot="marks">
70+
<For each={providers}>
71+
{(provider) => (
72+
<li data-tip={provider.name}>
73+
<Mark logo={providerLogo(provider.id)} name={provider.name} />
74+
</li>
75+
)}
76+
</For>
77+
</ul>
78+
<a href={providersLink}>{byosOptions.rows.providersMore}</a>
79+
</dd>
80+
</div>
81+
<div>
82+
<dt>{byosOptions.rows.local}</dt>
83+
<dd>
84+
<ul data-slot="names">
85+
<For each={byosOptions.local}>
86+
{(item) => (
87+
<li>
88+
<Show when={"logo" in item && item.logo}>{(logo) => <Mark logo={logo()} />}</Show>
89+
{item.name}
90+
</li>
91+
)}
92+
</For>
93+
</ul>
94+
</dd>
95+
</div>
96+
<div>
97+
<dt>{byosOptions.rows.opencode}</dt>
98+
<dd>
99+
<ul data-slot="names">
100+
<For each={byosOptions.opencode}>
101+
{(item) => (
102+
<li>
103+
<a href={item.href}>{item.name}</a>
104+
</li>
105+
)}
106+
</For>
107+
</ul>
108+
</dd>
109+
</div>
110+
</dl>
111+
112+
{/* B: every provider's mark in the tools grid's ruled cells, in whole rows of six or four (a
113+
multiple of 12), then the count. */}
114+
<div data-option="B wall">
115+
<ul aria-label={i18n.t("home.providers.aria")}>
116+
<For each={marks.slice(0, marks.length - (marks.length % 12))}>
117+
{(provider) => (
118+
<li data-tip={provider.name}>
119+
<Mark logo={providerLogo(provider.id)} name={provider.name} />
120+
</li>
121+
)}
122+
</For>
123+
</ul>
124+
<p>
125+
<Rich
126+
value={rich(i18n.t("home.providers.grid"), {
127+
modelsdev: "https://models.dev",
128+
providers: providersLink,
129+
})}
130+
/>
131+
</p>
132+
</div>
133+
134+
{/* C: the names as one wrapping run, the subscriptions in ink, each with its mark. */}
135+
<ul data-option="C names" aria-label={i18n.t("home.providers.aria")}>
136+
<For each={byosOptions.subscriptions}>
137+
{(item) => (
138+
<li data-kind="subscription">
139+
<Mark logo={item.logo} />
140+
{item.name}
141+
</li>
142+
)}
143+
</For>
144+
<For
145+
each={[
146+
...providers.map((provider) => ({ ...provider, logo: providerLogo(provider.id) })),
147+
...byosOptions.local,
148+
]}
149+
>
150+
{(item) => (
151+
<li>
152+
<Show when={"logo" in item && item.logo}>{(logo) => <Mark logo={logo()} />}</Show>
153+
{item.name}
154+
</li>
155+
)}
156+
</For>
157+
<li>
158+
<a href={providersLink}>{byosOptions.all}</a>
159+
</li>
160+
</ul>
161+
</div>
162+
)
163+
}
164+
165+
/** A provider's mark in the text colour; named only where no text beside it says the name. */
166+
function Mark(props: { logo: string; name?: string }) {
167+
return (
168+
<span
169+
data-slot="mark"
170+
role={props.name ? "img" : undefined}
171+
aria-label={props.name}
172+
aria-hidden={props.name ? undefined : "true"}
173+
style={{ "--logo": `url(${props.logo})` }}
174+
/>
175+
)
176+
}

0 commit comments

Comments
 (0)