feat(theme-classic): allow specifying width/height in logo (#5770)

* feat: changed the logo properties to allow width/height specification

* fixup! feat: changed the logo properties to allow width/height specification

* fixup! feat: changed the logo properties to allow width/height specification

* Rework: add fields to logo object

* Fix

* More fixes

* Wrong width!

* No need for optional chaining

* Doc writeup

Co-authored-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Devtato 2021-11-01 11:09:30 +01:00 committed by GitHub
parent 895c848065
commit 41ef9daafd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 4 deletions

View file

@ -264,6 +264,8 @@ module.exports = {
logo: {
alt: 'Site Logo',
src: 'img/logo.svg',
width: 32,
height: 32,
},
items: [
{
@ -292,6 +294,8 @@ module.exports = {
logo: {
alt: 'Facebook Open Source Logo',
src: 'https://docusaurus.io/img/oss_logo.png',
width: 160,
height: 51,
},
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, // You can also put own HTML here
},

View file

@ -187,6 +187,8 @@ Accepted fields:
| `src` | `string` | **Required** | URL to the logo image. Base URL is appended by default. |
| `srcDark` | `string` | `logo.src` | An alternative image URL to use in dark mode. |
| `href` | `string` | `siteConfig.baseUrl` | Link to navigate to when the logo is clicked. |
| `width` | <code>string \| number</code> | `undefined` | Specifies the `width` attribute. |
| `height` | <code>string \| number</code> | `undefined` | Specifies the `height` attribute. |
| `target` | `string` | Calculated based on `href` (external links will open in a new tab, all others in the current one). | The `target` attribute of the link; controls whether the link is opened in a new tab, the current one, or otherwise. |
</small>
@ -205,6 +207,8 @@ module.exports = {
srcDark: 'img/logo_dark.svg',
href: 'https://docusaurus.io/',
target: '_self',
width: 32,
height: 32,
},
// highlight-end
},
@ -679,6 +683,8 @@ module.exports = {
alt: 'Facebook Open Source Logo',
src: 'img/oss_logo.png',
href: 'https://opensource.facebook.com',
width: 160,
height: 51,
},
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
},