From e2f36acafec225e95f9c77ac080989a5e9de355a Mon Sep 17 00:00:00 2001 From: Matthew Brookes Date: Sat, 30 Nov 2019 19:08:15 +0000 Subject: [PATCH 1/2] [docs] Break up blog template into smaller sections --- .../getting-started/templates/blog/Blog.js | 325 ++++-------------- .../templates/blog/FeaturedPost.js | 59 ++++ .../getting-started/templates/blog/Footer.js | 51 +++ .../getting-started/templates/blog/Header.js | 74 ++++ .../getting-started/templates/blog/Main.js | 38 ++ .../templates/blog/MainFeaturedPost.js | 68 ++++ .../templates/blog/Markdown.js | 2 +- .../getting-started/templates/blog/Sidebar.js | 56 +++ .../templates/blog/blog-post.1.md | 14 +- .../templates/blog/blog-post.2.md | 2 +- .../templates/blog/blog-post.3.md | 8 +- 11 files changed, 418 insertions(+), 279 deletions(-) create mode 100644 docs/src/pages/getting-started/templates/blog/FeaturedPost.js create mode 100644 docs/src/pages/getting-started/templates/blog/Footer.js create mode 100644 docs/src/pages/getting-started/templates/blog/Header.js create mode 100644 docs/src/pages/getting-started/templates/blog/Main.js create mode 100644 docs/src/pages/getting-started/templates/blog/MainFeaturedPost.js create mode 100644 docs/src/pages/getting-started/templates/blog/Sidebar.js diff --git a/docs/src/pages/getting-started/templates/blog/Blog.js b/docs/src/pages/getting-started/templates/blog/Blog.js index 889c34e1f10f72..a9c5eef7d00d0c 100644 --- a/docs/src/pages/getting-started/templates/blog/Blog.js +++ b/docs/src/pages/getting-started/templates/blog/Blog.js @@ -1,156 +1,86 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import CssBaseline from '@material-ui/core/CssBaseline'; -import Toolbar from '@material-ui/core/Toolbar'; -import IconButton from '@material-ui/core/IconButton'; -import SearchIcon from '@material-ui/icons/Search'; -import Paper from '@material-ui/core/Paper'; -import Typography from '@material-ui/core/Typography'; import Grid from '@material-ui/core/Grid'; -import Card from '@material-ui/core/Card'; -import CardActionArea from '@material-ui/core/CardActionArea'; -import CardContent from '@material-ui/core/CardContent'; -import CardMedia from '@material-ui/core/CardMedia'; -import Hidden from '@material-ui/core/Hidden'; -import Link from '@material-ui/core/Link'; -import Button from '@material-ui/core/Button'; -import Divider from '@material-ui/core/Divider'; import Container from '@material-ui/core/Container'; -import Markdown from './Markdown'; +import Header from './Header'; +import MainFeaturedPost from './MainFeaturedPost'; +import FeaturedPost from './FeaturedPost'; +import Main from './Main'; +import Sidebar from './Sidebar'; +import Footer from './Footer'; import post1 from './blog-post.1.md'; import post2 from './blog-post.2.md'; import post3 from './blog-post.3.md'; -function Copyright() { - return ( - - {'Copyright © '} - - Your Website - {' '} - {new Date().getFullYear()} - {'.'} - - ); -} - const useStyles = makeStyles(theme => ({ - toolbar: { - borderBottom: `1px solid ${theme.palette.divider}`, - }, - toolbarTitle: { - flex: 1, - }, - toolbarSecondary: { - justifyContent: 'space-between', - overflowX: 'auto', - }, - toolbarLink: { - padding: theme.spacing(1), - flexShrink: 0, - }, - mainFeaturedPost: { - position: 'relative', - backgroundColor: theme.palette.grey[800], - color: theme.palette.common.white, - marginBottom: theme.spacing(4), - backgroundImage: 'url(https://source.unsplash.com/user/erondu)', - backgroundSize: 'cover', - backgroundRepeat: 'no-repeat', - backgroundPosition: 'center', - }, - overlay: { - position: 'absolute', - top: 0, - bottom: 0, - right: 0, - left: 0, - backgroundColor: 'rgba(0,0,0,.3)', - }, - mainFeaturedPostContent: { - position: 'relative', - padding: theme.spacing(3), - [theme.breakpoints.up('md')]: { - padding: theme.spacing(6), - paddingRight: 0, - }, - }, mainGrid: { marginTop: theme.spacing(3), }, - card: { - display: 'flex', - }, - cardDetails: { - flex: 1, - }, - cardMedia: { - width: 160, - }, - markdown: { - ...theme.typography.body2, - padding: theme.spacing(3, 0), - }, - sidebarAboutBox: { - padding: theme.spacing(2), - backgroundColor: theme.palette.grey[200], - }, - sidebarSection: { - marginTop: theme.spacing(3), - }, - footer: { - backgroundColor: theme.palette.background.paper, - marginTop: theme.spacing(8), - padding: theme.spacing(6, 0), - }, })); const sections = [ - 'Technology', - 'Design', - 'Culture', - 'Business', - 'Politics', - 'Opinion', - 'Science', - 'Health', - 'Style', - 'Travel', + { title: 'Technology', url: '#' }, + { title: 'Design', url: '#' }, + { title: 'Culture', url: '#' }, + { title: 'Business', url: '#' }, + { title: 'Politics', url: '#' }, + { title: 'Opinion', url: '#' }, + { title: 'Science', url: '#' }, + { title: 'Health', url: '#' }, + { title: 'Style', url: '#' }, + { title: 'Travel', url: '#' }, ]; +const mainFeaturedPost = { + title: 'Title of a longer featured blog post', + description: + "Multiple lines of text that form the lede, informing new readers quickly and efficiently about what's most interesting in this post's contents.", + image: 'https://source.unsplash.com/random', + imgText: 'main image description', + linkText: 'Continue reading…', +}; + const featuredPosts = [ { title: 'Featured post', date: 'Nov 12', description: 'This is a wider card with supporting text below as a natural lead-in to additional content.', + image: 'https://source.unsplash.com/random', + imageText: 'Image Text', }, { title: 'Post title', date: 'Nov 11', description: 'This is a wider card with supporting text below as a natural lead-in to additional content.', + image: 'https://source.unsplash.com/random', + imageText: 'Image Text', }, ]; const posts = [post1, post2, post3]; -const archives = [ - 'March 2020', - 'February 2020', - 'January 2020', - 'December 2019', - 'November 2019', - 'October 2019', - 'September 2019', - 'August 2019', - 'July 2019', - 'June 2019', - 'May 2019', - 'April 2019', -]; - -const social = ['GitHub', 'Twitter', 'Facebook']; +const sidebar = { + title: 'About', + description: + 'Etiam porta sem malesuada magna mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.', + archives: [ + { title: 'March 2020', url: '#' }, + { title: 'February 2020', url: '#' }, + { title: 'January 2020', url: '#' }, + { title: 'November 1999', url: '#' }, + { title: 'October 1999', url: '#' }, + { title: 'September 1999', url: '#' }, + { title: 'August 1999', url: '#' }, + { title: 'July 1999', url: '#' }, + { title: 'June 1999', url: '#' }, + { title: 'May 1999', url: '#' }, + { title: 'April 1999', url: '#' }, + ], + social: ['GitHub', 'Twitter', 'Facebook'], +}; export default function Blog() { const classes = useStyles(); @@ -159,163 +89,26 @@ export default function Blog() { - - - - Blog - - - - - - - - {sections.map(section => ( - - {section} - - ))} - +
- {/* Main featured post */} - - {/* Increase the priority of the hero background image */} - { - background - } -
- - -
- - Title of a longer featured blog post - - - Multiple lines of text that form the lede, informing new readers quickly and - efficiently about what's most interesting in this post's contents. - - - Continue reading… - -
-
-
- - {/* End main featured post */} - {/* Sub featured posts */} + {featuredPosts.map(post => ( - - - -
- - - {post.title} - - - {post.date} - - - {post.description} - - - Continue reading... - - -
- - - -
-
-
+ ))}
- {/* End sub featured posts */} - {/* Main content */} - - - From the Firehose - - - {posts.map(post => ( - - {post} - - ))} - - {/* End main content */} - {/* Sidebar */} - - - - About - - - Etiam porta sem malesuada magna mollis euismod. Cras mattis consectetur purus sit - amet fermentum. Aenean lacinia bibendum nulla sed consectetur. - - - - Archives - - {archives.map(archive => ( - - {archive} - - ))} - - Social - - {social.map(network => ( - - {network} - - ))} - - {/* End sidebar */} +
+
- {/* Footer */} -
- - - Footer - - - Something here to give the footer a purpose! - - - -
- {/* End footer */} +