Skip to content

Commit 572f36c

Browse files
docs: add github and npm link
1 parent bb09e97 commit 572f36c

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

docs/astro.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ export default defineConfig({
319319
SiteTitle: './src/components/Title.astro',
320320
PageTitle: './src/components/PageTitle.astro',
321321
SocialIcons: './src/components/SocialIcons.astro',
322+
Sidebar: './src/components/Sidebar.astro',
323+
MobileMenuFooter: './src/components/MobileFooter.astro',
322324
},
323325
// defaultLocale: 'root',
324326
locales: {
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
import { Icon } from '@astrojs/starlight/components';
3+
import LanguageSelect from '@astrojs/starlight/components/LanguageSelect.astro';
4+
import SocialIcons from '@astrojs/starlight/components/SocialIcons.astro';
5+
import ThemeSelect from '@astrojs/starlight/components/ThemeSelect.astro';
6+
import { ParseStatus } from 'astro:schema';
7+
8+
const additionalLinks = [
9+
{
10+
label: 'View on GitHub',
11+
href: 'https://github.com/openai/openai-agents-js',
12+
icon: 'github' as const,
13+
},
14+
{
15+
label: 'View on npm',
16+
href: 'https://www.npmjs.com/package/@openai/agents',
17+
icon: 'npm' as const,
18+
},
19+
];
20+
---
21+
22+
<div class="mobile-preferences sl-flex">
23+
<div class="social-icons">
24+
<SocialIcons />
25+
{
26+
additionalLinks.map(({ label, href, icon }) => (
27+
<a {href} target="_blank" rel="noopener noreferrer" class="sl-flex">
28+
<Icon name={icon as any} />
29+
<span>{label}</span>
30+
</a>
31+
))
32+
}
33+
</div>
34+
<ThemeSelect />
35+
<LanguageSelect />
36+
</div>
37+
38+
<style>
39+
@layer starlight.core {
40+
.social-icons {
41+
display: flex;
42+
margin-inline-end: auto;
43+
gap: 1rem;
44+
align-items: center;
45+
padding-block: 1rem;
46+
}
47+
.social-icons:empty {
48+
display: none;
49+
}
50+
.mobile-preferences {
51+
justify-content: space-between;
52+
flex-wrap: wrap;
53+
border-top: 1px solid var(--sl-color-gray-6);
54+
column-gap: 1rem;
55+
padding: 0.5rem 0;
56+
}
57+
58+
.social-icons a {
59+
color: var(--sl-color-text-accent);
60+
padding: 0.5em;
61+
margin: -0.5em;
62+
text-decoration: none;
63+
align-items: center;
64+
65+
span {
66+
font-size: var(--sl-text-sm);
67+
margin-inline-start: 0.3rem;
68+
}
69+
70+
@media (max-width: 72rem) {
71+
span {
72+
@apply sr-only;
73+
}
74+
}
75+
}
76+
a:hover {
77+
opacity: 0.66;
78+
}
79+
}
80+
</style>

docs/src/components/Sidebar.astro

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
import { Icon } from '@astrojs/starlight/components';
3+
import Default from '@astrojs/starlight/components/Sidebar.astro';
4+
// const { sidebar } = Astro.locals.starlightRoute;
5+
---
6+
7+
<Default />
8+
9+
<div class="openai-github-link sl-hidden md:sl-flex flex-col gap-5">
10+
<a
11+
href="https://github.com/openai/openai-agents-js"
12+
target="_blank"
13+
rel="noopener noreferrer"
14+
>
15+
<Icon name="github" />
16+
<span>View on GitHub</span>
17+
</a>
18+
<a
19+
href="https://www.npmjs.com/package/@openai/agents"
20+
target="_blank"
21+
rel="noopener noreferrer"
22+
>
23+
<Icon name="npm" />
24+
<span>View on npm</span>
25+
</a>
26+
</div>

docs/src/styles/global.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,26 @@
536536
}
537537
}
538538

539+
.openai-github-link {
540+
margin-top: 1rem;
541+
--sl-sidebar-item-padding-inline: 0.5rem;
542+
543+
a {
544+
display: flex;
545+
align-items: center;
546+
color: var(--openai-text-primary);
547+
text-decoration: none;
548+
margin-inline-start: var(--sl-sidebar-item-padding-inline);
549+
margin-bottom: var(--sl-sidebar-item-padding-inline);
550+
font-size: var(--sl-text-lg);
551+
552+
span {
553+
font-size: var(--sl-text-sm);
554+
margin-inline-start: var(--sl-sidebar-item-padding-inline);
555+
}
556+
}
557+
}
558+
539559
.sl-markdown-content .expressive-code {
540560
.frame.has-title:not(.is-terminal) .header {
541561
background: none;

0 commit comments

Comments
 (0)