mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 04:07:32 +02:00
* 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
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
import useThemeContext from '@theme/hooks/useThemeContext';
|
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
|
|
const useLogo = () => {
|
|
const {
|
|
siteConfig: {baseUrl, themeConfig: {navbar: {logo = {}} = {}}} = {},
|
|
} = useDocusaurusContext();
|
|
const {isDarkTheme} = useThemeContext();
|
|
const logoLink = logo.href || baseUrl;
|
|
let logoLinkProps = {};
|
|
|
|
if (logo.target) {
|
|
logoLinkProps = {target: logo.target};
|
|
} else if (!isInternalUrl(logoLink)) {
|
|
logoLinkProps = {
|
|
rel: 'noopener noreferrer',
|
|
target: '_blank',
|
|
};
|
|
}
|
|
|
|
const logoSrc = logo.srcDark && isDarkTheme ? logo.srcDark : logo.src;
|
|
const logoImageUrl = useBaseUrl(logoSrc);
|
|
|
|
return {
|
|
logoLink,
|
|
logoLinkProps,
|
|
logoImageUrl,
|
|
logoAlt: logo.alt,
|
|
};
|
|
};
|
|
|
|
export default useLogo;
|