aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-10-05 07:06:05 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-10-05 07:06:05 +0800
commite5153737d8386380675f28dd7cda70deeb1ea37c (patch)
tree81b061d2fa1af5952acc5abb41003f043ff8fce1 /packages/react-shared
parent88766a02c7e6688e72d5c4c69ce68028b322f154 (diff)
parentb04b649ec044b05f5c37bec214b7f992feb5998e (diff)
downloaddexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.tar
dexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.tar.gz
dexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.tar.bz2
dexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.tar.lz
dexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.tar.xz
dexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.tar.zst
dexon-sol-tools-e5153737d8386380675f28dd7cda70deeb1ea37c.zip
Merge branch 'development'
* development: (939 commits) Add asset-buyer to published packages section in README Publish Updated CHANGELOGS Update BuyQuote interface force re-build Add website build to instructions Revert format and re-add changes Build website in parallel with other tests since no other test relies on it being built to run Add back sourceMap support for both dev/prod Upgrade webpack Add missing default options Remove unused constants Add fee order with a takerFee Add additional order factory methods and refactor test to use them Add comments about buy quote calculation Update CHANGELOG Fix linter Add additional test for slippage Add buy_quote_calculator_test Add 0x Instant to bundle analysis ...
Diffstat (limited to 'packages/react-shared')
-rw-r--r--packages/react-shared/CHANGELOG.json81
-rw-r--r--packages/react-shared/CHANGELOG.md36
-rw-r--r--packages/react-shared/package.json34
-rw-r--r--packages/react-shared/src/components/anchor_title.tsx3
-rw-r--r--packages/react-shared/src/components/markdown_section.tsx2
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx21
-rw-r--r--packages/react-shared/src/components/version_drop_down.tsx22
-rw-r--r--packages/react-shared/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/react-shared/src/utils/utils.ts4
-rw-r--r--packages/react-shared/tsconfig.json5
10 files changed, 159 insertions, 57 deletions
diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json
index 1268bcc7b..d1907e785 100644
--- a/packages/react-shared/CHANGELOG.json
+++ b/packages/react-shared/CHANGELOG.json
@@ -1,5 +1,86 @@
[
{
+ "timestamp": 1538693146,
+ "version": "1.0.15",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1538475601,
+ "version": "1.0.14",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1538157789,
+ "version": "1.0.13",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1537907159,
+ "version": "1.0.12",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1537875740,
+ "version": "1.0.11",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1537541580,
+ "version": "1.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1536142250,
+ "version": "1.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1535377027,
+ "version": "1.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1535133899,
+ "version": "1.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1534210131,
"version": "1.0.6",
"changes": [
diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md
index cfbaf6c70..20d3e0bf7 100644
--- a/packages/react-shared/CHANGELOG.md
+++ b/packages/react-shared/CHANGELOG.md
@@ -5,6 +5,42 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.15 - _October 4, 2018_
+
+ * Dependencies updated
+
+## v1.0.14 - _October 2, 2018_
+
+ * Dependencies updated
+
+## v1.0.13 - _September 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.12 - _September 25, 2018_
+
+ * Dependencies updated
+
+## v1.0.11 - _September 25, 2018_
+
+ * Dependencies updated
+
+## v1.0.10 - _September 21, 2018_
+
+ * Dependencies updated
+
+## v1.0.9 - _September 5, 2018_
+
+ * Dependencies updated
+
+## v1.0.8 - _August 27, 2018_
+
+ * Dependencies updated
+
+## v1.0.7 - _August 24, 2018_
+
+ * Dependencies updated
+
## v1.0.6 - _August 13, 2018_
* Dependencies updated
diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json
index 9761c246e..5080c8b2c 100644
--- a/packages/react-shared/package.json
+++ b/packages/react-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/react-shared",
- "version": "1.0.6",
+ "version": "1.0.15",
"engines": {
"node": ">=6.12"
},
@@ -9,10 +9,10 @@
"types": "lib/index.d.ts",
"scripts": {
"lint": "tslint --project .",
- "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
+ "build": "tsc",
+ "build:ci": "yarn build",
"watch_without_deps": "tsc -w",
- "clean": "shx rm -rf lib scripts",
- "manual:postpublish": "yarn build; node ./scripts/postpublish.js"
+ "clean": "shx rm -rf lib"
},
"author": "Fabio Berger",
"license": "Apache-2.0",
@@ -25,33 +25,33 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0xproject/dev-utils": "^1.0.4",
- "@0xproject/monorepo-scripts": "^1.0.5",
- "@0xproject/tslint-config": "^1.0.5",
- "copyfiles": "^1.2.0",
+ "@0xproject/dev-utils": "^1.0.12",
+ "@0xproject/tslint-config": "^1.0.8",
+ "copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "^5.9.1",
- "typescript": "2.9.2"
+ "typescript": "3.0.1"
},
"dependencies": {
+ "@material-ui/core": "^3.0.1",
"@types/is-mobile": "0.3.0",
"@types/lodash": "4.14.104",
"@types/material-ui": "0.18.0",
- "@types/node": "^8.0.53",
+ "@types/node": "*",
"@types/react": "*",
"@types/react-dom": "*",
- "@types/react-scroll": "0.0.31",
+ "@types/react-scroll": "1.5.3",
"basscss": "^8.0.3",
+ "change-case": "^3.0.2",
"is-mobile": "^0.2.2",
"lodash": "^4.17.5",
- "material-ui": "^0.17.1",
- "react": "15.6.1",
- "react-dom": "15.6.1",
- "react-highlight": "0xproject/react-highlight",
+ "material-ui": "^0.20.0",
+ "react": "^16.4.2",
+ "react-dom": "^16.4.2",
+ "react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162",
"react-markdown": "^3.2.2",
- "react-scroll": "^1.5.2",
- "react-tap-event-plugin": "^2.0.1"
+ "react-scroll": "0xproject/react-scroll#similar-to-pr-330"
},
"publishConfig": {
"access": "public"
diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx
index 473b994bf..8f7e4af27 100644
--- a/packages/react-shared/src/components/anchor_title.tsx
+++ b/packages/react-shared/src/components/anchor_title.tsx
@@ -3,7 +3,6 @@ import { Link as ScrollLink } from 'react-scroll';
import { HeaderSizes, Styles } from '../types';
import { constants } from '../utils/constants';
-import { utils } from '../utils/utils';
const headerSizeToScrollOffset: { [headerSize: string]: number } = {
h2: -20,
@@ -69,13 +68,13 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt
</div>
<ScrollLink
to={this.props.id}
+ hashSpy={true}
offset={headerSizeToScrollOffset[this.props.headerSize]}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
>
<i
className="zmdi zmdi-link"
- onClick={utils.setUrlHash.bind(utils, this.props.id)}
style={{ ...styles.anchor, opacity }}
onMouseOver={this._setHoverState.bind(this, true)}
onMouseOut={this._setHoverState.bind(this, false)}
diff --git a/packages/react-shared/src/components/markdown_section.tsx b/packages/react-shared/src/components/markdown_section.tsx
index 3b65b3075..09b214548 100644
--- a/packages/react-shared/src/components/markdown_section.tsx
+++ b/packages/react-shared/src/components/markdown_section.tsx
@@ -42,7 +42,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 = utils.convertDashesToSpaces(sectionName);
+ const finalSectionName = utils.convertCamelCaseToSpaces(sectionName);
return (
<div
className="md-px1 sm-px2 overflow-hidden"
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index aa00d5985..c8bddb59a 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -45,7 +45,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
};
public render(): React.ReactNode {
const navigation = _.map(this.props.topLevelMenu, (menuItems: string[], sectionName: string) => {
- const finalSectionName = utils.convertDashesToSpaces(sectionName);
+ const finalSectionName = utils.convertCamelCaseToSpaces(sectionName);
if (this.props.shouldDisplaySectionHeaders) {
// tslint:disable-next-line:no-unused-variable
const id = utils.getIdFromName(sectionName);
@@ -93,15 +93,12 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
<ScrollLink
key={`menuItem-${menuItemName}`}
to={id}
- offset={-10}
+ offset={0}
+ hashSpy={true}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
>
- <MenuItem
- onTouchTap={this._onMenuItemClick.bind(this, finalMenuItemName)}
- style={menuItemStyles}
- innerDivStyle={menuItemInnerDivStyles}
- >
+ <MenuItem style={menuItemStyles} innerDivStyle={menuItemInnerDivStyles}>
<span style={{ textTransform: 'capitalize' }}>{finalMenuItemName}</span>
</MenuItem>
</ScrollLink>
@@ -128,12 +125,11 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
<ScrollLink
to={id}
offset={0}
+ hashSpy={true}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
- onTouchTap={this._onMenuItemClick.bind(this, name)}
>
<MenuItem
- onTouchTap={this._onMenuItemClick.bind(this, name)}
style={{ minHeight: 35 }}
innerDivStyle={{
paddingLeft: 16,
@@ -150,11 +146,4 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
</ul>
);
}
- private _onMenuItemClick(name: string): void {
- const id = utils.getIdFromName(name);
- utils.setUrlHash(id);
- if (!_.isUndefined(this.props.onMenuItemClick)) {
- this.props.onMenuItemClick();
- }
- }
}
diff --git a/packages/react-shared/src/components/version_drop_down.tsx b/packages/react-shared/src/components/version_drop_down.tsx
index e41590957..5ff4bed54 100644
--- a/packages/react-shared/src/components/version_drop_down.tsx
+++ b/packages/react-shared/src/components/version_drop_down.tsx
@@ -1,6 +1,6 @@
+import MenuItem from '@material-ui/core/MenuItem';
+import Select from '@material-ui/core/Select';
import * as _ from 'lodash';
-import DropDownMenu from 'material-ui/DropDownMenu';
-import MenuItem from 'material-ui/MenuItem';
import * as React from 'react';
export interface VersionDropDownProps {
@@ -15,23 +15,23 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi
public render(): React.ReactNode {
return (
<div className="mx-auto" style={{ width: 120 }}>
- <DropDownMenu
- maxHeight={300}
- value={this.props.selectedVersion}
- onChange={this._updateSelectedVersion.bind(this)}
- >
+ <Select value={this.props.selectedVersion} onChange={this._updateSelectedVersion.bind(this)}>
{this._renderDropDownItems()}
- </DropDownMenu>
+ </Select>
</div>
);
}
private _renderDropDownItems(): React.ReactNode[] {
const items = _.map(this.props.versions, version => {
- return <MenuItem key={version} value={version} primaryText={`v${version}`} />;
+ return (
+ <MenuItem key={version} value={version}>
+ v{version}
+ </MenuItem>
+ );
});
return items;
}
- private _updateSelectedVersion(_e: any, _index: number, semver: string): void {
- this.props.onVersionSelected(semver);
+ private _updateSelectedVersion(event: React.ChangeEvent<HTMLSelectElement>): void {
+ this.props.onVersionSelected(event.target.value);
}
}
diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts
deleted file mode 100644
index dcb99d0f7..000000000
--- a/packages/react-shared/src/monorepo_scripts/postpublish.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts
index 93c7e9f7b..142aea85d 100644
--- a/packages/react-shared/src/utils/utils.ts
+++ b/packages/react-shared/src/utils/utils.ts
@@ -1,3 +1,4 @@
+import changeCase = require('change-case');
import isMobile = require('is-mobile');
import * as _ from 'lodash';
import { scroller } from 'react-scroll';
@@ -33,6 +34,9 @@ export const utils = {
convertDashesToSpaces(text: string): string {
return text.replace(/-/g, ' ');
},
+ convertCamelCaseToSpaces(text: string): string {
+ return changeCase.snake(text).replace(/_/g, ' ');
+ },
getEtherScanLinkIfExists(
addressOrTxHash: string,
networkId: number,
diff --git a/packages/react-shared/tsconfig.json b/packages/react-shared/tsconfig.json
index 687bd1f4e..5abe0ab4e 100644
--- a/packages/react-shared/tsconfig.json
+++ b/packages/react-shared/tsconfig.json
@@ -1,9 +1,10 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./lib/",
+ "outDir": "lib",
+ "rootDir": "src",
"jsx": "react",
- "baseUrl": "./",
+ "baseUrl": ".",
"paths": {
"*": ["node_modules/@types/*", "*"]
}