Skip to content

Commit f3a634e

Browse files
authored
Add Zuplo sponsorship banner (#1692)
* Add Zuplo sponsorship banner * Sponsor updates
1 parent e77ce50 commit f3a634e

File tree

6 files changed

+951
-182
lines changed

6 files changed

+951
-182
lines changed
+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<script setup>
2+
import DefaultTheme from "vitepress/theme";
3+
4+
const { Layout } = DefaultTheme;
5+
</script>
6+
7+
<template>
8+
<Layout>
9+
<template #layout-top
10+
><a
11+
class="banner"
12+
href="https://zuplo.link/openapi-ts-web"
13+
target="_blank"
14+
>
15+
<svg
16+
class="banner-logo"
17+
xmlns="http://www.w3.org/2000/svg"
18+
aria-role="img"
19+
aria-title="Zuplo"
20+
fill="#ff00bd"
21+
viewBox="0 0 147 33"
22+
>
23+
<path
24+
d="M27.142 19.978H16.62L27.83 8.746a.758.758 0 0 0-.534-1.293H9.488V0h19.534a7.573 7.573 0 0 1 4.065 1.125 7.591 7.591 0 0 1 2.836 3.126 7.402 7.402 0 0 1-1.461 8.398l-7.32 7.328z"
25+
></path>
26+
<path
27+
d="M9.489 11.042h10.524l-11.19 11.21a.772.772 0 0 0 .543 1.316h17.759v7.452H7.61a7.574 7.574 0 0 1-4.065-1.125A7.593 7.593 0 0 1 .71 26.768a7.403 7.403 0 0 1 1.462-8.397zm73.297 5.728c0 2.657-1.034 4.283-3.46 4.244-2.227-.04-3.38-1.666-3.38-4.283V6.696h-5.488v10.43c0 5.038 3.142 8.607 8.868 8.647 5.25.04 8.948-3.807 8.948-8.606V6.697h-5.488zm53.306-10.512c-5.925 0-10.098 4.204-10.098 9.757 0 5.552 4.175 9.756 10.098 9.756 5.923 0 10.099-4.204 10.099-9.756 0-5.553-4.173-9.757-10.099-9.757m0 14.794c-2.744 0-4.69-2.063-4.69-5.037 0-2.975 1.948-5.038 4.69-5.038 2.743 0 4.691 2.063 4.691 5.038 0 2.974-1.947 5.037-4.691 5.037M101.966 6.258c-5.926 0-10.099 4.204-10.099 9.757 0 .073.009.144.01.22h-.01v15.772h5.408V24.75a10.911 10.911 0 0 0 4.691 1.02c5.926 0 10.099-4.204 10.099-9.756 0-5.553-4.173-9.756-10.099-9.756m0 14.794c-2.744 0-4.69-2.063-4.69-5.037 0-2.975 1.948-5.038 4.69-5.038 2.742 0 4.691 2.063 4.691 5.038 0 2.974-1.947 5.037-4.691 5.037M49.868 11.41h10.814l-10.814 8.452v5.473h17.514v-4.716h-10.84l10.84-8.473V6.694H49.868zm74.501 13.925h-1.831a7.462 7.462 0 0 1-5.262-2.177 7.421 7.421 0 0 1-2.183-5.248V.005h5.518V17.91a1.927 1.927 0 0 0 1.927 1.921h1.831z"
28+
></path>
29+
</svg>
30+
<span>
31+
Sponsored by Zuplo<span class="banner-mobile"
32+
>, a managed API platform powered by OpenAPI</span
33+
>
34+
</span>
35+
<span class="banner-pseudo-link">Start Free →</span>
36+
</a></template
37+
>
38+
</Layout>
39+
</template>
40+
41+
<style scoped>
42+
.banner {
43+
--zuplo-brand: #ff00bd;
44+
45+
background-color: var(--vp-c-bg);
46+
border-bottom: 1px solid var(--vp-c-divider);
47+
color: inherit;
48+
display: flex;
49+
font-size: var(--banner-font-size);
50+
font-weight: 500;
51+
gap: var(--banner-gap);
52+
height: var(--banner-height);
53+
line-height: 1;
54+
justify-content: center;
55+
align-items: center;
56+
min-height: 1rem;
57+
padding-left: 1.5rem;
58+
padding-right: 1.5rem;
59+
position: fixed;
60+
top: 0;
61+
left: 0;
62+
width: 100%;
63+
text-decoration: none;
64+
z-index: 100;
65+
}
66+
67+
.banner-logo {
68+
line-height: 1;
69+
height: calc(0.4375 * var(--banner-height));
70+
min-height: calc(0.4375 * var(--banner-height));
71+
min-width: 3.5rem;
72+
width: auto;
73+
}
74+
75+
.banner-mobile {
76+
display: none;
77+
}
78+
79+
@media (width >= 720px) {
80+
.banner-mobile {
81+
display: inline;
82+
}
83+
}
84+
85+
.banner-pseudo-link {
86+
background-color: var(--zuplo-brand);
87+
border-radius: 0.375rem;
88+
color: #fff;
89+
display: inline-flex;
90+
font-size: 0.875em;
91+
font-weight: 600;
92+
line-height: calc(0.625 * var(--banner-height));
93+
padding: 0 0.75em;
94+
white-space: nowrap;
95+
}
96+
</style>
97+
98+
<style>
99+
:root {
100+
--banner-gap: 1.5rem;
101+
--banner-height: 2.25rem;
102+
--banner-font-size: 0.875rem;
103+
--vp-layout-top-height: var(
104+
--banner-height
105+
); /* Vitepress’ variable that allows for banners */
106+
}
107+
108+
@media (width >= 720px) {
109+
:root {
110+
--banner-gap: 2rem;
111+
}
112+
}
113+
114+
@media (width >= 1200px) {
115+
:root {
116+
--banner-gap: 2.5rem;
117+
--banner-height: 2.5rem;
118+
--banner-font-size: 1rem;
119+
}
120+
}
121+
122+
/** tighten up nav a scootch */
123+
.Layout {
124+
--vp-nav-height: 56px;
125+
}
126+
</style>

docs/.vitepress/theme/index.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import { h } from "vue";
32
import type { Theme } from "vitepress";
43
import DefaultTheme from "vitepress/theme";
4+
import CustomLayout from "./CustomLayout.vue";
55
import "./style.css";
66

77
export default {
88
extends: DefaultTheme,
9-
Layout: () => {
10-
return h(DefaultTheme.Layout, null, {
11-
// https://vitepress.dev/guide/extending-default-theme#layout-slots
12-
});
13-
},
9+
Layout: CustomLayout,
1410
enhanceApp({ app, router, siteData }) {
1511
// ...
1612
},

docs/data/contributors.json

+1-1
Large diffs are not rendered by default.

docs/scripts/update-contributors.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ export const OPENAPI_FETCH_CONTRIBUTORS = [
183183
];
184184

185185
async function main() {
186+
const total = [...OPENAPI_TS_CONTRIBUTORS, OPENAPI_FETCH_CONTRIBUTORS].length;
187+
let i = 0;
186188
await Promise.all(
187189
["openapi-typescript", "openapi-fetch"].map(async (repo) => {
188190
const userlist = repo === "openapi-fetch" ? OPENAPI_FETCH_CONTRIBUTORS : OPENAPI_TS_CONTRIBUTORS;
@@ -203,10 +205,11 @@ async function main() {
203205
lastFetch: new Date().getTime(),
204206
};
205207
upsert(contributors[repo], userData);
208+
i++;
206209
// biome-ignore lint/suspicious/noConsoleLog: this is a script
207-
console.log(`Updated old contributor data for ${username}`);
210+
console.log(`[${i}/${total}] Updated for ${username}`);
208211
fs.writeFileSync(new URL("../data/contributors.json", import.meta.url), JSON.stringify(contributors)); // update file while fetching (sync happens safely in between fetches)
209-
await new Promise((resolve) => setTimeout(resolve, 750)); // sleep to prevent 429
212+
await new Promise((resolve) => setTimeout(resolve, 900)); // sleep to prevent 429
210213
} catch (err) {
211214
throw new Error(err);
212215
}

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"version": "pnpm run build && changeset version && pnpm i"
1616
},
1717
"devDependencies": {
18-
"@biomejs/biome": "^1.7.3",
18+
"@biomejs/biome": "^1.8.1",
1919
"@changesets/changelog-github": "^0.5.0",
20-
"@changesets/cli": "^2.27.2",
20+
"@changesets/cli": "^2.27.5",
2121
"del-cli": "^5.1.0",
22-
"prettier": "^3.2.5",
22+
"prettier": "^3.3.2",
2323
"typescript": "^5.4.5"
2424
}
2525
}

0 commit comments

Comments
 (0)