Rename props and fix router types

This commit is contained in:
Steve Klebanoff 2018-12-20 08:59:13 -08:00
parent 97369c969c
commit f94bdc496a

View File

@ -1,20 +1,24 @@
import { History, Location } from 'history';
import * as React from 'react'; import * as React from 'react';
import { withRouter } from 'react-router-dom'; import { match, withRouter } from 'react-router-dom';
import styled from 'styled-components'; import styled from 'styled-components';
import { Button } from 'ts/@next/components/button'; import { Button } from 'ts/@next/components/button';
import { Icon } from 'ts/@next/components/icon'; import { Icon } from 'ts/@next/components/icon';
interface Props { interface BaseComponentProps {
icon?: string; icon?: string;
iconComponent?: React.ReactNode; iconComponent?: React.ReactNode;
title: string; title: string;
linkLabel: string; linkLabel: string;
linkUrl?: string; linkUrl?: string;
linkAction?: () => void; linkAction?: () => void;
history: History;
location: Location;
match: match<any>;
} }
class BaseComponent extends React.PureComponent<Props> { class BaseComponent extends React.PureComponent<BaseComponentProps> {
public onClick = (): void => { public onClick = (): void => {
const { linkAction, linkUrl } = this.props; const { linkAction, linkUrl } = this.props;
@ -44,7 +48,7 @@ class BaseComponent extends React.PureComponent<Props> {
} }
} }
export const BlockIconLink = withRouter(BaseComponent); export const BlockIconLink = withRouter<BaseComponentProps>(BaseComponent);
const Wrap = styled.div` const Wrap = styled.div`
width: calc(50% - 15px); width: calc(50% - 15px);