-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: added the "Edit this page" button to components' pages (#2604)
* feat: added Edit this page button * feat: added logic for Edit page button * refactor: refactorng after review * refactor: moved link variable to file createPage.js * refactor: refactoring tablet view
- Loading branch information
1 parent
5c1fdef
commit b761187
Showing
13 changed files
with
113 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Button Group' | ||
title: 'ButtonGroup' | ||
type: 'component' | ||
components: | ||
- ButtonGroup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Table Filters' | ||
title: 'TableFilters' | ||
type: 'component' | ||
components: | ||
- TextFilter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Forms' | ||
title: 'Form' | ||
type: 'component' | ||
components: | ||
- Form | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Input Group' | ||
title: 'InputGroup' | ||
type: 'component' | ||
categories: | ||
- Forms | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Overlays' | ||
title: 'Overlay' | ||
type: 'component' | ||
components: | ||
- Overlay | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Page Banner' | ||
title: 'PageBanner' | ||
type: 'component' | ||
components: | ||
- PageBanner | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: 'Progress Bar' | ||
title: 'ProgressBar' | ||
type: 'component' | ||
components: | ||
- ProgressBar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { AnchorHTMLAttributes } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button, Hyperlink, Nav } from '~paragon-react'; | ||
|
||
export interface PageEditBtnProps extends Partial<AnchorHTMLAttributes<HTMLAnchorElement>> { | ||
githubEditPath: string, | ||
isNavLink?: boolean; | ||
} | ||
|
||
function PageEditBtn({ githubEditPath, isNavLink, ...props }: PageEditBtnProps) { | ||
const pageEditLinkTitle = 'Edit this page'; | ||
|
||
const handlePageEditBtnClick = () => { | ||
global.analytics.track('openedx.paragon.docs.page_edit.clicked'); | ||
}; | ||
|
||
if (isNavLink) { | ||
return ( | ||
<Nav.Link | ||
onClick={handlePageEditBtnClick} | ||
href={githubEditPath} | ||
target="_blank" | ||
{...props} | ||
> | ||
{pageEditLinkTitle} | ||
</Nav.Link> | ||
); | ||
} | ||
|
||
return ( | ||
<Button | ||
size="sm" | ||
as={Hyperlink} | ||
destination={githubEditPath} | ||
variant="tertiary" | ||
onClick={handlePageEditBtnClick} | ||
target="_blank" | ||
{...props} | ||
> | ||
{pageEditLinkTitle} | ||
</Button> | ||
); | ||
} | ||
|
||
PageEditBtn.propTypes = { | ||
githubEditPath: PropTypes.string.isRequired, | ||
isNavLink: PropTypes.bool, | ||
}; | ||
|
||
PageEditBtn.defaultProps = { | ||
isNavLink: false, | ||
}; | ||
|
||
export default PageEditBtn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters