@apify/docs-theme 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import Link from '@docusaurus/Link';
3
+ import useBaseUrl from '@docusaurus/useBaseUrl';
4
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
5
+ import { useThemeConfig } from '@docusaurus/theme-common';
6
+ import ThemedImage from '@theme/ThemedImage';
7
+
8
+ function LogoThemedImage({ logo, alt, imageClassName }) {
9
+ const sources = {
10
+ light: useBaseUrl(logo.src),
11
+ dark: useBaseUrl(logo.srcDark || logo.src),
12
+ };
13
+ const themedImage = (
14
+ <ThemedImage
15
+ className={logo.className}
16
+ sources={sources}
17
+ height={logo.height}
18
+ width={logo.width}
19
+ alt={alt}
20
+ style={logo.style}
21
+ />
22
+ );
23
+ // Is this extra div really necessary?
24
+ // introduced in https://github.com/facebook/docusaurus/pull/5666
25
+ return imageClassName ? (
26
+ <div className={imageClassName}>{themedImage}</div>
27
+ ) : (
28
+ themedImage
29
+ );
30
+ }
31
+ export default function Logo(props) {
32
+ const {
33
+ siteConfig: { title },
34
+ } = useDocusaurusContext();
35
+ const {
36
+ navbar: { title: navbarTitle, logo },
37
+ } = useThemeConfig();
38
+ const { imageClassName, titleClassName, ...propsRest } = props;
39
+ const logoLink = useBaseUrl(logo?.href || '/');
40
+ // If visible title is shown, fallback alt text should be
41
+ // an empty string to mark the logo as decorative.
42
+ const fallbackAlt = navbarTitle ? '' : title;
43
+ // Use logo alt text if provided (including empty string),
44
+ // and provide a sensible fallback otherwise.
45
+ const alt = logo?.alt ?? fallbackAlt;
46
+ return (
47
+ <Link
48
+ to={logoLink}
49
+ {...propsRest}
50
+ {...(logo?.target && { target: logo.target })}>
51
+ {logo && (
52
+ <LogoThemedImage
53
+ logo={logo}
54
+ alt={alt}
55
+ imageClassName={imageClassName}
56
+ />
57
+ )}
58
+ {!logo ? <b className={titleClassName}>{navbarTitle}</b> : null}
59
+ </Link>
60
+ );
61
+ }
@@ -361,6 +361,11 @@ html.plugin-docs .theme-doc-markdown {
361
361
  line-height: 32px;
362
362
  }
363
363
 
364
+ html.plugin-docs .theme-doc-markdown img {
365
+ display: block;
366
+ margin: 0 auto;
367
+ }
368
+
364
369
  html.plugin-docs .theme-doc-markdown h1 {
365
370
  font-weight: 600;
366
371
  font-size: 48px;