Skip to content

Commit d10618f

Browse files
committed
Combine sponsors and companies.
1 parent b1a7c94 commit d10618f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+154
-64
lines changed

src/components/CompanyCard.astro

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
import { type CollectionEntry, getEntry } from "astro:content";
3-
import { marked } from 'marked';
3+
import { Image } from "astro:assets";
4+
import { companyLogos } from "@data/companyLogos";
45
56
67
const { company } = Astro.props;
7-
const { title, logo, website, location, industry, description, socials } = company.data;
8+
const { name: title, url:website, location, industry, description, socials, logo_padding=false } = company.data;
89
910
const jobFiles = import.meta.glob('../content/companies/*/!(index).md');
1011
const companiesJobsMap = {};
@@ -18,26 +19,31 @@ for (const path in jobFiles) {
1819
}
1920
}
2021
21-
const jobs = companiesJobsMap[company.id];
22+
const jobs: CollectionEntry<"jobs"> = companiesJobsMap[company.id];
2223
2324
const isCompanyPage = Astro.url.pathname == `/company/${company.id}`;
2425
25-
const html = marked.parse(company.body);
26+
const logo = companyLogos[company.id];
27+
28+
const link = description ? `/company/${company.id}` : website;
2629
2730
---
2831

2932
<div class="lg:max-w-[400px] flex flex-col gap-6 p-6 rounded-lg shadow-md bg-white text-black">
3033
<div class="w-full flex justify-center items-center md:items-center ">
31-
<img src={logo} alt={title + " Logo"} class="max-h-[200px] object-contain" />
34+
{logo && (
35+
<a href={link}>
36+
<Image
37+
src={logo}
38+
alt={`${title} Logo`}
39+
style={{ minWidth: "250px", maxHeight: "120px", objectFit: "contain", padding: logo_padding ? logo_padding : undefined, }}
40+
/>
41+
</a>
42+
)}
3243
</div>
44+
{ description &&
3345
<div class="flex-1">
34-
<h2 class="text-2xl font-bold mb-2">
35-
{ isCompanyPage ?
36-
<>{title}</> :
37-
<a href={`/company/${company.id}`}>{title}</a>
38-
}
39-
</h2>
40-
<p class="text-gray-600 mb-2">{industry}{location}</p>
46+
<p class="text-gray-600 mb-2">{industry} {industry && location && <>—</>} {location}</p>
4147
<p class="mb-4">{description}</p>
4248

4349
<div class="flex space-x-4 mb-4">
@@ -58,7 +64,8 @@ const html = marked.parse(company.body);
5864
</div>
5965
)}
6066

61-
{ !isCompanyPage && <a class="btn btn-primary mt-6 inline-block" href={`/company/${company.id}`}>Who We Are</a>}
67+
{ !isCompanyPage && company.body && <a class="btn btn-primary mt-6 inline-block" href={`/company/${company.id}`}>Who We Are</a>}
6268
</div>
69+
}
6370

6471
</div>

src/components/CompanyCardBody.astro

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
---
2-
import { type CollectionEntry, getEntry } from "astro:content";
3-
import { marked } from 'marked';
4-
5-
6-
const { company, full=false, openings=false } = Astro.props;
7-
const { title, logo, website, location, industry, description, socials } = company.data;
82
9-
const jobFiles = import.meta.glob('../content/companies/*/!(index).md');
10-
const jobs: CollectionEntry<'jobs'>[] = [];
11-
12-
for (const path in jobFiles) {
13-
const match = path.match(/\.\.\/content\/companies\/([^/]+)\/([^/]+)\.md$/);
14-
if (match) {
15-
const companyId = company.id;
16-
const entry = await getEntry('jobs', `${companyId}/${match[2]}`);
17-
if (entry) {
18-
jobs.push(entry);
19-
}
20-
}
21-
}
22-
23-
const html = marked.parse(company.body);
3+
import { marked } from 'marked';
4+
const { company } = Astro.props;
5+
const html = company.body ? marked.parse(company.body) : "";
246
257
---
268

src/components/sponsors/sponsor-tier.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { getCollection } from "astro:content";
33
import { Image } from "astro:assets";
44
5-
type Sponsor = Awaited<ReturnType<typeof getCollection<"sponsors">>>[0];
5+
type Sponsor = Awaited<ReturnType<typeof getCollection<"companies">>>[0];
66
77
export interface Props {
88
tier: {
@@ -13,6 +13,9 @@ export interface Props {
1313
top?: boolean;
1414
}
1515
16+
17+
import { companyLogos } from "@data/companyLogos";
18+
1619
const { tier, top } = Astro.props;
1720
---
1821

@@ -42,7 +45,7 @@ const { tier, top } = Astro.props;
4245
class="pb-8"
4346
>
4447
<Image
45-
src={sponsor.data.image}
48+
src={companyLogos[sponsor.id]}
4649
alt={sponsor.data.name}
4750
width={500}
4851
class="max-w-[250px] max-h-[120px]"

src/components/sponsors/sponsors.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const tiers = [
2323
"Partners"
2424
] as const;
2525
26-
const sponsors = await getCollection("sponsors");
26+
const sponsors = await getCollection("companies");
2727
2828
let hasSponsors = false;
2929
File renamed without changes.
Lines changed: 3 additions & 1 deletion

src/content/companies/acme-corp/index.md

Lines changed: 2 additions & 3 deletions
File renamed without changes.

src/content/companies/acme-corp2/index.md

Lines changed: 2 additions & 3 deletions
File renamed without changes.

0 commit comments

Comments
 (0)