Adjusted the way we import react to match how it's done in the project.
This commit is contained in:
committed by
fabioberger
parent
b5e02d1b74
commit
086fa31d04
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'ts/style/colors';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled, { keyframes } from 'styled-components';
|
||||
|
||||
const scrollFactory = (height: number, imgRepeatCt: number) => keyframes`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import Headroom from 'react-headroom';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import styled, { css } from 'styled-components';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import styled from 'styled-components';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Button } from 'ts/components/button';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Heading } from 'ts/components/text';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Icon } from 'ts/components/icon';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import styled from 'styled-components';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { SearchInput } from 'ts/components/docs/search/search_input';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import { animateScroll } from 'react-scroll';
|
||||
import styled from 'styled-components';
|
||||
|
||||
@@ -8,10 +8,10 @@ import { colors } from 'ts/style/colors';
|
||||
import { fadeIn, fadeOut } from 'ts/style/keyframes';
|
||||
|
||||
export const ScrollTopArrow = () => {
|
||||
const [scrollY, setScrollY] = useState<number>(window.scrollY);
|
||||
const [scrollY, setScrollY] = React.useState<number>(window.scrollY);
|
||||
const isArrowVisible = scrollY > 100;
|
||||
|
||||
useEffect(
|
||||
React.useEffect(
|
||||
() => {
|
||||
const handleScroll = () => setScrollY(window.scrollY);
|
||||
window.addEventListener('scroll', debounce(handleScroll));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import styled, { ThemeProvider } from 'styled-components';
|
||||
|
||||
import { Header } from 'ts/components/docs/header/header';
|
||||
@@ -22,9 +22,9 @@ interface IMainProps {
|
||||
|
||||
export const SiteWrap: React.FC<ISiteWrapProps> = props => {
|
||||
const { children, theme = 'dark', isFullScreen } = props;
|
||||
const [isMobileNavOpen, setIsMobileNavOpen] = useState<boolean>(false);
|
||||
const [isMobileNavOpen, setIsMobileNavOpen] = React.useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
React.useEffect(() => {
|
||||
document.documentElement.style.overflowY = 'auto';
|
||||
window.scrollTo(0, 0);
|
||||
}, []);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||
import SyntaxHighlighter from 'react-syntax-highlighter';
|
||||
|
||||
@@ -15,7 +15,7 @@ interface ICodeProps {
|
||||
}
|
||||
|
||||
export const Code: React.FC<ICodeProps> = ({ children, className = 'language-typescript', canRun = false }) => {
|
||||
const [isCopied, setIsCopied] = useState<boolean>(false);
|
||||
const [isCopied, setIsCopied] = React.useState<boolean>(false);
|
||||
const copyButtonText = isCopied ? 'Copied!' : 'Copy';
|
||||
|
||||
// Passing in LANGUAGE to code in mdx results in classname 'language-<LANGUAGE>'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { Button } from 'ts/components/button';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import styled, { keyframes } from 'styled-components';
|
||||
|
||||
import { analytics } from 'ts/utils/analytics';
|
||||
@@ -16,7 +16,7 @@ interface IHelpfulCtaProps {
|
||||
}
|
||||
|
||||
export const HelpfulCta: React.FC<IHelpfulCtaProps> = ({ note, page, question }) => {
|
||||
const [isClicked, setIsClicked] = useState<boolean>(false);
|
||||
const [isClicked, setIsClicked] = React.useState<boolean>(false);
|
||||
|
||||
const vote = (yesno: string) => {
|
||||
analytics.track('was_this_helpful_feedback', { yesno, page });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { NewsletterForm } from 'ts/components/newsletter_form';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Heading, Paragraph } from 'ts/components/text';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'ts/style/colors';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { RatingBar } from 'ts/components/docs/resource/rating_bar';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'ts/style/colors';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'ts/style/colors';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import Autosuggest from 'react-autosuggest';
|
||||
import { connectAutoComplete, Highlight, Snippet } from 'react-instantsearch-dom';
|
||||
|
||||
@@ -38,9 +38,9 @@ interface IAutoCompleteProps {
|
||||
}
|
||||
|
||||
const CustomAutoComplete: React.FC<IAutoCompleteProps> = ({ isHome = false, hits = [], currentRefinement, refine }) => {
|
||||
const [value, setValue] = useState<string>('');
|
||||
const [value, setValue] = React.useState<string>('');
|
||||
|
||||
useEffect(() => {
|
||||
React.useEffect(() => {
|
||||
const handleEscapeKeyUp: any = (event: React.KeyboardEvent): void => {
|
||||
if (event.key === 'Escape') {
|
||||
setValue('');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Configure, Index, InstantSearch } from 'react-instantsearch-dom';
|
||||
|
||||
import { AutoComplete } from 'ts/components/docs/search/autocomplete';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'ts/style/colors';
|
||||
@@ -15,7 +15,7 @@ interface ICollapse {
|
||||
}
|
||||
|
||||
export const Collapse: React.FC<ICollapseProps> = props => {
|
||||
const [isActive, setIsActive] = useState<boolean>(true);
|
||||
const [isActive, setIsActive] = React.useState<boolean>(true);
|
||||
// @ts-ignore
|
||||
const [contentRef, { height }] = useDimensions();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'ts/style/colors';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { connectRefinementList } from 'react-instantsearch-dom';
|
||||
|
||||
import { Filter, IFilterProps } from 'ts/components/docs/sidebar/filter';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import styled from 'styled-components';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import MediaQuery from 'react-responsive';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as _ from 'lodash';
|
||||
import * as React from 'react';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import styled from 'styled-components';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { zIndex } from 'ts/style/z_index';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { Link } from '@0x/react-shared';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { fadeIn } from 'ts/style/keyframes';
|
||||
@@ -24,7 +24,7 @@ interface IArrowProps {
|
||||
}
|
||||
|
||||
export const NewsletterForm: React.FC<IFormProps> = ({ color }) => {
|
||||
const [isSubmitted, setIsSubmitted] = useState<boolean>(false);
|
||||
const [isSubmitted, setIsSubmitted] = React.useState<boolean>(false);
|
||||
const emailInput = React.createRef<HTMLInputElement>();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>): Promise<void> => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import styled, { ThemeProvider } from 'styled-components';
|
||||
|
||||
import { Footer } from 'ts/components/footer';
|
||||
@@ -20,9 +20,9 @@ interface IMainProps {
|
||||
|
||||
export const SiteWrap: React.FC<ISiteWrapProps> = props => {
|
||||
const { children, theme = 'dark', isFullScreen } = props;
|
||||
const [isMobileNavOpen, setIsMobileNavOpen] = useState<boolean>(false);
|
||||
const [isMobileNavOpen, setIsMobileNavOpen] = React.useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
React.useEffect(() => {
|
||||
document.documentElement.style.overflowY = 'auto';
|
||||
window.scrollTo(0, 0);
|
||||
}, []);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { Hits, InstantSearch } from 'react-instantsearch-dom';
|
||||
|
||||
import { Columns } from 'ts/components/docs/layout/columns';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { CommunityLinks } from 'ts/components/docs/home/community_links';
|
||||
import { MiddleSection } from 'ts/components/docs/home/middle_section';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import * as React from 'react';
|
||||
import { match } from 'react-router-dom';
|
||||
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
@@ -42,7 +42,7 @@ interface IDocsPageState {
|
||||
}
|
||||
|
||||
export const DocsPage: React.FC<IDocsPageProps> = ({ match }) => {
|
||||
const [state, setState] = useState<IDocsPageState>({
|
||||
const [state, setState] = React.useState<IDocsPageState>({
|
||||
Component: null,
|
||||
contents: [],
|
||||
title: '',
|
||||
@@ -54,7 +54,7 @@ export const DocsPage: React.FC<IDocsPageProps> = ({ match }) => {
|
||||
const isLoading = !Component && !wasNotFound;
|
||||
const { page, type } = match.params;
|
||||
|
||||
useEffect(
|
||||
React.useEffect(
|
||||
() => {
|
||||
void loadPageAsync(page, type);
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import { connectHits, InstantSearch } from 'react-instantsearch-dom';
|
||||
import styled from 'styled-components';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useCallback, useLayoutEffect } from 'react';
|
||||
import * as React from 'react';
|
||||
|
||||
interface DimensionObject {
|
||||
width: number;
|
||||
@@ -33,14 +33,14 @@ function getDimensionObject(node: HTMLElement): DimensionObject {
|
||||
}
|
||||
|
||||
export function useDimensions({ liveMeasure = true }: UseDimensionsArgs = {}): UseDimensionsHook {
|
||||
const [dimensions, setDimensions] = useState({});
|
||||
const [node, setNode] = useState(null);
|
||||
const [dimensions, setDimensions] = React.useState({});
|
||||
const [node, setNode] = React.useState(null);
|
||||
|
||||
const ref = useCallback(node => {
|
||||
const ref = React.useCallback(node => {
|
||||
setNode(node);
|
||||
}, []);
|
||||
|
||||
useLayoutEffect(
|
||||
React.useLayoutEffect(
|
||||
// @ts-ignore
|
||||
() => {
|
||||
if (node) {
|
||||
|
||||
Reference in New Issue
Block a user