From b74957acdfc8d67d154bcb4698acd7575db7cc47 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 11 May 2018 17:38:51 +0200 Subject: Add missing type definitions --- packages/react-shared/src/components/anchor_title.tsx | 4 ++-- packages/react-shared/src/components/markdown_code_block.tsx | 4 ++-- packages/react-shared/src/components/markdown_link_block.tsx | 6 +++--- packages/react-shared/src/components/markdown_section.tsx | 4 ++-- packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 +- packages/react-shared/src/components/section_header.tsx | 4 ++-- packages/react-shared/src/components/version_drop_down.tsx | 6 +++--- packages/react-shared/src/utils/utils.ts | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index f44354097..89fde23cf 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -52,7 +52,7 @@ export class AnchorTitle extends React.Component ); } - 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 { // 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 ( {this.props.value} 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 { // 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{this.props.children}; } } - 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 ); } - 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 { 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 ); } - 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 { - public render() { + public render(): React.ReactNode { return (
); } - private _renderDropDownItems() { + private _renderDropDownItems(): React.ReactNode[] { const items = _.map(this.props.versions, version => { return ; }); 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( -- cgit v1.2.3 From 478f6ed011185b66ac87323c6d9ad1f598060760 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 14 May 2018 19:23:50 +0200 Subject: Move from using lerna multi-package commands to wsrun, update README's accordingly --- packages/react-shared/README.md | 18 +++--------------- packages/react-shared/package.json | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/README.md b/packages/react-shared/README.md index 0b4188180..88e6f18ae 100644 --- a/packages/react-shared/README.md +++ b/packages/react-shared/README.md @@ -38,28 +38,16 @@ yarn install ### Build -If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory: +To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: ```bash -yarn lerna:rebuild +PKG=@0xproject/react-shared yarn build ``` Or continuously rebuild on change: ```bash -yarn dev -``` - -You can also build this specific package by running the following from within its directory: - -```bash -yarn build -``` - -or continuously rebuild on change: - -```bash -yarn build:watch +PKG=@0xproject/react-shared yarn watch ``` ### Clean diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index b9a46376c..7d3eb186d 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -7,7 +7,7 @@ "scripts": { "lint": "tslint --project .", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", - "build:watch": "tsc -w", + "watch": "tsc -w", "clean": "shx rm -rf lib scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, -- cgit v1.2.3 From f86cc0dc7a5d75792b8ef7a38cbf9bba04cb6ab4 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 9 May 2018 13:29:43 -0700 Subject: Document Node.js version requirement and add it to package.json --- packages/react-shared/package.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'packages/react-shared') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index b9a46376c..1bc54f308 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,9 @@ { "name": "@0xproject/react-shared", "version": "0.1.6", + "engines": { + "node" : ">=8.0.0" + }, "description": "0x shared react components", "main": "lib/index.js", "types": "lib/index.d.ts", -- cgit v1.2.3 From fdeab0475c956c48ab79bb5238ae60e732b14e11 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Thu, 10 May 2018 11:46:02 -0700 Subject: Change minimum Node version to 6.12 --- packages/react-shared/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 1bc54f308..eba3504eb 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -2,7 +2,7 @@ "name": "@0xproject/react-shared", "version": "0.1.6", "engines": { - "node" : ">=8.0.0" + "node" : ">=6.12" }, "description": "0x shared react components", "main": "lib/index.js", -- cgit v1.2.3