aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages/ts/components
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-10-22 19:14:48 +0800
committerAugust Skare <post@augustskare.no>2018-10-22 19:27:49 +0800
commite485a9814333a3178e6a156230ed15b047f11005 (patch)
treee5a2ff7a5675986b7a947d5d75842e07b7587e52 /packages/dev-tools-pages/ts/components
parent1e29f2875d2428e9f4df630850391d27be874360 (diff)
downloaddexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.tar
dexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.tar.gz
dexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.tar.bz2
dexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.tar.lz
dexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.tar.xz
dexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.tar.zst
dexon-sol-tools-e485a9814333a3178e6a156230ed15b047f11005.zip
support dark alternative of Main component
Diffstat (limited to 'packages/dev-tools-pages/ts/components')
-rw-r--r--packages/dev-tools-pages/ts/components/ContentBlock.tsx17
-rw-r--r--packages/dev-tools-pages/ts/components/Main.tsx43
2 files changed, 40 insertions, 20 deletions
diff --git a/packages/dev-tools-pages/ts/components/ContentBlock.tsx b/packages/dev-tools-pages/ts/components/ContentBlock.tsx
index 56d52a150..fcd85830e 100644
--- a/packages/dev-tools-pages/ts/components/ContentBlock.tsx
+++ b/packages/dev-tools-pages/ts/components/ContentBlock.tsx
@@ -1,7 +1,8 @@
import * as React from 'react';
import styled from 'styled-components';
-import { Beta } from './Typography';
+import { withContext, Props } from './withContext';
+import { Beta, Alpha } from './Typography';
const Base = styled.div`
display: flex;
@@ -26,8 +27,14 @@ const Item = styled.div`
}
`;
-interface ContentBlockProps {
+const StyledTitle = styled(Alpha)`
+ color: ${props => props.color};
+ margin-bottom: 6.25rem;
+`;
+
+interface ContentBlockProps extends Props {
title: string;
+ main?: boolean;
children: React.ReactNode;
}
@@ -36,12 +43,14 @@ function ContentBlock(props: ContentBlockProps) {
return <Item>{child}</Item>;
});
+ const Title = props.main ? StyledTitle : Beta;
+
return (
<Base>
- <Beta>{props.title}</Beta>
+ <Title color={props.colors.main}>{props.title}</Title>
<Content>{children}</Content>
</Base>
);
}
-export default ContentBlock;
+export default withContext(ContentBlock);
diff --git a/packages/dev-tools-pages/ts/components/Main.tsx b/packages/dev-tools-pages/ts/components/Main.tsx
index 8046abc91..6c0270dbc 100644
--- a/packages/dev-tools-pages/ts/components/Main.tsx
+++ b/packages/dev-tools-pages/ts/components/Main.tsx
@@ -1,33 +1,44 @@
import * as React from 'react';
import styled from 'styled-components';
-import { withContext, Props } from './withContext';
+import { Beta } from './Typography';
+import Container from './Container';
+import ContentBlock from './ContentBlock';
-import { Alpha } from './Typography';
-
-const StyledMain = styled.div`
+const StyledMain =
+ styled.div <
+ MainProps >
+ `
padding-top: 6.25rem;
padding-bottom: 6.25rem;
+ ${props =>
+ props.dark
+ ? `
+ background-color: #000;
+ color: #fff;
+ `
+ : ''};
`;
-const Title = styled(Alpha)`
- color: ${props => props.color};
- margin-bottom: 6.25rem;
-`;
-
-interface MainProps extends Props {
+interface MainProps {
+ title?: string;
+ subtitle?: string;
+ dark?: boolean;
children: React.ReactNode;
}
function Main(props: MainProps) {
return (
- <StyledMain>
- <Title as="h2" color={props.colors.main}>
- Get started
- </Title>
- {props.children}
+ <StyledMain dark={props.dark}>
+ <Container>
+ <ContentBlock main title={props.title || 'Get started'}>
+ {props.subtitle ? <Beta as="p">{props.subtitle}</Beta> : null}
+ </ContentBlock>
+
+ {props.children}
+ </Container>
</StyledMain>
);
}
-export default withContext(Main);
+export default Main;