Skip to content

Commit d33677a

Browse files
committed
fetch logos from notion
1 parent c2dc5bf commit d33677a

File tree

8 files changed

+515
-43
lines changed

8 files changed

+515
-43
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ pnpm-debug.log*
2222

2323
# jetbrains setting folder
2424
.idea/
25+
26+
public/assets/logos/

package-lock.json

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "module",
44
"version": "0.0.1",
55
"scripts": {
6-
"dev": "astro dev",
7-
"build": "astro build",
6+
"dev": "node src/lib/fetch-logos.mjs && astro dev",
7+
"build": "node src/lib/fetch-logos.mjs && astro build",
88
"preview": "astro preview",
99
"astro": "astro"
1010
},
@@ -71,6 +71,7 @@
7171
},
7272
"devDependencies": {
7373
"@astrojs/sitemap": "^3.6.0",
74+
"dotenv": "^17.2.3",
7475
"prettier-plugin-astro": "^0.14.1",
7576
"tw-animate-css": "^1.3.8"
7677
}

src/components/logo.astro

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
---
2-
import { Client } from '@notionhq/client';
3-
import {
4-
getSecret
5-
} from 'astro:env/server'
6-
const databaseId = getSecret('NOTION_MEMBERS_DATABASE_ID');
7-
const apiKey = getSecret('NOTION_TOKEN');
8-
console.log(databaseId, apiKey);
9-
if (databaseId && apiKey) {
10-
const notion = new Client({
11-
auth: apiKey,
12-
})
13-
try {
14-
const data = await notion.dataSources.query({
15-
data_source_id: databaseId,
16-
});
17-
console.log("[Notion] Members DB query result:", data);
18-
} catch (error) {
19-
console.error("[Notion] Query failed", error);
20-
}
21-
} else {
22-
console.warn("[Notion] Missing NOTION_MEMBERS_DATABASE_ID or API key env var");
2+
interface Logo {
3+
name: string;
4+
logo: string;
5+
website: string;
236
}
7+
8+
const logos: Logo[] = (await import("../data/logos.json")).default;
249
---
2510

2611
<section class="pb-12 md:pb-16 lg:pb-20">
@@ -37,25 +22,43 @@ if (databaseId && apiKey) {
3722
class="absolute top-0 right-0 bottom-0 z-10 w-20 bg-gradient-to-l from-accent-lightest-2 to-transparent"
3823
>
3924
</div>
40-
<div class="flex shrink-0 animate-marquee items-center">
41-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo1.svg" />
42-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo2.svg" />
43-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo3.svg" />
44-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo4.svg" />
45-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo5.svg" />
46-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo6.svg" />
47-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo7.svg" />
48-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo8.svg" />
25+
<div class="flex shrink-0 animate-marquee items-center gap-12">
26+
{
27+
logos.map((logo) => (
28+
<a
29+
href={`//${logo.website.replace(/^https?:\/\//, '').replace(/^www\./, '')}`}
30+
target="_blank"
31+
rel="noopener noreferrer"
32+
class="mx-6 flex h-12 w-32 shrink-0 items-center justify-center md:h-14 md:w-40"
33+
>
34+
<img
35+
class="max-h-full max-w-full object-contain"
36+
src={logo.logo}
37+
alt={logo.name}
38+
loading="lazy"
39+
/>
40+
</a>
41+
))
42+
}
4943
</div>
50-
<div class="flex shrink-0 animate-marquee items-center">
51-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo1.svg" />
52-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo2.svg" />
53-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo3.svg" />
54-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo4.svg" />
55-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo5.svg" />
56-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo6.svg" />
57-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo7.svg" />
58-
<img class="mx-6 max-h-12 shrink-0 md:max-h-14" src="/assets/logo8.svg" />
44+
<div class="flex shrink-0 animate-marquee items-center gap-12">
45+
{
46+
logos.map((logo) => (
47+
<a
48+
href={`//${logo.website.replace(/^https?:\/\//, '').replace(/^www\./, '')}`}
49+
target="_blank"
50+
rel="noopener noreferrer"
51+
class="mx-6 flex h-12 w-32 shrink-0 items-center justify-center md:h-14 md:w-40"
52+
>
53+
<img
54+
class="max-h-full max-w-full object-contain"
55+
src={logo.logo}
56+
alt={logo.name}
57+
loading="lazy"
58+
/>
59+
</a>
60+
))
61+
}
5962
</div>
6063
</div>
6164
</div>

0 commit comments

Comments
 (0)