aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-16 22:18:47 +0800
committerFabio Berger <me@fabioberger.com>2018-05-16 22:18:47 +0800
commit78623ae3bdba39b629a22aa2d15d8aee5e6225ab (patch)
treef44871dc1b081669c83cf041cebe559ecb57bace /packages/react-shared/src
parent136c6d01b3f01e6db8aab01c4b4b7315abadba24 (diff)
parent4de6221825447e77d7b1ee6bab28ce3407939301 (diff)
downloaddexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar
dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.gz
dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.bz2
dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.lz
dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.xz
dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.zst
dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.zip
Merge branch 'development' into v2-prototype
* development: (29 commits) Do not remove artifacts when running `clean` fix style errors Fix circular dependency Add my profile image to images Add myself to about page Add dogfood configs to website Revert to lerna:run lint Do lint sequentially Exclude monorepo-scripts from tslint as test Fix prettier Add hover state to top tokens Change to weekly txn volume Change minimum Node version to 6.12 Document Node.js version requirement and add it to package.json Apply prettier to some files which were not formatted correctly Fix TSLint issues Fix TSLint issues Update ethereeumjs-testrpc to ganache-cli Fix infinite loop Add changelog entries for packages where executable binary exporting fixed ... # Conflicts: # packages/contracts/package.json # packages/contracts/util/formatters.ts # packages/contracts/util/signed_order_utils.ts # packages/migrations/package.json # yarn.lock
Diffstat (limited to 'packages/react-shared/src')
-rw-r--r--packages/react-shared/src/components/anchor_title.tsx4
-rw-r--r--packages/react-shared/src/components/markdown_code_block.tsx4
-rw-r--r--packages/react-shared/src/components/markdown_link_block.tsx6
-rw-r--r--packages/react-shared/src/components/markdown_section.tsx4
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx2
-rw-r--r--packages/react-shared/src/components/section_header.tsx4
-rw-r--r--packages/react-shared/src/components/version_drop_down.tsx6
-rw-r--r--packages/react-shared/src/utils/utils.ts6
8 files changed, 18 insertions, 18 deletions
diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx
index 6e648739d..473b994bf 100644
--- a/packages/react-shared/src/components/anchor_title.tsx
+++ b/packages/react-shared/src/components/anchor_title.tsx
@@ -46,7 +46,7 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt
isHovering: false,
};
}
- public render() {
+ public render(): React.ReactNode {
let opacity = 0;
if (this.props.shouldShowAnchor) {
opacity = this.state.isHovering ? 0.6 : 1;
@@ -84,7 +84,7 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt
</div>
);
}
- private _setHoverState(isHovering: boolean) {
+ private _setHoverState(isHovering: boolean): void {
this.setState({
isHovering,
});
diff --git a/packages/react-shared/src/components/markdown_code_block.tsx b/packages/react-shared/src/components/markdown_code_block.tsx
index 2070bb8e1..49b2ff526 100644
--- a/packages/react-shared/src/components/markdown_code_block.tsx
+++ b/packages/react-shared/src/components/markdown_code_block.tsx
@@ -12,10 +12,10 @@ export interface MarkdownCodeBlockState {}
export class MarkdownCodeBlock extends React.Component<MarkdownCodeBlockProps, MarkdownCodeBlockState> {
// Re-rendering a codeblock causes any use selection to become de-selected. This is annoying when trying
// to copy-paste code examples. We therefore noop re-renders on this component if it's props haven't changed.
- public shouldComponentUpdate(nextProps: MarkdownCodeBlockProps, nextState: MarkdownCodeBlockState) {
+ public shouldComponentUpdate(nextProps: MarkdownCodeBlockProps, nextState: MarkdownCodeBlockState): boolean {
return nextProps.value !== this.props.value || nextProps.language !== this.props.language;
}
- public render() {
+ public render(): React.ReactNode {
return (
<span style={{ fontSize: 14 }}>
<HighLight className={this.props.language || 'javascript'}>{this.props.value}</HighLight>
diff --git a/packages/react-shared/src/components/markdown_link_block.tsx b/packages/react-shared/src/components/markdown_link_block.tsx
index 8f5862249..0b489b749 100644
--- a/packages/react-shared/src/components/markdown_link_block.tsx
+++ b/packages/react-shared/src/components/markdown_link_block.tsx
@@ -13,10 +13,10 @@ export interface MarkdownLinkBlockState {}
export class MarkdownLinkBlock extends React.Component<MarkdownLinkBlockProps, MarkdownLinkBlockState> {
// Re-rendering a linkBlock causes it to remain unclickable.
// We therefore noop re-renders on this component if it's props haven't changed.
- public shouldComponentUpdate(nextProps: MarkdownLinkBlockProps, nextState: MarkdownLinkBlockState) {
+ public shouldComponentUpdate(nextProps: MarkdownLinkBlockProps, nextState: MarkdownLinkBlockState): boolean {
return nextProps.href !== this.props.href;
}
- public render() {
+ public render(): React.ReactNode {
const href = this.props.href;
const isLinkToSection = _.startsWith(href, '#');
// If protocol is http or https, we can open in a new tab, otherwise don't for security reasons
@@ -39,7 +39,7 @@ export class MarkdownLinkBlock extends React.Component<MarkdownLinkBlockProps, M
return <a href={href}>{this.props.children}</a>;
}
}
- private _onHashUrlClick(href: string) {
+ private _onHashUrlClick(href: string): void {
const hash = href.split('#')[1];
utils.scrollToHash(hash, constants.SCROLL_CONTAINER_ID);
utils.setUrlHash(hash);
diff --git a/packages/react-shared/src/components/markdown_section.tsx b/packages/react-shared/src/components/markdown_section.tsx
index 449e8a045..b0761cd21 100644
--- a/packages/react-shared/src/components/markdown_section.tsx
+++ b/packages/react-shared/src/components/markdown_section.tsx
@@ -39,7 +39,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
shouldShowAnchor: false,
};
}
- public render() {
+ public render(): React.ReactNode {
const { sectionName, markdownContent, headerSize, githubLink } = this.props as PropsWithDefaults;
const id = utils.getIdFromName(sectionName);
@@ -87,7 +87,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
</div>
);
}
- private _setAnchorVisibility(shouldShowAnchor: boolean) {
+ private _setAnchorVisibility(shouldShowAnchor: boolean): void {
this.setState({
shouldShowAnchor,
});
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index f49d6fcf7..804398d71 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -43,7 +43,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
shouldDisplaySectionHeaders: true,
onMenuItemClick: _.noop,
};
- public render() {
+ public render(): React.ReactNode {
const navigation = _.map(this.props.topLevelMenu, (menuItems: string[], sectionName: string) => {
const finalSectionName = utils.convertDashesToSpaces(sectionName);
if (this.props.shouldDisplaySectionHeaders) {
diff --git a/packages/react-shared/src/components/section_header.tsx b/packages/react-shared/src/components/section_header.tsx
index 0224c2127..9bbec7747 100644
--- a/packages/react-shared/src/components/section_header.tsx
+++ b/packages/react-shared/src/components/section_header.tsx
@@ -32,7 +32,7 @@ export class SectionHeader extends React.Component<SectionHeaderProps, SectionHe
shouldShowAnchor: false,
};
}
- public render() {
+ public render(): React.ReactNode {
const { sectionName, headerSize } = this.props as PropsWithDefaults;
const finalSectionName = utils.convertDashesToSpaces(this.props.sectionName);
@@ -65,7 +65,7 @@ export class SectionHeader extends React.Component<SectionHeaderProps, SectionHe
</div>
);
}
- private _setAnchorVisibility(shouldShowAnchor: boolean) {
+ private _setAnchorVisibility(shouldShowAnchor: boolean): void {
this.setState({
shouldShowAnchor,
});
diff --git a/packages/react-shared/src/components/version_drop_down.tsx b/packages/react-shared/src/components/version_drop_down.tsx
index d9e49b205..926dd6a7a 100644
--- a/packages/react-shared/src/components/version_drop_down.tsx
+++ b/packages/react-shared/src/components/version_drop_down.tsx
@@ -14,7 +14,7 @@ export interface VersionDropDownProps {
export interface VersionDropDownState {}
export class VersionDropDown extends React.Component<VersionDropDownProps, VersionDropDownState> {
- public render() {
+ public render(): React.ReactNode {
return (
<div className="mx-auto" style={{ width: 120 }}>
<DropDownMenu
@@ -27,13 +27,13 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi
</div>
);
}
- private _renderDropDownItems() {
+ private _renderDropDownItems(): React.ReactNode[] {
const items = _.map(this.props.versions, version => {
return <MenuItem key={version} value={version} primaryText={`v${version}`} />;
});
return items;
}
- private _updateSelectedVersion(e: any, index: number, semver: string) {
+ private _updateSelectedVersion(e: any, index: number, semver: string): void {
this.props.onVersionSelected(semver);
}
}
diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts
index 1538dd087..93c7e9f7b 100644
--- a/packages/react-shared/src/utils/utils.ts
+++ b/packages/react-shared/src/utils/utils.ts
@@ -7,7 +7,7 @@ import { EtherscanLinkSuffixes, Networks } from '../types';
import { constants } from './constants';
export const utils = {
- setUrlHash(anchorId: string) {
+ setUrlHash(anchorId: string): void {
window.location.hash = anchorId;
},
scrollToHash(hash: string, containerId: string): void {
@@ -26,11 +26,11 @@ export const utils = {
const isUserOnMobile = isMobile();
return isUserOnMobile;
},
- getIdFromName(name: string) {
+ getIdFromName(name: string): string {
const id = name.replace(/ /g, '-');
return id;
},
- convertDashesToSpaces(text: string) {
+ convertDashesToSpaces(text: string): string {
return text.replace(/-/g, ' ');
},
getEtherScanLinkIfExists(