Add modal links

This commit is contained in:
Fred Carlsen
2019-03-15 14:49:43 +01:00
committed by fabioberger
parent cbb40c1c2b
commit b97b6867d8
9 changed files with 101 additions and 17 deletions

View File

@@ -85,10 +85,23 @@ const communityLinks: CommunityLinkProps[] = [
},
];
export class NextCommunity extends React.Component {
interface Props {
location: Location;
}
export class NextCommunity extends React.Component<Props> {
public state = {
isContactModalOpen: false,
};
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap theme="light">

View File

@@ -12,17 +12,26 @@ import { SiteWrap } from 'ts/components/siteWrap';
import { Heading } from 'ts/components/text';
import { documentConstants } from 'ts/utils/document_meta_constants';
export interface CreditsProps {}
export interface CreditsProps {
location: Location;
}
export class Credits extends React.Component<CreditsProps> {
public state = {
isContactModalOpen: false,
};
constructor(props: CreditsProps) {
super(props);
}
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap theme="light">

View File

@@ -60,10 +60,23 @@ const extensionData: Extension[] = [
},
];
export class Extensions extends React.Component {
interface Props {
location: Location;
}
export class Extensions extends React.Component<Props> {
public state = {
isContactModalOpen: false,
};
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap theme="dark">

View File

@@ -28,7 +28,6 @@ interface LabelInterface {
}
interface State {
isContactModalOpen: boolean;
isVoteModalOpen: boolean;
isWalletConnected: boolean;
isVoteReceived: boolean;
@@ -50,7 +49,6 @@ const riskLabels: LabelInterface = {
export class Governance extends React.Component<RouteComponentProps<any>> {
public state: State = {
isContactModalOpen: false,
isVoteModalOpen: false,
isWalletConnected: false,
isVoteReceived: false,
@@ -154,7 +152,6 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
mainCta={{ text: 'Get ZRX', onClick: this._onLaunchInstantClick.bind(this) }}
secondaryCta={{ text: 'Vote', onClick: this._onOpenVoteModal.bind(this) }}
/>
<ModalContact isOpen={this.state.isContactModalOpen} onDismiss={this._onDismissContactModal} />
<ModalVote
zeipId={this._proposalData.zeipId}
isOpen={this.state.isVoteModalOpen}
@@ -177,10 +174,6 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
);
};
private readonly _onDismissContactModal = (): void => {
this.setState({ ...this.state, isContactModalOpen: false });
};
private readonly _onOpenVoteModal = (): void => {
this.setState({ ...this.state, isVoteModalOpen: true });
};

View File

@@ -74,6 +74,7 @@ const featuresData = [
];
interface Props {
location: Location;
theme: {
bgColor: string;
textColor: string;
@@ -85,6 +86,15 @@ export class Next0xInstant extends React.Component<Props> {
public state = {
isContactModalOpen: false,
};
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap>

View File

@@ -11,6 +11,7 @@ import { ModalContact } from 'ts/components/modals/modal_contact';
import { documentConstants } from 'ts/utils/document_meta_constants';
interface Props {
location: Location;
theme: {
bgColor: string;
textColor: string;
@@ -22,6 +23,15 @@ export class NextLanding extends React.Component<Props> {
public state = {
isContactModalOpen: false,
};
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap theme="dark">
@@ -34,7 +44,6 @@ export class NextLanding extends React.Component<Props> {
</SiteWrap>
);
}
public _onOpenContactModal = (): void => {
this.setState({ isContactModalOpen: true });
};

View File

@@ -68,10 +68,23 @@ const featuresList = [
],
];
export class NextLaunchKit extends React.Component {
interface Props {
location: Location;
}
export class NextLaunchKit extends React.Component<Props> {
public state = {
isContactModalOpen: false,
};
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap>

View File

@@ -20,7 +20,10 @@ interface OfferData {
description: string;
links?: Action[];
}
export interface NextMarketMakerProps {}
interface NextMarketMakerProps {
location: Location;
}
export class NextMarketMaker extends React.Component<NextMarketMakerProps> {
public state = {
@@ -64,7 +67,15 @@ export class NextMarketMaker extends React.Component<NextMarketMakerProps> {
},
];
}
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
return (
<SiteWrap theme="light">

View File

@@ -88,10 +88,23 @@ const useCaseSlides = [
configureAnchors({ offset: -60 });
export class NextWhy extends React.Component {
interface Props {
location: Location;
}
export class NextWhy extends React.Component<Props> {
public state = {
isContactModalOpen: false,
};
public componentDidMount(): void {
if ('URLSearchParams' in window) {
const urlParams = new URLSearchParams(this.props.location.search);
const modal = urlParams.get('modal');
if (modal) {
this.setState({ isContactModalOpen: true });
}
}
}
public render(): React.ReactNode {
const buildAction = (
<Button href="/docs" isWithArrow={true} isAccentColor={true}>