2017-07-01 17:14:24 -07:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
const React = require("react");
|
2018-07-01 06:59:20 -07:00
|
|
|
const PropTypes = require("prop-types");
|
2018-02-06 23:47:14 +01:00
|
|
|
const AnimatedLogo = require("@sandhose/prettier-animated-logo");
|
2020-06-26 20:30:21 +08:00
|
|
|
const { MarkdownBlock, Container } = require("../../core/CompLibrary.js");
|
2017-07-01 17:14:24 -07:00
|
|
|
|
|
|
|
|
const siteConfig = require(process.cwd() + "/siteConfig.js");
|
|
|
|
|
|
2018-02-06 20:52:39 +11:00
|
|
|
const ButtonGroup = (props) => (
|
|
|
|
|
<div className="buttonGroup buttonWrapper">{props.children}</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
ButtonGroup.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
children: PropTypes.node,
|
2018-02-06 20:52:39 +11:00
|
|
|
};
|
|
|
|
|
|
2017-07-01 17:14:24 -07:00
|
|
|
class Button extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div className="pluginWrapper buttonWrapper">
|
|
|
|
|
<a className="button" href={this.props.href} target={this.props.target}>
|
|
|
|
|
{this.props.children}
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Button.defaultProps = {
|
|
|
|
|
target: "_self",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Button.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
href: PropTypes.string,
|
|
|
|
|
target: PropTypes.string,
|
|
|
|
|
children: PropTypes.any,
|
2017-07-01 17:14:24 -07:00
|
|
|
};
|
|
|
|
|
|
2019-05-13 16:21:45 -03:00
|
|
|
function Tidelift() {
|
|
|
|
|
return (
|
|
|
|
|
<a className="tidelift" href={siteConfig.tideliftUrl}>
|
2020-01-23 14:52:24 -07:00
|
|
|
PRETTIER FOR ENTERPRISE
|
2019-05-13 16:21:45 -03:00
|
|
|
</a>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-17 14:31:51 +08:00
|
|
|
const HomeSplash = (props) => (
|
|
|
|
|
<div className="homeContainer">
|
|
|
|
|
<Tidelift />
|
|
|
|
|
<div className="homeSplashFade">
|
|
|
|
|
<div className="wrapper homeWrapper">
|
|
|
|
|
<div className="animatedLogoWrapper">
|
|
|
|
|
<AnimatedLogo version="wide" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="inner">
|
|
|
|
|
<div className="section promoSection">
|
|
|
|
|
<div className="promoRow">
|
|
|
|
|
<div className="pluginRowBlock">
|
|
|
|
|
<Button href="/playground/">Try It Online</Button>
|
|
|
|
|
<Button href={"/docs/" + props.language + "/install.html"}>
|
|
|
|
|
Install Prettier
|
|
|
|
|
</Button>
|
2017-07-01 17:14:24 -07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2018-02-06 20:52:39 +11:00
|
|
|
</div>
|
2020-12-17 14:31:51 +08:00
|
|
|
</div>
|
|
|
|
|
);
|
2018-02-06 20:52:39 +11:00
|
|
|
|
|
|
|
|
HomeSplash.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
language: PropTypes.string,
|
2018-02-06 20:52:39 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const TldrSection = ({ language }) => (
|
|
|
|
|
<div className="tldrSection productShowcaseSection lightBackground">
|
|
|
|
|
<Container>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexFlow: "row wrap",
|
|
|
|
|
justifyContent: "space-evenly",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
|
|
|
<h2>What is Prettier?</h2>
|
|
|
|
|
<ul style={{ flex: "1" }}>
|
|
|
|
|
<li>An opinionated code formatter</li>
|
|
|
|
|
<li>Supports many languages</li>
|
2018-02-28 17:39:11 -05:00
|
|
|
<li>Integrates with most editors</li>
|
2018-02-06 20:52:39 +11:00
|
|
|
<li>Has few options</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
|
|
|
<h2>Why?</h2>
|
|
|
|
|
<ul style={{ flex: "1" }}>
|
|
|
|
|
<li>You press save and code is formatted</li>
|
|
|
|
|
<li>No need to discuss style in code review</li>
|
|
|
|
|
<li>Saves you time and energy</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href={"/docs/" + language + "/why-prettier.html"}>And more</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Container>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
TldrSection.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
language: PropTypes.string,
|
2018-02-06 20:52:39 +11:00
|
|
|
};
|
|
|
|
|
|
2019-02-26 11:31:16 -05:00
|
|
|
const Language = ({ name, nameLink, showName, image, variants }) => (
|
2018-02-06 20:52:39 +11:00
|
|
|
<div
|
|
|
|
|
className="languageCategory"
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "flex-start",
|
|
|
|
|
paddingBottom: "1em",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<img src={image} style={{ width: "50px", padding: "0 20px" }} />
|
2019-02-26 11:31:16 -05:00
|
|
|
<ul>
|
|
|
|
|
{showName && (
|
|
|
|
|
<li className="accented">
|
|
|
|
|
{nameLink ? <a href={nameLink}>{name}</a> : name}
|
|
|
|
|
</li>
|
|
|
|
|
)}
|
2018-02-06 20:52:39 +11:00
|
|
|
{variants.map((variant) => (
|
2019-02-26 11:31:16 -05:00
|
|
|
<li key={variant}>
|
2018-02-06 20:52:39 +11:00
|
|
|
<MarkdownBlock>{variant}</MarkdownBlock>
|
2019-02-26 11:31:16 -05:00
|
|
|
</li>
|
2018-02-06 20:52:39 +11:00
|
|
|
))}
|
2019-02-26 11:31:16 -05:00
|
|
|
</ul>
|
2018-02-06 20:52:39 +11:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Language.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
name: PropTypes.string,
|
2019-02-26 11:31:16 -05:00
|
|
|
nameLink: PropTypes.string,
|
2018-10-14 08:03:35 -04:00
|
|
|
showName: PropTypes.bool,
|
2018-07-01 06:59:20 -07:00
|
|
|
image: PropTypes.string,
|
|
|
|
|
variants: PropTypes.array,
|
2018-02-06 20:52:39 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const LanguagesSection = () => {
|
2019-01-22 21:54:32 +08:00
|
|
|
const languageChunks = siteConfig.supportedLanguages.reduce(
|
|
|
|
|
(acc, language) => {
|
|
|
|
|
const last = acc[acc.length - 1];
|
|
|
|
|
if (
|
|
|
|
|
last &&
|
|
|
|
|
last.length < 2 &&
|
|
|
|
|
last.reduce((sum, lang) => sum + lang.variants.length, 0) +
|
|
|
|
|
language.variants.length <
|
2019-02-26 11:31:16 -05:00
|
|
|
9
|
2019-01-22 21:54:32 +08:00
|
|
|
) {
|
|
|
|
|
last.push(language);
|
|
|
|
|
} else {
|
|
|
|
|
acc.push([language]);
|
|
|
|
|
}
|
|
|
|
|
return acc;
|
|
|
|
|
},
|
|
|
|
|
[]
|
|
|
|
|
);
|
2018-02-06 20:52:39 +11:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className="languagesSection productShowcaseSection"
|
|
|
|
|
style={{ textAlign: "center" }}
|
|
|
|
|
>
|
|
|
|
|
<Container>
|
|
|
|
|
<h2>Works with the Tools You Use</h2>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexFlow: "row wrap",
|
|
|
|
|
justifyContent: "space-around",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{languageChunks.map((languageChunk, index) => (
|
|
|
|
|
<div key={index} style={{ flex: "1 1 auto" }}>
|
|
|
|
|
{languageChunk.map((language) => (
|
|
|
|
|
<Language key={language.name} {...language} />
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</Container>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const Editor = ({ content = "", image, name }) => (
|
|
|
|
|
<div className="editor">
|
|
|
|
|
<img className="editorImage" src={image} />
|
|
|
|
|
<div className="editorInfo">
|
2018-07-01 06:59:20 -07:00
|
|
|
<h3 className="editorName">{name}</h3>
|
2018-02-06 20:52:39 +11:00
|
|
|
<MarkdownBlock>{content.replace(/\n/g, " \n")}</MarkdownBlock>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Editor.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
content: PropTypes.string,
|
|
|
|
|
image: PropTypes.string.isRequired,
|
|
|
|
|
name: PropTypes.string.isRequired,
|
2018-02-06 20:52:39 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const EditorSupportSection = () => (
|
|
|
|
|
<div className="editorSupportSection productShowcaseSection lightBackground">
|
|
|
|
|
<Container>
|
|
|
|
|
<h2>Editor Support</h2>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexFlow: "row wrap",
|
|
|
|
|
justifyContent: "space-around",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{siteConfig.editors.map((editor) => (
|
|
|
|
|
<Editor key={editor.name} {...editor} />
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</Container>
|
|
|
|
|
|
|
|
|
|
<div style={{ float: "right" }}>
|
|
|
|
|
<span>Got more? </span>
|
|
|
|
|
<a
|
2021-01-24 01:14:13 +08:00
|
|
|
href={`${siteConfig.githubUrl}/edit/main/website/data/editors.yml`}
|
2018-02-06 20:52:39 +11:00
|
|
|
className="button"
|
|
|
|
|
>
|
|
|
|
|
Send a PR
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const UsersSection = ({ language }) => {
|
|
|
|
|
const showcase = siteConfig.users
|
2020-12-17 14:31:51 +08:00
|
|
|
.filter((user) => user.pinned)
|
|
|
|
|
.map((user, i) => (
|
|
|
|
|
<a key={i} className="growOnHover alignCenter" href={user.infoLink}>
|
|
|
|
|
<img className="user" src={user.greyImage} title={user.caption} />
|
|
|
|
|
</a>
|
|
|
|
|
));
|
2018-02-06 20:52:39 +11:00
|
|
|
|
|
|
|
|
return (
|
2020-06-28 03:47:29 +02:00
|
|
|
<div className="usersSection productShowcaseSection">
|
2018-02-06 20:52:39 +11:00
|
|
|
<Container>
|
|
|
|
|
<h2>Used By People You Rely On</h2>
|
|
|
|
|
<div style={{ textAlign: "right" }} />
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexFlow: "row wrap",
|
|
|
|
|
justifyContent: "space-around",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{showcase}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="more-users">
|
|
|
|
|
<a
|
|
|
|
|
className="button"
|
|
|
|
|
href={siteConfig.baseUrl + language + "/users/"}
|
|
|
|
|
target="_self"
|
2020-06-28 03:47:29 +02:00
|
|
|
style={{ marginRight: "10px" }}
|
2018-02-06 20:52:39 +11:00
|
|
|
>
|
2020-09-14 13:53:20 +08:00
|
|
|
See Others
|
2018-02-06 20:52:39 +11:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<h2 className="ecosystemSubHeader">Established in the Ecosystem</h2>
|
|
|
|
|
<div
|
|
|
|
|
className="ecosystemSubSection"
|
|
|
|
|
style={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
justifyContent: "space-around",
|
|
|
|
|
flexFlow: "row wrap",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div style={{ display: "flex", marginTop: "22px" }}>
|
|
|
|
|
<a
|
|
|
|
|
href="https://github.com/prettier/prettier"
|
|
|
|
|
className="growOnHover"
|
|
|
|
|
>
|
|
|
|
|
<img src="/images/github_grey.svg" style={{ height: "100px" }} />
|
|
|
|
|
</a>
|
|
|
|
|
<div style={{ marginLeft: ".7em", width: "260px" }}>
|
2019-09-11 19:10:44 +09:00
|
|
|
<p>
|
2020-05-20 17:51:08 +08:00
|
|
|
More than{" "}
|
2020-11-28 09:26:43 +09:00
|
|
|
<strong data-placeholder="dependent-github">2.3 million</strong>{" "}
|
2020-05-20 17:51:08 +08:00
|
|
|
dependent repositories on GitHub
|
2019-09-11 19:10:44 +09:00
|
|
|
</p>
|
2018-02-06 20:52:39 +11:00
|
|
|
<Button href="https://github.com/prettier/prettier/network/dependents">
|
|
|
|
|
Check Them Out
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-06-28 03:47:29 +02:00
|
|
|
|
|
|
|
|
<div style={{ display: "flex", marginTop: "22px" }}>
|
|
|
|
|
<a
|
|
|
|
|
href="https://npmjs.com/package/prettier"
|
|
|
|
|
className="growOnHover"
|
|
|
|
|
>
|
|
|
|
|
<img src="/images/npm_grey.svg" style={{ height: "100px" }} />
|
|
|
|
|
</a>
|
|
|
|
|
<div style={{ marginLeft: ".7em", width: "260px" }}>
|
|
|
|
|
<p>
|
2020-08-26 13:31:31 +09:00
|
|
|
More than <strong data-placeholder="dependent-npm">6000</strong>{" "}
|
2020-06-28 03:47:29 +02:00
|
|
|
dependent packages on npm
|
|
|
|
|
</p>
|
|
|
|
|
<Button href="https://www.npmjs.com/browse/depended/prettier">
|
|
|
|
|
See them all
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2018-02-06 20:52:39 +11:00
|
|
|
</div>
|
|
|
|
|
</Container>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UsersSection.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
language: PropTypes.string,
|
2017-07-01 17:14:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Index extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
const language = this.props.language || "en";
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
2018-02-06 20:52:39 +11:00
|
|
|
<script src="landing.js" />
|
2017-07-01 17:14:24 -07:00
|
|
|
<HomeSplash language={language} />
|
2018-07-01 06:59:20 -07:00
|
|
|
<div className="mainContainer landingContainer">
|
2018-02-06 20:52:39 +11:00
|
|
|
<TldrSection language={language} />
|
|
|
|
|
<LanguagesSection />
|
|
|
|
|
<EditorSupportSection />
|
|
|
|
|
<UsersSection language={language} />
|
2017-07-01 17:14:24 -07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Index.propTypes = {
|
2018-07-01 06:59:20 -07:00
|
|
|
language: PropTypes.string,
|
2017-07-01 17:14:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = Index;
|