Skip to content

Supporters and PrismJS Lang Fixes #1168

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
Apr 29, 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
18 changes: 0 additions & 18 deletions components/support/support-additional.json

This file was deleted.

54 changes: 17 additions & 37 deletions components/support/support-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,32 @@
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 1em 0.5em;
padding:10px 5px;

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

&__sponsors-avatar {
height: 64px;
}

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

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

&__bottom {
flex: 0 0 100%;
margin-top: 1em;
flex:0 0 100%;
margin-top:10px;
}

&__button {
display: inline-block;
padding: 0.4em 1em;
text-transform: uppercase;
color: getColor(denim);
border: 1px solid getColor(denim);
border-radius: 1.25em;
transition: all 250ms;
display:inline-block;
padding:0.4em 1em;
border:2px solid getColor(denim);
color:getColor(denim);
border-radius:1.25em;
transition:all 250ms;

&:hover {
background: getColor(denim);
color: getColor(white);
background:getColor(denim);
color:getColor(white);
}
}
}
&__missing {
display: flex;
align-items: center;
}
}
99 changes: 48 additions & 51 deletions components/support/support.jsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,56 @@
import React from 'react';
import PropTypes from 'prop-types';
import Additional from './support-additional.json';
import 'whatwg-fetch';
import './support-style';

export default class Support extends React.Component {
static propTypes = {
number: PropTypes.number.isRequired,
type: PropTypes.oneOf([
'sponsors',
'backers'
]).isRequired
};

state = {
supporters: [],
error: false
const MISSING_SPONSORS = [
{
index: 33,
name: 'MoonMail',
title: 'Email Marketing Software',
logo: 'https://static.moonmail.io/moonmail-logo.svg',
url: 'https://moonmail.io/?utm_source=webpack.js.org'
},
{
index: 34,
name: 'MONEI',
title: 'Best payment gateway rates',
logo: 'https://static.monei.net/monei-logo.svg',
url: 'https://monei.net/?utm_source=webpack.js.org'
}
];

render() {
let { number, type } = this.props;
let { supporters } = this.state;

return (
<div className="support">
{
supporters.slice(0, number).map((supporter, i) => (
<a key={ supporter.id }
className="support__item"
target="_blank"
href={ supporter.website }>
<img
className={ `support__${type}-avatar` }
src={ supporter.avatar }
alt={ `${supporter.username}'s avatar` } />
{ type === 'backers' ? <figure className="support__outline" /> : null }
</a>
))
}
export default ({number, type}) => {
const supportItems = [...Array(number)].map((x, i) =>
<a key={ i }
className="support__item"
href={ `https://opencollective.com/webpack/${type}/${i}/website?requireActive=false` }
target="_blank">
<img
src={ `//opencollective.com/webpack/${type}/${i}/avatar?requireActive=false` }
alt={ `${type} avatar` } />
</a>
);

<div className="support__bottom">
<a className="support__button" href="https://opencollective.com/webpack#support">
Become a { type.replace(/s$/, '') }
</a>
</div>
</div>
);
// add missing sponsors
if (type === 'sponsor') {
MISSING_SPONSORS.forEach(sponsor => {
supportItems.splice(sponsor.index, 0, (
<a key={ sponsor.name }
className="support__item support__missing"
href={ sponsor.url }
target="_blank"
title={ sponsor.title }>
<img
src={ sponsor.logo }
height={ 45 }
alt={ sponsor.name } />
</a>
));
});
}

componentDidMount() {
let { type } = this.props;

fetch(`https://opencollective.com/webpack/${type}.json`)
.then(response => response.json())
.then(json => this.setState({ supporters: json.concat(Additional) }))
.catch(error => this.setState({ error: true }));
}
}
return (
<div className="support">
{supportItems}
</div>
);
};
4 changes: 2 additions & 2 deletions content/plugins/environment-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if ('false') { // <-- 'false' from DEBUG is taken

The third-party [`DotenvPlugin`](https://github.com/mrsteele/dotenv-webpack) (`dotenv-webpack`) allows you to expose (a subset of) [dotenv variables](https://www.npmjs.com/package/dotenv):

```conf
``` bash
// .env
DB_HOST=127.0.0.1
DB_PASS=foobar
Expand All @@ -95,4 +95,4 @@ S3_API=mysecretkey
path: './.env', // Path to .env file (this is the default)
safe: true // load .env.example (defaults to "false" which does not use dotenv-safe)
})
```
```