Skip to content

Commit

Permalink
Docusaurus: edit EditThisPage component (#5835)
Browse files Browse the repository at this point in the history
* edit EditThisPage component

* update styling of edit this on github link

---------

Co-authored-by: Prisma <[email protected]>
  • Loading branch information
jharrell and carlagn committed Apr 10, 2024
1 parent 63e1039 commit c593403
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/theme/EditThisPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import Translate from '@docusaurus/Translate';
import { ThemeClassNames } from '@docusaurus/theme-common';
import Link from '@docusaurus/Link';
import type { Props } from '@theme/EditThisPage';
import styles from './styles.module.scss'
import clsx from 'clsx';

export default function EditThisPage({ editUrl }: Props): JSX.Element {
return (
<Link to={editUrl} className={clsx(ThemeClassNames.common.editThisPage, 'edit-git', styles.editLink)}>
<Translate
id="theme.common.editThisPage"
description="The link label to edit the current page">
Edit this page on GitHub
</Translate>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" style={{paddingLeft: `3px`}}>
<path fill="currentColor" d="M6 1h5v5L8.86 3.85 4.7 8 4 7.3l4.15-4.16zM2 3h2v1H2v6h6V8h1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1"/>
</svg>
</Link>
);
}
18 changes: 18 additions & 0 deletions src/theme/EditThisPage/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.editLink {
font-size: 0.875rem;
display: flex;
align-items: center;
color: var(--gray-600) !important;
text-decoration: underline;
&:hover {
text-decoration: underline;
color: var(--gray-800) !important;
}
}
:root[data-theme='dark'] {
.editLink {
&:hover {
color: var(--gray-400) !important;
}
}
}

0 comments on commit c593403

Please sign in to comment.