website/pages/en/index.js (122 lines of code) (raw):
/**
* Copyright (c) Meta Platforms, Inc. and 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 CompLibrary = require('../../core/CompLibrary.js');
const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock;
const siteConfig = require(process.cwd() + '/siteConfig.js');
function imgUrl(img) {
return siteConfig.baseUrl + 'img/' + img;
}
function docUrl(doc, language) {
return siteConfig.baseUrl + 'docs/' + (language ? language + '/' : '') + doc;
}
function pageUrl(page, language) {
return siteConfig.baseUrl + (language ? language + '/' : '') + page;
}
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',
};
const SplashContainer = props => (
<div className="homeContainer">
<div className="homeSplashFade">
<div className="wrapper homeWrapper">{props.children}</div>
</div>
</div>
);
const Logo = props => (
<div className="projectLogo">
<img src={props.img_src} />
</div>
);
const ProjectTitle = props => (
<h2 className="projectTitle">
{siteConfig.title}
<small>{siteConfig.tagline}</small>
</h2>
);
const PromoSection = props => (
<div className="section promoSection">
<div className="promoRow">
<div className="pluginRowBlock">{props.children}</div>
</div>
</div>
);
function SocialBanner() {
return (
<div className="SocialBanner">
<div>
Support Ukraine πΊπ¦{' '}
<a href="https://opensource.fb.com/support-ukraine">
Help Provide Humanitarian Aid to Ukraine
</a>
.
</div>
</div>
);
}
class HomeSplash extends React.Component {
render() {
let language = this.props.language || '';
return (
<SplashContainer>
<Logo img_src={imgUrl('redex-hero.png')} />
<div className="inner">
<ProjectTitle />
<PromoSection>
<Button href={docUrl('installation', language)}>Getting Started</Button>
<Button href='https://github.com/facebook/redex'>GitHub</Button>
</PromoSection>
</div>
</SplashContainer>
);
}
}
const Block = props => (
<Container
padding={['bottom', 'top']}
id={props.id}
background={props.background}>
<GridBlock align="left" contents={props.children} layout={props.layout} />
</Container>
);
class Index extends React.Component {
render() {
let language = this.props.language || '';
return (
<div>
<SocialBanner />
<HomeSplash language={language} />
<div className="mainContainer">
<Container padding={['bottom', 'top']}>
<GridBlock align="center" layout="fourColumn" contents={[
{
title: 'Optimizing',
content: 'Redex provides a framework for reading, writing, and analyzing .dex files, and a set of optimization passes that use this framework to improve the bytecode. An APK optimized by Redex should be smaller and faster.',
},
{
title: 'Fast',
content: 'Fewer bytes also means faster download times, faster install times, and lower data usage for cell users. Lastly, less bytecode also typically translates into faster runtime performance.',
},
{
title: 'Buck Integration',
content: 'Redex has deep integration with Buck where your Redex config is passed as a parameter to the Buck android_binary rule when generating the APK.',
}
]} />
</Container>
</div>
</div>
);
}
}
module.exports = Index;