aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-22 02:04:27 +0800
committerFabio Berger <me@fabioberger.com>2018-03-22 02:04:27 +0800
commit18d3e5458a31e7d2368e506e8cf14f190e19b7ff (patch)
tree6347f95dfad80d8d26e5822861b4612ea1bdc02e /packages/react-shared/src
parentac25764d12711172aa6221c6d4ff3faa732997a6 (diff)
downloaddexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.tar
dexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.tar.gz
dexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.tar.bz2
dexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.tar.lz
dexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.tar.xz
dexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.tar.zst
dexon-sol-tools-18d3e5458a31e7d2368e506e8cf14f190e19b7ff.zip
Fix sectionName and menuItemName to display with spaces rather then dashes
Diffstat (limited to 'packages/react-shared/src')
-rw-r--r--packages/react-shared/src/components/markdown_section.tsx3
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx5
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/react-shared/src/components/markdown_section.tsx b/packages/react-shared/src/components/markdown_section.tsx
index d24a43dcb..e895afd2a 100644
--- a/packages/react-shared/src/components/markdown_section.tsx
+++ b/packages/react-shared/src/components/markdown_section.tsx
@@ -43,6 +43,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
const { sectionName, markdownContent, headerSize, githubLink } = this.props as PropsWithDefaults;
const id = utils.getIdFromName(sectionName);
+ const finalSectionName = sectionName.replace(/-/g, ' ');
return (
<div
className="md-px1 sm-px2 overflow-hidden"
@@ -55,7 +56,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
<span style={{ textTransform: 'capitalize', color: colors.grey700 }}>
<AnchorTitle
headerSize={headerSize}
- title={sectionName}
+ title={finalSectionName}
id={id}
shouldShowAnchor={this.state.shouldShowAnchor}
/>
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index c4c87401a..d81bd3c3d 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -85,6 +85,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
: styles.menuItemWithoutHeaders;
const menuItemInnerDivStyles = this.props.shouldDisplaySectionHeaders ? styles.menuItemInnerDivWithHeaders : {};
const menuItems = _.map(menuItemNames, menuItemName => {
+ const finalMenuItemName = menuItemName.replace(/-/g, ' ');
const id = utils.getIdFromName(menuItemName);
return (
<div key={menuItemName}>
@@ -96,11 +97,11 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
containerId={constants.DOCS_CONTAINER_ID}
>
<MenuItem
- onTouchTap={this._onMenuItemClick.bind(this, menuItemName)}
+ onTouchTap={this._onMenuItemClick.bind(this, finalMenuItemName)}
style={menuItemStyles}
innerDivStyle={menuItemInnerDivStyles}
>
- <span style={{ textTransform: 'capitalize' }}>{menuItemName}</span>
+ <span style={{ textTransform: 'capitalize' }}>{finalMenuItemName}</span>
</MenuItem>
</ScrollLink>
{this._renderMenuItemSubsections(menuItemName)}