docusaurus/website-1.x/core/Showcase.js
leoigel fd403d3f7c
fix(v1): self-host user images (#3200)
* img-self-hosted

* name images was improved and validate self-images was included

* Showcase was overwritten

* original filename was rename

* name filename was improved

* website-1.x/core/Showcase.js and  website-1.x/data/users.js was changed

* website-1.x/core/Showcase.js

* spelling error fixed

* validate patch images put at to level

* Update website-1.x/core/Showcase.js

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-08-08 16:26:55 +02:00

45 lines
1.1 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const PropTypes = require('prop-types');
const users = require('../data/users');
users.forEach((user) => {
if (!user.image.startsWith('/img/users')) {
throw new Error(
`User image should be self-hosted in /img/users folder. This was not the case for ${user.image}`,
);
}
});
const UserLink = ({infoLink, image, caption}) => (
<a className="link" href={infoLink} key={infoLink}>
<img src={image} alt={caption} title={caption} />
<span className="caption">{caption}</span>
</a>
);
UserLink.propTypes = {
infoLink: PropTypes.string.isRequired,
image: PropTypes.string.isRequired,
caption: PropTypes.string.isRequired,
};
const Showcase = ({users}) => (
<div className="showcase">
{users.map((user) => (
<UserLink key={user.infoLink} {...user} />
))}
</div>
);
Showcase.propTypes = {
users: PropTypes.array.isRequired,
};
module.exports = Showcase;