-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep it was intentional. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 } | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
There's some noticeable extra whitespace at the bottom of each backer that makes things look a bit off.
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.