Fixes interface syntax

This commit is contained in:
Ezekiel Aquino
2018-11-29 09:33:06 +01:00
parent 0736ba7159
commit 03289293c3
2 changed files with 43 additions and 27 deletions

View File

@@ -8,16 +8,27 @@ import { Button } from './button';
import { Section, Wrap, Column } from './layout'; import { Section, Wrap, Column } from './layout';
import { Logo } from './logo'; import { Logo } from './logo';
export interface FooterInterface { interface FooterInterface {
} }
export interface LinkInterface { interface LinkInterface {
text: string; text: string;
url: string; url: string;
newWindow?: boolean; newWindow?: boolean;
} }
const linkRows = [ interface LinkRows {
[key: string]: {
heading: string;
links: Array<LinkInterface>;
}
}
interface LinkListProps {
links: Array<LinkInterface>;
}
const linkRows: LinkRows = [
{ {
heading: 'Products', heading: 'Products',
links: [ links: [
@@ -65,15 +76,7 @@ export const Footer: React.StatelessComponent<FooterInterface> = ({}) => (
{ row.heading } { row.heading }
</RowHeading> </RowHeading>
<ul> <LinkList links={row.links} />
{_.map(row.links, (link, index) => (
<li key={`fl-${index}`}>
<Link href={link.url}>
{ link.text }
</Link>
</li>
))}
</ul>
</Column> </Column>
))} ))}
</Wrap> </Wrap>
@@ -82,6 +85,19 @@ export const Footer: React.StatelessComponent<FooterInterface> = ({}) => (
</FooterWrap> </FooterWrap>
); );
const LinkList = (props: LinkListProps) => (
<ul>
{_.map(props.links, (link, index) => (
<li key={`fl-${index}`}>
<Link href={link.url}>
{ link.text }
</Link>
</li>
))}
</ul>
);
const FooterWrap = Section.withComponent('footer'); const FooterWrap = Section.withComponent('footer');
const RowHeading = styled.h3` const RowHeading = styled.h3`

View File

@@ -2,36 +2,36 @@ import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
interface WrapWidths { interface WrapWidths {
default: string, default: string;
full: string, full: string;
medium: string, medium: string;
narrow: string, narrow: string;
[key: string]: string, [key: string]: string;
} }
interface ColumnWidths { interface ColumnWidths {
[key: string]: string, [key: string]: string;
} }
interface SectionProps { interface SectionProps {
noPadding?: any, noPadding?: any;
noMargin?: any, noMargin?: any;
bgColor?: string, bgColor?: string;
} }
interface WrapProps { interface WrapProps {
width?: 'default' | 'full' | 'medium' | 'narrow', width?: 'default' | 'full' | 'medium' | 'narrow';
bgColor?: string, bgColor?: string;
} }
interface ColumnProps { interface ColumnProps {
colWidth?: '1/4' | '1/3' | '1/2' | '2/3', colWidth?: '1/4' | '1/3' | '1/2' | '2/3';
noPadding?: any, noPadding?: any;
} }
interface GetColWidthArgs { interface GetColWidthArgs {
span?: number, span?: number;
columns: number, columns: number;
} }