Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BD-46] feat: added the "Edit this page" button #2604

Merged
merged 5 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided not to use ButtonGroup, since the buttons are not displayed very well visually

<PageEditBtn />
<LeaveFeedback />
</Stack>
</div>
<MDXProvider components={shortcodes}>
<MDXRenderer>{mdx.body}</MDXRenderer>
Expand Down
Loading