mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 18:58:36 +02:00
feat: change landing page hero (#1290)
* docs: add v2 roadmap to landing page * feat: change landing page hero * fix: remove CSS test as it doesn't account for autoprefixing
This commit is contained in:
parent
189f7cbedd
commit
d89401b47e
3 changed files with 143 additions and 78 deletions
|
@ -15,14 +15,11 @@ const shell = require('shelljs');
|
||||||
|
|
||||||
const CWD = process.cwd();
|
const CWD = process.cwd();
|
||||||
|
|
||||||
const utils = require('../server/utils');
|
|
||||||
|
|
||||||
const loadConfig = require('../server/config');
|
const loadConfig = require('../server/config');
|
||||||
|
|
||||||
const siteConfig = loadConfig(`${CWD}/website/siteConfig.js`);
|
const siteConfig = loadConfig(`${CWD}/website/siteConfig.js`);
|
||||||
const buildDir = `${CWD}/website/build`;
|
const buildDir = `${CWD}/website/build`;
|
||||||
const docsDir = `${CWD}/docs`;
|
const docsDir = `${CWD}/docs`;
|
||||||
const staticCSSDir = `${CWD}/website/static/css`;
|
|
||||||
|
|
||||||
let inputMarkdownFiles = [];
|
let inputMarkdownFiles = [];
|
||||||
let inputAssetsFiles = [];
|
let inputAssetsFiles = [];
|
||||||
|
@ -87,25 +84,6 @@ describe('Build files', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Concatenated CSS files', async () => {
|
|
||||||
const inputFiles = await glob(`${staticCSSDir}/*.css`);
|
|
||||||
const combinedCSSFile = `${buildDir}/${
|
|
||||||
siteConfig.projectName
|
|
||||||
}/css/main.css`;
|
|
||||||
const fileContents = await Promise.all(
|
|
||||||
[combinedCSSFile, ...inputFiles].map(file => fs.readFile(file, 'utf8')),
|
|
||||||
);
|
|
||||||
|
|
||||||
const [outputFileContent, ...inputFileContents] = fileContents;
|
|
||||||
const minifiedCssFiles = await Promise.all(
|
|
||||||
inputFileContents.map(utils.minifyCss),
|
|
||||||
);
|
|
||||||
|
|
||||||
minifiedCssFiles.forEach(fileContent => {
|
|
||||||
expect(outputFileContent).toContain(fileContent);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Copied assets from /docs/assets', () => {
|
test('Copied assets from /docs/assets', () => {
|
||||||
const metadata = outputAssetsFiles.map(file =>
|
const metadata = outputAssetsFiles.map(file =>
|
||||||
filepath.create(file).basename(),
|
filepath.create(file).basename(),
|
||||||
|
|
|
@ -14,55 +14,43 @@ const GridBlock = CompLibrary.GridBlock;
|
||||||
const Showcase = require(`${process.cwd()}/core/Showcase.js`);
|
const Showcase = require(`${process.cwd()}/core/Showcase.js`);
|
||||||
const translate = require('../../server/translate.js').translate;
|
const translate = require('../../server/translate.js').translate;
|
||||||
|
|
||||||
class HomeSplash extends React.Component {
|
function HomeSplash(props) {
|
||||||
render() {
|
const {siteConfig, language} = props;
|
||||||
const {siteConfig, language} = this.props;
|
|
||||||
|
|
||||||
const Button = props => (
|
|
||||||
<div className="pluginWrapper buttonWrapper">
|
|
||||||
<a className="button" href={props.href} target={props.target}>
|
|
||||||
{props.children}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="homeContainer">
|
<div className="index-hero">
|
||||||
<div className="homeSplashFade">
|
<div className="index-hero-inner">
|
||||||
<div className="wrapper homeWrapper">
|
<h1 className="index-hero-project-tagline">
|
||||||
<div className="projectLogo">
|
|
||||||
<img
|
<img
|
||||||
src={`${siteConfig.baseUrl}img/docusaurus_keytar.svg`}
|
|
||||||
alt="Docusaurus with Keytar"
|
alt="Docusaurus with Keytar"
|
||||||
|
className="index-hero-logo"
|
||||||
|
src={`${siteConfig.baseUrl}img/docusaurus_keytar.svg`}
|
||||||
/>
|
/>
|
||||||
</div>
|
{siteConfig.title} makes it easy to maintain{' '}
|
||||||
<div className="inner">
|
<span className="index-hero-project-keywords">Open Source</span>{' '}
|
||||||
<h1 className="projectTitle">
|
documentation websites.
|
||||||
{siteConfig.title}
|
|
||||||
<small>{siteConfig.tagline}</small>
|
|
||||||
</h1>
|
</h1>
|
||||||
<div className="section promoSection">
|
<div className="index-ctas">
|
||||||
<div className="promoRow">
|
<a
|
||||||
<div className="pluginRowBlock">
|
className="button index-ctas-get-started-button"
|
||||||
<Button
|
href={`${siteConfig.baseUrl}docs/${language}/installation`}>
|
||||||
href={`
|
|
||||||
${siteConfig.baseUrl}docs/${language}/installation
|
|
||||||
`}>
|
|
||||||
<translate>Get Started</translate>
|
<translate>Get Started</translate>
|
||||||
</Button>
|
</a>
|
||||||
<Button href="https://github.com/facebook/Docusaurus">
|
<span className="index-ctas-github-button">
|
||||||
<translate>GitHub</translate>
|
<iframe
|
||||||
</Button>
|
src="https://ghbtns.com/github-btn.html?user=facebook&repo=docusaurus&type=star&count=true&size=large"
|
||||||
</div>
|
frameBorder={0}
|
||||||
</div>
|
scrolling={0}
|
||||||
</div>
|
width={160}
|
||||||
</div>
|
height={30}
|
||||||
|
title="GitHub Stars"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class Index extends React.Component {
|
class Index extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
@ -72,7 +60,6 @@ class Index extends React.Component {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<HomeSplash siteConfig={siteConfig} language={language} />
|
<HomeSplash siteConfig={siteConfig} language={language} />
|
||||||
<div className="mainContainer">
|
|
||||||
<div className="announcement">
|
<div className="announcement">
|
||||||
<div className="announcement-inner">
|
<div className="announcement-inner">
|
||||||
We're working on{' '}
|
We're working on{' '}
|
||||||
|
@ -84,6 +71,7 @@ class Index extends React.Component {
|
||||||
<a href="https://munseo-preview.netlify.com/feedback/">here</a>!
|
<a href="https://munseo-preview.netlify.com/feedback/">here</a>!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mainContainer">
|
||||||
<Container padding={['bottom', 'top']} background="light">
|
<Container padding={['bottom', 'top']} background="light">
|
||||||
<GridBlock
|
<GridBlock
|
||||||
align="center"
|
align="center"
|
||||||
|
|
|
@ -64,6 +64,7 @@ table td:first-child > code {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
padding: 48px;
|
padding: 48px;
|
||||||
|
margin: 0 auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,3 +72,101 @@ table td:first-child > code {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: 768px;
|
max-width: 768px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.index-hero {
|
||||||
|
background-color: #2b3137;
|
||||||
|
padding: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-inner {
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: 1100px;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-project-tagline {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 64px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-project-keywords {
|
||||||
|
color: $primaryColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes jackInTheBox {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.1) rotate(30deg);
|
||||||
|
transform-origin: center bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: rotate(-10deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
70% {
|
||||||
|
transform: rotate(3deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-logo {
|
||||||
|
animation-duration: 2s;
|
||||||
|
animation-name: jackInTheBox;
|
||||||
|
float: right;
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-ctas {
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-ctas-get-started-button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border-width: 2px;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 24px;
|
||||||
|
padding: 18px 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-ctas-github-button {
|
||||||
|
vertical-align: sub;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
.index-hero {
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-inner {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-project-tagline {
|
||||||
|
font-size: 36px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-hero-logo {
|
||||||
|
display: block;
|
||||||
|
float: none;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-ctas {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-ctas-github-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue