|  | 
|  | 1 | +/** | 
|  | 2 | + * Copyright (c) 2017-present, Facebook, Inc. | 
|  | 3 | + * | 
|  | 4 | + * This source code is licensed under the MIT license found in the | 
|  | 5 | + * LICENSE file in the root directory of this source tree. | 
|  | 6 | + */ | 
|  | 7 | + | 
|  | 8 | +const React = require('react') | 
|  | 9 | + | 
|  | 10 | +const CompLibrary = require('../../core/CompLibrary.js') | 
|  | 11 | + | 
|  | 12 | +const MarkdownBlock = CompLibrary.MarkdownBlock /* Used to read markdown */ | 
|  | 13 | +const Container = CompLibrary.Container | 
|  | 14 | +const GridBlock = CompLibrary.GridBlock | 
|  | 15 | + | 
|  | 16 | +class HomeSplash extends React.Component { | 
|  | 17 | + render() { | 
|  | 18 | + const { siteConfig, language = '' } = this.props | 
|  | 19 | + const { baseUrl, docsUrl } = siteConfig | 
|  | 20 | + const docsPart = `${docsUrl ? `${docsUrl}/` : ''}` | 
|  | 21 | + const langPart = `${language ? `${language}/` : ''}` | 
|  | 22 | + const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}` | 
|  | 23 | + | 
|  | 24 | + const SplashContainer = props => ( | 
|  | 25 | + <div className="homeContainer"> | 
|  | 26 | + <div className="homeSplashFade"> | 
|  | 27 | + <div className="wrapper homeWrapper">{props.children}</div> | 
|  | 28 | + </div> | 
|  | 29 | + </div> | 
|  | 30 | + ) | 
|  | 31 | + | 
|  | 32 | + const Logo = props => ( | 
|  | 33 | + <div className="projectLogo"> | 
|  | 34 | + <img | 
|  | 35 | + src={props.img_src} | 
|  | 36 | + alt="Project Logo" | 
|  | 37 | + height={props.height || 128} | 
|  | 38 | + /> | 
|  | 39 | + </div> | 
|  | 40 | + ) | 
|  | 41 | + | 
|  | 42 | + const ProjectTitle = () => ( | 
|  | 43 | + <div> | 
|  | 44 | + <h2 className="projectTitle">Angular Testing Library</h2> | 
|  | 45 | + <div className="projectTaglineWrapper"> | 
|  | 46 | + <p className="projectTagline"> | 
|  | 47 | + Simple and complete Angular DOM testing utilities that encourage | 
|  | 48 | + good testing practices with <a href="https://angular.io">Angular</a> | 
|  | 49 | + . | 
|  | 50 | + </p> | 
|  | 51 | + </div> | 
|  | 52 | + </div> | 
|  | 53 | + ) | 
|  | 54 | + | 
|  | 55 | + const PromoSection = props => ( | 
|  | 56 | + <div className="section promoSection"> | 
|  | 57 | + <div className="promoRow"> | 
|  | 58 | + <div className="pluginRowBlock">{props.children}</div> | 
|  | 59 | + </div> | 
|  | 60 | + </div> | 
|  | 61 | + ) | 
|  | 62 | + | 
|  | 63 | + const Button = props => ( | 
|  | 64 | + <div className="pluginWrapper buttonWrapper"> | 
|  | 65 | + <a className="button" href={props.href} target={props.target}> | 
|  | 66 | + {props.children} | 
|  | 67 | + </a> | 
|  | 68 | + </div> | 
|  | 69 | + ) | 
|  | 70 | + | 
|  | 71 | + return ( | 
|  | 72 | + <SplashContainer> | 
|  | 73 | + <Logo img_src={`${baseUrl}img/angular-250x250.png`} height={128} /> | 
|  | 74 | + <div className="inner"> | 
|  | 75 | + <ProjectTitle siteConfig={siteConfig} /> | 
|  | 76 | + <PromoSection> | 
|  | 77 | + <Button href={docUrl('angular-testing-library/intro')}> | 
|  | 78 | + Read the Docs | 
|  | 79 | + </Button> | 
|  | 80 | + </PromoSection> | 
|  | 81 | + </div> | 
|  | 82 | + </SplashContainer> | 
|  | 83 | + ) | 
|  | 84 | + } | 
|  | 85 | +} | 
|  | 86 | + | 
|  | 87 | +class Index extends React.Component { | 
|  | 88 | + render() { | 
|  | 89 | + const { config: siteConfig, language = '' } = this.props | 
|  | 90 | + const { baseUrl } = siteConfig | 
|  | 91 | + | 
|  | 92 | + const Block = props => ( | 
|  | 93 | + <Container | 
|  | 94 | + padding={['bottom', 'top']} | 
|  | 95 | + id={props.id} | 
|  | 96 | + background={props.background} | 
|  | 97 | + > | 
|  | 98 | + <GridBlock | 
|  | 99 | + align={props.align || 'center'} | 
|  | 100 | + imageAlign={props.imageAlign || 'center'} | 
|  | 101 | + contents={props.children} | 
|  | 102 | + layout={props.layout} | 
|  | 103 | + /> | 
|  | 104 | + </Container> | 
|  | 105 | + ) | 
|  | 106 | + | 
|  | 107 | + const FeatureCallout = () => ( | 
|  | 108 | + <Container className="" background={'light'} padding={['top', 'bottom']}> | 
|  | 109 | + <div style={{ textAlign: 'center' }}> | 
|  | 110 | + <p> | 
|  | 111 | + <i> | 
|  | 112 | + The more your tests resemble the way your software is used, <br /> | 
|  | 113 | + the more confidence they can give you. | 
|  | 114 | + </i> | 
|  | 115 | + </p> | 
|  | 116 | + <MarkdownBlock> | 
|  | 117 | + `npm install --save-dev @angular-extensions/testing-library` | 
|  | 118 | + </MarkdownBlock> | 
|  | 119 | + </div> | 
|  | 120 | + </Container> | 
|  | 121 | + ) | 
|  | 122 | + const Features = () => ( | 
|  | 123 | + <React.Fragment> | 
|  | 124 | + <Block layout="twoColumn"> | 
|  | 125 | + {[ | 
|  | 126 | + { | 
|  | 127 | + content: | 
|  | 128 | + 'Tests only break when your app breaks, not implementation details', | 
|  | 129 | + image: `${baseUrl}img/wrench-128x128.png`, | 
|  | 130 | + imageAlign: 'top', | 
|  | 131 | + title: 'Write Maintainable Tests', | 
|  | 132 | + }, | 
|  | 133 | + { | 
|  | 134 | + content: 'Interact with your app the same way as your users', | 
|  | 135 | + image: `${baseUrl}img/check-128x128.png`, | 
|  | 136 | + imageAlign: 'top', | 
|  | 137 | + title: 'Develop with Confidence', | 
|  | 138 | + }, | 
|  | 139 | + { | 
|  | 140 | + content: | 
|  | 141 | + 'Built-in selectors use semantic HTML and ARIA roles to help you write inclusive code', | 
|  | 142 | + image: `${baseUrl}img/tada-128x128.png`, | 
|  | 143 | + imageAlign: 'top', | 
|  | 144 | + title: 'Accessible by Default', | 
|  | 145 | + }, | 
|  | 146 | + ]} | 
|  | 147 | + </Block> | 
|  | 148 | + </React.Fragment> | 
|  | 149 | + ) | 
|  | 150 | + | 
|  | 151 | + return ( | 
|  | 152 | + <div> | 
|  | 153 | + <HomeSplash siteConfig={siteConfig} language={language} /> | 
|  | 154 | + <div className="mainContainer"> | 
|  | 155 | + <FeatureCallout /> | 
|  | 156 | + <Features /> | 
|  | 157 | + </div> | 
|  | 158 | + </div> | 
|  | 159 | + ) | 
|  | 160 | + } | 
|  | 161 | +} | 
|  | 162 | + | 
|  | 163 | +module.exports = Index | 
0 commit comments