docs: 🐛 css enhancement + add gtag
Signed-off-by: slumbering <slumbering.pierrot@gmail.com>
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import Link from '@docusaurus/Link';
|
||||
import Translate, {translate} from '@docusaurus/Translate';
|
||||
import Translate, { translate } from '@docusaurus/Translate';
|
||||
import DocPaginatorPrev from "./Dagger_Icons_Arrow-previous.svg"
|
||||
import DocPaginatorNext from "./Dagger_Icons_Arrow-next.svg"
|
||||
|
||||
function DocPaginator(props) {
|
||||
const {metadata} = props;
|
||||
const { metadata } = props;
|
||||
return (
|
||||
<nav
|
||||
className="pagination-nav"
|
||||
@@ -33,7 +33,7 @@ function DocPaginator(props) {
|
||||
</Translate>
|
||||
</div>
|
||||
<div className="pagination-nav__label">
|
||||
<DocPaginatorPrev height={23}/>{metadata.previous.title}
|
||||
<DocPaginatorPrev height={23} style={{ marginRight: '0.5rem' }} />{metadata.previous.title}
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
@@ -49,7 +49,7 @@ function DocPaginator(props) {
|
||||
</Translate>
|
||||
</div>
|
||||
<div className="pagination-nav__label">
|
||||
{metadata.next.title}<DocPaginatorNext height={23}/>
|
||||
{metadata.next.title}<DocPaginatorNext height={23} style={{ marginLeft: '0.5rem' }} />
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
22
website/src/theme/EditThisPage/index.js
Normal file
22
website/src/theme/EditThisPage/index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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 React from 'react';
|
||||
import Translate from '@docusaurus/Translate';
|
||||
import IconEdit from '../../../static/img/Dagger_Icons_Edit.svg';
|
||||
|
||||
export default function EditThisPage({ editUrl }) {
|
||||
return (
|
||||
<a href={editUrl} className='edit-this-page' target="_blank" rel="noreferrer noopener">
|
||||
<IconEdit width='1.2em' height='1.2em' />
|
||||
<Translate
|
||||
id="theme.common.editThisPage"
|
||||
description="The link label to edit the current page">
|
||||
Edit this page
|
||||
</Translate>
|
||||
</a>
|
||||
);
|
||||
}
|
4
website/src/theme/Heading/anchor.svg
Normal file
4
website/src/theme/Heading/anchor.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.6 KiB |
52
website/src/theme/Heading/index.js
Normal file
52
website/src/theme/Heading/index.js
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* eslint-disable jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
import {useThemeConfig} from '@docusaurus/theme-common';
|
||||
import './styles.css';
|
||||
import styles from './styles.module.css';
|
||||
import AnchorIcon from "./anchor.svg"
|
||||
|
||||
const Heading = (Tag) =>
|
||||
function TargetComponent({id, ...props}) {
|
||||
const {
|
||||
navbar: {hideOnScroll},
|
||||
} = useThemeConfig();
|
||||
|
||||
if (!id) {
|
||||
return <Tag {...props} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tag {...props}>
|
||||
<a
|
||||
aria-hidden="true"
|
||||
tabIndex={-1}
|
||||
className={clsx('anchor', {
|
||||
[styles.enhancedAnchor]: !hideOnScroll,
|
||||
})}
|
||||
id={id}
|
||||
/>
|
||||
{props.children}
|
||||
<a
|
||||
className="hash-link"
|
||||
href={`#${id}`}
|
||||
title={translate({
|
||||
id: 'theme.common.headingLinkTitle',
|
||||
message: 'Direct link to heading',
|
||||
description: 'Title for link to heading',
|
||||
})}>
|
||||
<AnchorIcon />
|
||||
</a>
|
||||
</Tag>
|
||||
);
|
||||
};
|
||||
|
||||
export default Heading;
|
23
website/src/theme/Heading/styles.css
Normal file
23
website/src/theme/Heading/styles.css
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
.anchor {
|
||||
display: block;
|
||||
position: relative;
|
||||
top: -0.5rem;
|
||||
}
|
||||
|
||||
.hash-link {
|
||||
opacity: 0;
|
||||
padding-left: 0.5rem;
|
||||
transition: opacity var(--ifm-transition-fast);
|
||||
}
|
||||
|
||||
.hash-link:focus,
|
||||
*:hover > .hash-link {
|
||||
opacity: 1;
|
||||
}
|
10
website/src/theme/Heading/styles.module.css
Normal file
10
website/src/theme/Heading/styles.module.css
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
.enhancedAnchor {
|
||||
top: calc(var(--ifm-navbar-height) * -1 - 0.5rem);
|
||||
}
|
Reference in New Issue
Block a user