added announcement component

This commit is contained in:
David Sun 2019-02-15 13:24:28 -05:00
parent 82ed9ef25e
commit 13df5adecd
3 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,31 @@
import * as React from 'react';
import styled from 'styled-components';
import { colors } from '../style/colors';
import { Link } from './link';
import { Paragraph } from './text';
export interface AnnouncementProps {
headline: string;
href: string;
}
const BrandColorSpan = styled.span`
color: ${colors.white};
padding-right: 12px;
`;
const Wrap = styled.div`
padding: 20px 0;
color: ${colors.brandLight};
`;
export const Announcement: React.StatelessComponent<AnnouncementProps> = (props: AnnouncementProps) => {
return (<Wrap>
<Link href={props.href}>
<BrandColorSpan>{'New!'}</BrandColorSpan>
{props.headline}
</Link>
</Wrap>);
};

View File

@ -1,8 +1,9 @@
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { addFadeInAnimation } from 'ts/constants/animations'; import { addFadeInAnimation } from 'ts/constants/animations';
import { Announcement, AnnouncementProps } from './announcement';
interface Props { interface Props {
title: string; title: string;
maxWidth?: string; maxWidth?: string;
@ -13,6 +14,7 @@ interface Props {
description: string; description: string;
figure?: React.ReactNode; figure?: React.ReactNode;
actions?: React.ReactNode; actions?: React.ReactNode;
announcement?: AnnouncementProps;
} }
const Section = styled.section` const Section = styled.section`
@ -126,6 +128,7 @@ export const Hero: React.StatelessComponent<Props> = (props: Props) => (
{props.figure && <Content width="400px">{props.figure}</Content>} {props.figure && <Content width="400px">{props.figure}</Content>}
<Content width={props.maxWidth ? props.maxWidth : props.figure ? '546px' : '678px'}> <Content width={props.maxWidth ? props.maxWidth : props.figure ? '546px' : '678px'}>
{!!props.announcement && <Announcement {...props.announcement} />}
<Title isLarge={props.isLargeTitle} maxWidth={props.maxWidthHeading}> <Title isLarge={props.isLargeTitle} maxWidth={props.maxWidthHeading}>
{props.title} {props.title}
</Title> </Title>

View File

@ -7,6 +7,11 @@ import { LandingAnimation } from 'ts/components/heroImage';
import { HeroAnimation } from 'ts/components/heroAnimation'; import { HeroAnimation } from 'ts/components/heroAnimation';
import { WebsitePaths } from 'ts/types'; import { WebsitePaths } from 'ts/types';
const announcement = {
headline: 'Vote on ZEIP-23 MultiAssetProxy',
href: '/vote',
};
export const SectionLandingHero = () => ( export const SectionLandingHero = () => (
<Hero <Hero
title="Powering Decentralized Exchange" title="Powering Decentralized Exchange"
@ -15,6 +20,7 @@ export const SectionLandingHero = () => (
description="0x is an open protocol that enables the peer-to-peer exchange of assets on the Ethereum blockchain." description="0x is an open protocol that enables the peer-to-peer exchange of assets on the Ethereum blockchain."
figure={<LandingAnimation image={<HeroAnimation />} />} figure={<LandingAnimation image={<HeroAnimation />} />}
actions={<HeroActions />} actions={<HeroActions />}
announcement={announcement}
/> />
); );