mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 21:03:47 +02:00
feat(v2): implement theme component overriding (#1435)
* feat(v2): implement component overriding * siteDir theme overriding should work for > 1 level directory * fallback for essential component like Loading * rename default -> classic
This commit is contained in:
parent
1697f9cebb
commit
eedd4c481c
38 changed files with 529 additions and 202 deletions
34
packages/docusaurus-theme-classic/src/theme/Layout/index.js
Normal file
34
packages/docusaurus-theme-classic/src/theme/Layout/index.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* 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 Head from '@docusaurus/Head'; // eslint-disable-line
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; // eslint-disable-line
|
||||
import Navbar from '@theme/Navbar'; // eslint-disable-line
|
||||
import Footer from '@theme/Footer'; // eslint-disable-line
|
||||
|
||||
import './styles.css';
|
||||
|
||||
function Layout(props) {
|
||||
const context = useDocusaurusContext();
|
||||
const {siteConfig = {}} = context;
|
||||
const {baseUrl, favicon, tagline, title: defaultTitle} = siteConfig;
|
||||
const {children, title, noFooter} = props;
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Head defaultTitle={`${defaultTitle} · ${tagline}`}>
|
||||
{title && <title>{`${title} · ${tagline}`}</title>}
|
||||
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
|
||||
</Head>
|
||||
<Navbar />
|
||||
{children}
|
||||
{!noFooter && <Footer />}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default Layout;
|
Loading…
Add table
Add a link
Reference in a new issue