From 063484a05a5ebb336046af0d20855d6f0e6af4b7 Mon Sep 17 00:00:00 2001 From: Fanny Date: Sun, 17 May 2020 07:01:38 -0300 Subject: [PATCH] feat(v2): bootstrap layout (#2710) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(v2): add minor adjustements and footer component * fix(v2): margin and spacing of footer * feat(v2): add navbar component * ádd collapse classname * feat(v2): add dependencies * feat(v2): remove unused code * feat(v2): remove unused links * feat(v2): add reactstrap components :| * feat(v2): add brand and other nav componnets * feat(v2): Add the layout tag * fix(v2): Fix layout height * fix(v2): Fix spacings --- .../templates/bootstrap/src/pages/index.js | 22 ++---- .../src/theme/BlogListPage/index.js | 41 ++++++---- .../src/theme/BlogPostPage/index.js | 35 +++++---- .../src/theme/BlogTagsListPage/index.js | 12 ++- .../src/theme/BlogTagsPostsPage/index.js | 49 ++++++------ .../src/theme/Footer/index.js | 2 +- .../src/theme/Layout/index.js | 78 +++++++++++++++++++ .../src/theme/Navbar/index.js | 39 +++++----- 8 files changed, 186 insertions(+), 92 deletions(-) create mode 100644 packages/docusaurus-theme-bootstrap/src/theme/Layout/index.js diff --git a/packages/docusaurus-init/templates/bootstrap/src/pages/index.js b/packages/docusaurus-init/templates/bootstrap/src/pages/index.js index 6ab84137fa..18730cebe6 100644 --- a/packages/docusaurus-init/templates/bootstrap/src/pages/index.js +++ b/packages/docusaurus-init/templates/bootstrap/src/pages/index.js @@ -4,7 +4,6 @@ import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; -import Navbar from '@theme/Navbar'; import styles from './styles.module.css'; @@ -64,24 +63,19 @@ function Home() { title={`Hello from ${siteConfig.title}`} description="Description will go into a meta tag in ">
- -
-

{siteConfig.title}

-

{siteConfig.tagline}

-
- Get Started -
+

{siteConfig.title}

+

{siteConfig.tagline}

+
+ Get Started
{features && features.length > 0 && (
-
-
- {features.map((props, idx) => ( - - ))} -
+
+ {features.map((props, idx) => ( + + ))}
)} diff --git a/packages/docusaurus-theme-bootstrap/src/theme/BlogListPage/index.js b/packages/docusaurus-theme-bootstrap/src/theme/BlogListPage/index.js index 1f5482438e..d2bd36bd61 100644 --- a/packages/docusaurus-theme-bootstrap/src/theme/BlogListPage/index.js +++ b/packages/docusaurus-theme-bootstrap/src/theme/BlogListPage/index.js @@ -6,30 +6,39 @@ */ import React from 'react'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import BlogPostCard from '@theme/BlogPostItem'; import BlogListPaginator from '@theme/BlogListPaginator'; +import Layout from '@theme/Layout'; function BlogListPage(props) { const {items, metadata} = props; + const { + siteConfig: {title: siteTitle}, + } = useDocusaurusContext(); + const isBlogOnlyMode = metadata.permalink === '/'; + const title = isBlogOnlyMode ? siteTitle : 'Blog'; return ( -
-
- {items.map(({content: BlogPostContent}) => ( -
- - - -
- ))} - + +
+
+ {items.map(({content: BlogPostContent}) => ( +
+ + + +
+ ))} + +
-
+ ); } diff --git a/packages/docusaurus-theme-bootstrap/src/theme/BlogPostPage/index.js b/packages/docusaurus-theme-bootstrap/src/theme/BlogPostPage/index.js index 88a37f05ba..a4767e084d 100644 --- a/packages/docusaurus-theme-bootstrap/src/theme/BlogPostPage/index.js +++ b/packages/docusaurus-theme-bootstrap/src/theme/BlogPostPage/index.js @@ -6,32 +6,35 @@ */ import React from 'react'; +import Layout from '@theme/Layout'; import BlogPostItem from '@theme/BlogPostItem'; import BlogPostPaginator from '@theme/BlogPostPaginator'; function BlogPostPage(props) { const {content: BlogPostContents} = props; - const {frontMatter, metadata} = BlogPostContents; + const {title, description, frontMatter, metadata} = BlogPostContents; const {nextItem, prevItem} = metadata; return ( -
-
-
- - - - {(nextItem || prevItem) && ( - - )} + +
+
+
+ + + + {(nextItem || prevItem) && ( + + )} +
-
+ ); } diff --git a/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsListPage/index.js b/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsListPage/index.js index 689a6bb47a..2d39a25a8e 100644 --- a/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsListPage/index.js +++ b/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsListPage/index.js @@ -4,7 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + import React from 'react'; +import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; function BlogTagsListPage(props) { @@ -24,10 +26,12 @@ function BlogTagsListPage(props) { ); return ( -
-

Tags

-
    {renderAllTags()}
-
+ +
+

Tags

+
    {renderAllTags()}
+
+
); } diff --git a/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsPostsPage/index.js b/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsPostsPage/index.js index 89da960d8b..07a50ff6bc 100644 --- a/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsPostsPage/index.js +++ b/packages/docusaurus-theme-bootstrap/src/theme/BlogTagsPostsPage/index.js @@ -7,6 +7,7 @@ import React from 'react'; import BlogPostItem from '@theme/BlogPostItem'; +import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; function pluralize(count, word) { @@ -18,31 +19,35 @@ function BlogTagsPostPage(props) { const {allTagsPath, name, count} = metadata; return ( -
-
-

- {count} {pluralize(count, 'post')} tagged with "{name} - " -

- View All Tags -
+ +
+
+

+ {count} {pluralize(count, 'post')} tagged with "{name} + " +

+ View All Tags +
-
- {items.map(({content: BlogPostContent}) => ( -
- + {items.map(({content: BlogPostContent}) => ( +
- - -
- ))} + className="col col-xl-4 offset-xl-4 col-xs-6 mb-5"> + + + +
+ ))} +
-
+ ); } diff --git a/packages/docusaurus-theme-bootstrap/src/theme/Footer/index.js b/packages/docusaurus-theme-bootstrap/src/theme/Footer/index.js index 41d9f0db8f..8916f3d5a3 100644 --- a/packages/docusaurus-theme-bootstrap/src/theme/Footer/index.js +++ b/packages/docusaurus-theme-bootstrap/src/theme/Footer/index.js @@ -39,7 +39,7 @@ function Footer() { const {links} = footer || {}; return ( -