Skip to content

Commit

Permalink
feat: added Edit this page button
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Sep 7, 2023
1 parent b39a6a4 commit 604acb7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
22 changes: 22 additions & 0 deletions www/src/components/PageEditBtn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import { Button } from '~paragon-react';

function PageEditBtn({ ...props }) {
const handlePageEditBtnClick = () => {
global.analytics.track('openedx.paragon.docs.page_edit.clicked');
// TODO: further development of the CTA will add functionality.
};

return (
<Button
size="sm"
variant="tertiary"
onClick={handlePageEditBtnClick}
{...props}
>
Edit this page
</Button>
);
}

export default PageEditBtn;
7 changes: 6 additions & 1 deletion www/src/templates/component-page-template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Alert,
breakpoints,
useMediaQuery,
Stack,
} from '~paragon-react';
import { SettingsContext } from '../context/SettingsContext';
import { DEFAULT_THEME } from '../../theme-config';
Expand All @@ -19,6 +20,7 @@ import SEO from '../components/SEO';
import LinkedHeading from '../components/LinkedHeading';
import ComponentsUsage from '../components/insights/ComponentsUsage';
import LeaveFeedback from '../components/LeaveFeedback';
import PageEditBtn from '../components/PageEditBtn';

export interface IPageTemplate {
data: {
Expand Down Expand Up @@ -139,7 +141,10 @@ export default function PageTemplate({
)}
<div className="d-flex justify-content-between align-items-start">
<h1 className="mb-4">{mdx.frontmatter.title}</h1>
<LeaveFeedback />
<Stack direction="horizontal" gap={3}>
<PageEditBtn />
<LeaveFeedback />
</Stack>
</div>
<MDXProvider components={shortcodes}>
<MDXRenderer>{mdx.body}</MDXRenderer>
Expand Down

0 comments on commit 604acb7

Please sign in to comment.