Refactored community link props

This commit is contained in:
Piotr Janosz
2019-07-04 18:21:14 +02:00
committed by fabioberger
parent b2e592bb41
commit 14ad5ced78

View File

@@ -1,55 +1,35 @@
import { Link } from '@0x/react-shared'; import React from 'react';
import * as _ from 'lodash'; import styled from 'styled-components';
import * as React from 'react';
import styled, { withTheme } from 'styled-components';
import { Button } from 'ts/components/button';
import { SearchInput } from 'ts/components/docs/search_input';
import { Icon } from 'ts/components/icon'; import { Icon } from 'ts/components/icon';
import { Column, FlexWrap, WrapGrid } from 'ts/components/newLayout';
import { ThemeValuesInterface } from 'ts/components/siteWrap';
import { Heading, Paragraph } from 'ts/components/text'; import { Heading, Paragraph } from 'ts/components/text';
import { colors } from 'ts/style/colors';
import { WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
export interface CommunityLinkProps { import { colors } from 'ts/style/colors';
export interface ICommunityLinkProps {
heading: string; heading: string;
icon: string; icon: string;
description?: string; description?: string;
url: string; url: string;
shouldOpenInNewTab?: boolean; shouldOpenInNewTab?: boolean;
isHome?: boolean;
} }
interface WrapperProps { export const CommunityLink: React.FC<ICommunityLinkProps> = props => (
isHome?: boolean; <Wrapper href={props.url}>
} <Icon color={colors.brandLight} name={props.icon} size={100} margin={[0, 0, 24, 0]} />
<Heading size="small" marginBottom="8px">
export const CommunityLink: React.FunctionComponent<CommunityLinkProps> = (props: CommunityLinkProps) => ( {props.heading}
<> </Heading>
<Wrapper isHome={props.isHome} href={props.url}> <Paragraph size="default" marginBottom="0">
<div> {props.description}
<Icon color={colors.brandLight} name={props.icon} size={100} margin={[0, 0, 24, 0]} /> </Paragraph>
<Heading size="small" marginBottom="8px"> </Wrapper>
{props.heading}
</Heading>
<Paragraph size="default" marginBottom="0">
{props.description}
</Paragraph>
</div>
</Wrapper>
</>
); );
CommunityLink.defaultProps = { const Wrapper = styled.a`
isHome: false,
};
const Wrapper = styled.a<WrapperProps>`
background-color: ${colors.backgroundLight}; background-color: ${colors.backgroundLight};
border: 1px solid #dbdfdd; border: 1px solid #dbdfdd;
padding: 50px 50px; padding: 50px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;