Skip to content

Display sponsors in categories #1466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 2, 2017
Merged
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
16 changes: 13 additions & 3 deletions components/splash/splash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ export default props => {

<p>Through contributions, donations, and sponsorship, you allow webpack to thrive. Your donations directly support office hours, continued enhancements, and most importantly, great documentation and learning material!</p>

<h2>Sponsors</h2>
<Support number={ 100 } type="sponsors" />
<h2>Platinum Sponsors</h2>
<Support type="sponsors" rank="platinum" />

<h2>Gold Sponsors</h2>
<Support type="sponsors" rank="gold" />

<h2>Silver Sponsors</h2>
<Support type="sponsors" rank="silver" />

<h2>Bronze Sponsors</h2>
<Support type="sponsors" rank="bronze" />

<h2>Backers</h2>
<Support number={ 130 } type="backers" />
<Support type="backers" />

</Container>
</div>
</div>
Expand Down
31 changes: 21 additions & 10 deletions components/support/support-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,40 @@

&__item {
position: relative;
margin: 0 5px 5px 5px;
margin: 0 2px 2px 2px;
}

&__sponsors-avatar {
height: 64px;
&-bronze, &-normal {
height: 32px;
}
&-silver {
height: 64px;
}
&-gold {
height: 96px;
}
&-platinum {
height: 128px;
}
}

&__backers-avatar {
width: 62px;
height: 62px;
&__backers-avatar-normal {
width: 31px;
height: 31px;
border-radius: 50%;
border: 2px solid white;
border: 1px solid white;
overflow: hidden;
}

&__outline {
position: absolute;
top: 0;
margin: -2px;
width: calc(100% + 4px);
height: calc(100% - 2px);
margin: -1px;
width: calc(100% + 2px);
height: calc(100% - 4px);
border-radius: 50%;
border: 2px solid rgb(112, 202, 10);
border: 1px solid rgb(112, 202, 10);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just gauging from the screenshot, it seems some of these style changes might have caused the normal backers display to be thrown off. I'll check locally as well but is there a reason you changed the "normal" backers style? They look pretty good to me as is in Chrome.

Copy link
Collaborator

Choose a reason for hiding this comment

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

By the way -- this is what I mean re the backer design:

image

There's some noticeable extra whitespace at the bottom of each backer that makes things look a bit off.

Copy link
Member Author

Choose a reason for hiding this comment

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

The screenshot is on 50% browser zoom. On 100% it's looks normal.

I reduced the size of the backers by 50% to match the size of the bronze sponsors.

Copy link
Collaborator

@skipjack skipjack Aug 1, 2017

Choose a reason for hiding this comment

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

👍 I'll just double check this locally then when testing to make sure everything looks ok.

}

&__bottom {
Expand Down
39 changes: 36 additions & 3 deletions components/support/support.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,60 @@ import React from 'react';
import Additional from './support-additional.json';
import './support-style';

const ranks = {
bronze: {
maximum: 2000
},
silver: {
minimum: 2000,
maximum: 10000
},
gold: {
minimum: 10000,
maximum: 50000
},
platinum: {
minimum: 50000
}
};

export default class Support extends React.Component {
render() {
let { number, type } = this.props;
let { rank, type } = this.props;
let supporters = require(`./support-${type}.json`);

if (type === 'sponsors') {
supporters = supporters.slice();
supporters.push(...Additional);
supporters.sort((a, b) => b.totalDonations - a.totalDonations);
}

let minimum, maximum;

if (rank && ranks[rank]) {
minimum = ranks[rank].minimum;
maximum = ranks[rank].maximum;
}

if (typeof minimum === 'number') {
supporters = supporters.filter(item => item.totalDonations >= minimum * 100);
}

if (typeof maximum === 'number') {
supporters = supporters.filter(item => item.totalDonations < maximum * 100);
}

return (
<div className="support">
{
supporters.slice(0, number).map((supporter, index) => (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just want to make sure this is intentional -- we don't want to limit the backers or supporters displayed at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep it was intentional.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

supporters.map((supporter, index) => (
<a key={ supporter.id || supporter.username || index }
className="support__item"
title={ `$${supporter.totalDonations / 100} by ${supporter.name || supporter.username}` }
target="_blank"
href={ supporter.website || `https://opencollective.com/${supporter.username}` }>
{ supporter.avatar ? <img
className={ `support__${type}-avatar` }
className={ `support__${type}-avatar-${rank || 'normal'}` }
src={ supporter.avatar }
alt={ supporter.username ? `${supporter.username}'s avatar` : 'avatar' } /> :
supporter.name }
Expand Down
9 changes: 7 additions & 2 deletions scripts/check-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ function checkLinks(args) {
var name = null;

tap.on('complete', function(res) {
const failures = res.failures.filter(failure => !failure.diag || !failure.diag.at ||
!failure.diag.at.match(/class="(support__item|support__backers-avatar|support__sponsors-avatar)"/));
const failures = res.failures.filter(failure => {
return (
!failure.diag ||
!failure.diag.at ||
!failure.diag.at.match(/class="support__[^"]*"/)
);
});

if (failures.length > 0) {
console.log(formatFailures(failures));
Expand Down