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 * as _ from 'lodash';
import * as React from 'react';
import styled, { withTheme } from 'styled-components';
import React from 'react';
import styled from 'styled-components';
import { Button } from 'ts/components/button';
import { SearchInput } from 'ts/components/docs/search_input';
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 { 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;
icon: string;
description?: string;
url: string;
shouldOpenInNewTab?: boolean;
isHome?: boolean;
}
interface WrapperProps {
isHome?: boolean;
}
export const CommunityLink: React.FunctionComponent<CommunityLinkProps> = (props: CommunityLinkProps) => (
<>
<Wrapper isHome={props.isHome} href={props.url}>
<div>
<Icon color={colors.brandLight} name={props.icon} size={100} margin={[0, 0, 24, 0]} />
<Heading size="small" marginBottom="8px">
{props.heading}
</Heading>
<Paragraph size="default" marginBottom="0">
{props.description}
</Paragraph>
</div>
</Wrapper>
</>
export const CommunityLink: React.FC<ICommunityLinkProps> = props => (
<Wrapper href={props.url}>
<Icon color={colors.brandLight} name={props.icon} size={100} margin={[0, 0, 24, 0]} />
<Heading size="small" marginBottom="8px">
{props.heading}
</Heading>
<Paragraph size="default" marginBottom="0">
{props.description}
</Paragraph>
</Wrapper>
);
CommunityLink.defaultProps = {
isHome: false,
};
const Wrapper = styled.a<WrapperProps>`
const Wrapper = styled.a`
background-color: ${colors.backgroundLight};
border: 1px solid #dbdfdd;
padding: 50px 50px;
padding: 50px;
display: flex;
flex-direction: column;
align-items: center;