Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ node_modules
out
*.generated.*
/.cache
/pages/api
/pages/loaders
/pages/plugins
/pages/docs/api
/pages/docs/loaders
/pages/docs/plugins
/generated
/pages/about/governance
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ node_modules
out
*.generated.*
/.cache
/pages/api
/pages/docs/api
/pages/docs/loaders
/pages/docs/plugins
versions.json
/generated
4 changes: 3 additions & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ node_modules
out
*.generated.*
/.cache
/pages/api
/pages/docs/api
/pages/docs/loaders
/pages/docs/plugins
versions.json
/generated
62 changes: 62 additions & 0 deletions components/MetaBar/index.jsx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Become a Sponsor button

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import MetaBar from '@node-core/ui-components/Containers/MetaBar';
import AvatarGroup from '@node-core/ui-components/Common/AvatarGroup';
import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub';

import { editURL } from '#theme/config';
import sponsors from '#theme/sponsors' with { type: 'json' };
import SponsorCard from '../Sponsors/Card/index.jsx';

// Active recurring platinum-tier sponsors, ranked by monthly amount. There are
// only ever a handful, so the MetaBar features them as full expanded cards.
const platinumSponsors = sponsors.sponsors
.filter(sponsor => sponsor.monthly.tier === 'platinum')
.sort((a, b) => b.monthly.value - a.monthly.value);

export default ({ metadata, headings = [], readingTime }) => {
const editThisPage =
metadata.source ?? editURL.replace('{path}', metadata.path);
const authors = metadata.authors?.split(',').map(id => ({
image: `https://avatars.githubusercontent.com/${id.trim()}`,
url: `https://github.com/${id.trim()}`,
nickname: id,
}));

return (
<MetaBar
heading="Table of Contents"
headings={{ items: headings }}
items={{
'Reading Time': readingTime,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not use spreading please 🙇

Simply make a Map (or Record) and add items based on the criteria/validation, and then simply pass the record to items={{}}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spreading is what we use elsewhere, for instance, innodejs/learn

...(CLIENT && authors?.length
? {
Authors: <AvatarGroup avatars={authors} as="a" limit={5} />,
}
: {}),
Contribute: (
<>
<GitHubIcon className="fill-neutral-700 dark:fill-neutral-100" />
<a href={editThisPage}>Edit this page</a>
</>
),
...(platinumSponsors.length
? {
[platinumSponsors.length > 1
? 'Featured Sponsors'
: 'Featured Sponsor']: (
<div className="flex w-full flex-col gap-3">
{platinumSponsors.map(sponsor => (
<SponsorCard
key={sponsor.slug}
sponsor={sponsor}
size="sm"
showAmount={false}
/>
))}
</div>
),
}
: {}),
}}
/>
);
};
32 changes: 17 additions & 15 deletions components/SideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@ const redirect = url => (window.location.href = url);

const PrefetchLink = props => <a {...props} rel="prefetch" />;

const pathnameFor = path => path.replace(/\/index$/, '') || '/';
const pathnameFor = path => {
const clean = path.replace(/\/index$/, '');
if (!clean) return '/';
return clean.startsWith('/') ? clean : `/${clean}`;
};

const groupsFor = path => {
if (Array.isArray(sidebar)) return sidebar;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consistently use {} or not, I recall on nodejs.org we do that, unsure if we should also keep same consistency over here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't, at the moment


const segment = path.split('/').filter(Boolean)[0];
const matched = sidebar.filter(g => g.groupName.toLowerCase() === segment);
return matched.length > 0 ? matched : sidebar;
return sidebar[segment] ?? [];
};

/**
* Sidebar component for MDX documentation with page navigation.
*/
export default ({ metadata }) => {
const path = pathnameFor(metadata.path);
return (
<SideBar
pathname={path}
groups={groupsFor(path)}
onSelect={redirect}
as={PrefetchLink}
title="Navigation"
/>
);
};
export default ({ metadata }) => (
<SideBar
pathname={pathnameFor(metadata.path)}
groups={groupsFor(metadata.path)}
onSelect={redirect}
as={PrefetchLink}
title="Navigation"
/>
);
10 changes: 8 additions & 2 deletions components/Sponsors/Card/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ const amountLabel = (sponsor, metric) =>
* sponsor: { name: string, slug: string, imageUrl: string|null, url: string, monthly: { value: number, tier: string|null }, allTime: { value: number, tier: string|null }, description?: string },
* size?: 'lg'|'md'|'sm'|'xs',
* metric?: 'monthly'|'allTime',
* showAmount?: boolean,
* }} props
*/
export default function SponsorCard({
sponsor,
size = 'md',
metric = 'monthly',
showAmount = true,
className,
...props
}) {
Expand Down Expand Up @@ -53,7 +55,11 @@ export default function SponsorCard({
<p className={styles.description}>{sponsor.description}</p>
)}
<div className={styles.footer}>
<span className={styles.amount}>{amountLabel(sponsor, metric)}</span>
{showAmount && (
<span className={styles.amount}>
{amountLabel(sponsor, metric)}
</span>
)}
<span className={styles.visit}>Visit &rarr;</span>
</div>
</a>
Expand All @@ -72,7 +78,7 @@ export default function SponsorCard({
</div>
<span className={styles.body}>
<span className={styles.name}>{sponsor.name}</span>
{size !== 'xs' && (
{size !== 'xs' && showAmount && (
<span className={styles.amount}>{amountLabel(sponsor, metric)}</span>
)}
</span>
Expand Down
3 changes: 2 additions & 1 deletion components/Sponsors/Card/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
border
border-neutral-200
bg-white
no-underline
no-underline!
transition-colors
duration-150
hover:border-blue-300
Expand Down Expand Up @@ -96,6 +96,7 @@
@apply ml-auto
text-xl
leading-none
font-normal
text-neutral-300
dark:text-neutral-600;
}
10 changes: 9 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ export default [
},
},
{
ignores: ['node_modules/', 'out/', '.cache/', 'webpack/', 'pages/api'],
ignores: [
'node_modules/',
'out/',
'.cache/',
'webpack/',
'pages/docs/api',
'pages/docs/loaders',
'pages/docs/plugins',
],
},
];
97 changes: 52 additions & 45 deletions layouts/Sponsors/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BaseButton from '@node-core/ui-components/Common/BaseButton';

import NavBar from '../../components/NavBar.jsx';
import Footer from '../../components/Footer/index.jsx';
import SideBar from '../../components/SideBar.jsx';
import SectionHeader from '../../components/SectionHeader/index.jsx';
import SponsorTier from '../../components/Sponsors/Tier/index.jsx';
import BackerWall from '../../components/Sponsors/BackerWall/index.jsx';
Expand Down Expand Up @@ -73,54 +74,60 @@ export default function SponsorsLayout({ metadata }) {
<>
<NavBar metadata={metadata} />

<main className={styles.page}>
<section className={styles.sponsorsSection}>
<div className={styles.container}>
<SectionHeader
eyebrow="Our sponsors"
title="The organizations behind webpack"
/>
<div className={styles.actions}>
<BaseButton
href={OC_URL}
target="_blank"
rel="noreferrer noopener"
kind="primary"
>
View on Open Collective
</BaseButton>
</div>
<div className={styles.toolbar}>
<SortToggle value={metric} onChange={setMetric} />
</div>
<div className={styles.tiers}>
{TIERS.map(tier => (
<SponsorTier
key={tier.tier}
tier={tier.tier}
label={tier.label}
price={tier.price[metric]}
cardSize={tier.cardSize}
sponsors={buckets[tier.tier]}
metric={metric}
/>
))}
<div className={styles.shell}>
<aside className={styles.sidebar}>
<SideBar metadata={metadata} />
</aside>

<main className={styles.page}>
<section className={styles.sponsorsSection}>
<div className={styles.container}>
<SectionHeader
eyebrow="Our sponsors"
title="The organizations supporting webpack"
/>
<div className={styles.actions}>
<BaseButton
href={OC_URL}
target="_blank"
rel="noreferrer noopener"
kind="primary"
>
View on Open Collective
</BaseButton>
</div>
<div className={styles.toolbar}>
<SortToggle value={metric} onChange={setMetric} />
</div>
<div className={styles.tiers}>
{TIERS.map(tier => (
<SponsorTier
key={tier.tier}
tier={tier.tier}
label={tier.label}
price={tier.price[metric]}
cardSize={tier.cardSize}
sponsors={buckets[tier.tier]}
metric={metric}
Comment on lines +104 to +111

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of showing the amount they're contributing, could we sort them by contribution amount from highest to lowest, or even display them randomly? I do think we shouldn't show the contribution amount in that sidebar section.

/>
))}
</div>
</div>
</div>
</section>
</section>

<section className={styles.backersSection}>
<div className={styles.container}>
<SectionHeader
eyebrow="Our backers"
title="And the people who chip in"
/>
<div className={styles.backersBody}>
<BackerWall backers={data.backers} />
<section className={styles.backersSection}>
<div className={styles.container}>
<SectionHeader
eyebrow="Our backers"
title="And the people who chip in"
/>
<div className={styles.backersBody}>
<BackerWall backers={data.backers} />
</div>
</div>
</div>
</section>
</main>
</section>
</main>
</div>

<Footer />
</>
Expand Down
18 changes: 17 additions & 1 deletion layouts/Sponsors/index.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
@reference "../../styles/index.css";

.shell {
@apply block
w-full
min-[896px]:grid
min-[896px]:grid-cols-[--spacing(56)_1fr];
}

.sidebar {
@apply min-[896px]:sticky
min-[896px]:top-0
min-[896px]:grid
min-[896px]:h-svh
min-[896px]:overflow-y-auto;
}

.page {
@apply bg-white
@apply min-w-0
bg-white
text-neutral-900
dark:bg-neutral-950
dark:text-white;
Expand Down
4 changes: 4 additions & 0 deletions pages/about/branding.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
authors: avivkeller
---

# Branding of webpack

Here you can find **webpack** project brand guidelines and assets. Official artwork is maintained in the OpenJS Foundation [artwork repository](https://github.com/openjs-foundation/artwork/tree/main/projects/webpack).
Expand Down
3 changes: 3 additions & 0 deletions pages/about/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# About webpack

STUB
3 changes: 3 additions & 0 deletions pages/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Documentation

STUB
Loading