-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added logic for Edit page button
- Loading branch information
1 parent
604acb7
commit cd7e49d
Showing
13 changed files
with
84 additions
and
31 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: 'Breadcrumbs' | ||
title: 'Breadcrumb' | ||
type: 'component' | ||
components: | ||
- Breadcrumb | ||
|
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 was deleted.
Oops, something went wrong.
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,35 @@ | ||
const BASE_PATH = 'https://github.com/openedx/paragon/edit/master/src'; | ||
|
||
const componentsNamesMap = { | ||
'AlertModal': 'Modal/alert-modal.mdx', | ||
'ButtonGroup': 'Button/button-group.mdx', | ||
'Data views': 'DataTable/dataviews.mdx', | ||
'Form.Autosuggest': 'Form/form-autosuggest.mdx', | ||
'Form.Checkbox': 'Form/form-checkbox.mdx', | ||
'Form.Control': 'Form/form-control.mdx', | ||
'Form.Control.Feedback': 'Form/form-control-feedback.mdx', | ||
'Form.Group': 'Form/form-group.mdx', | ||
'Form.Label': 'Form/form-label.mdx', | ||
'Form.Radio': 'Form/form-radio.mdx', | ||
'Form.Switch': 'Form/form-switch.mdx', | ||
'FullscreenModal': 'Modal/fullscreen-modal.mdx', | ||
'InputGroup': 'Form/input-group.mdx', | ||
'MarketingModal': 'Modal/marketing-modal.mdx', | ||
'ModalDialog': 'Modal/modal-dialog.mdx', | ||
'ModalLayer': 'Modal/modal-layer.mdx', | ||
'ModalPopup': 'Modal/modal-popup.mdx', | ||
'OverflowScroll': 'OverflowScroll/OverflowScroll.mdx', | ||
'SelectMenu': 'Menu/select-menu.md', | ||
'StandardModal': 'Modal/standard-modal.mdx', | ||
'TableControlBar': 'DataTable/tablecontrolbar.mdx', | ||
'TableFilters': 'DataTable/tablefilters.mdx', | ||
'TableFooter': 'DataTable/tablefooter.mdx', | ||
'useArrowKeyNavigation': 'hooks/useArrowKeyNavigation.mdx', | ||
'useIndexOfLastVisibleChild': 'hooks/useIndexOfLastVisibleChild.mdx', | ||
'useIsVisible': 'hooks/useIsVisible.mdx', | ||
'useOverflowScroll': 'OverflowScroll/useOverflowScroll.mdx', | ||
'useToggle': 'hooks/useToggle.mdx', | ||
'useWindowSize': 'hooks/useWindowSize.mdx', | ||
}; | ||
|
||
export { BASE_PATH, componentsNamesMap }; |
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,35 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button, Hyperlink } from '~paragon-react'; | ||
import { BASE_PATH, componentsNamesMap } from './constants'; | ||
|
||
function PageEditBtn({ componentTitle, ...props }) { | ||
const pageEditUrl = componentsNamesMap[componentTitle] | ||
? `${BASE_PATH}/${componentsNamesMap[componentTitle]}` | ||
: `${BASE_PATH}/${componentTitle}/README.md`; | ||
|
||
const handlePageEditBtnClick = () => { | ||
global.analytics.track('openedx.paragon.docs.page_edit.clicked'); | ||
}; | ||
|
||
return ( | ||
<Button | ||
size="sm" | ||
as={Hyperlink} | ||
destination={pageEditUrl} | ||
variant="tertiary" | ||
onClick={handlePageEditBtnClick} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
{...props} | ||
> | ||
Edit this page | ||
</Button> | ||
); | ||
} | ||
|
||
PageEditBtn.propTypes = { | ||
componentTitle: PropTypes.string.isRequired, | ||
}; | ||
|
||
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