From d6b92e5786b311f16b72411b75900c5aa1fe8394 Mon Sep 17 00:00:00 2001 From: Fred Carlsen Date: Fri, 30 Nov 2018 09:57:49 +0100 Subject: Add center prop to text --- packages/website/ts/@next/components/text.tsx | 54 ++++++++++++++++++--------- 1 file changed, 36 insertions(+), 18 deletions(-) (limited to 'packages/website/ts/@next') diff --git a/packages/website/ts/@next/components/text.tsx b/packages/website/ts/@next/components/text.tsx index 1d4fdcef8..911417639 100644 --- a/packages/website/ts/@next/components/text.tsx +++ b/packages/website/ts/@next/components/text.tsx @@ -8,10 +8,41 @@ interface Props { center?: boolean; } +export const Heading: React.StatelessComponent = ({ children, ...props }) => ( + {children} +); + +export const Intro: React.StatelessComponent = ({ children, ...props }) => ( + {children} +); + +export const Text: React.StatelessComponent = ({ children, ...props }) => ( + {children} +); + +Heading.defaultProps = { + size: 'normal', + center: false, +}; + +Intro.defaultProps = { + size: 'normal', + center: false, +}; + +Text.defaultProps = { + size: 'normal', + center: false, +}; + const StyledHeading = styled.h1` color: ${colors.white}; font-size: 80px; line-height: 1em; + + ${(props: Props) => props.center && ` + text-align: center + `} `; const StyledIntro = styled.p` @@ -19,6 +50,10 @@ const StyledIntro = styled.p` opacity: 0.75; font-size: 22px; line-height: 1.823529412em; + + ${(props: Props) => props.center && ` + text-align: center + `} `; const StyledText = styled.p` @@ -31,21 +66,4 @@ const StyledText = styled.p` ${(props: Props) => props.center && ` text-align: center `} -`; - -export const Heading: React.StatelessComponent = ({ children }) => ( - {children} -); - -export const Intro: React.StatelessComponent = ({ children }) => ( - {children} -); - -export const Text: React.StatelessComponent = ({ children, ...props }) => ( - {children} -); - -Text.defaultProps = { - size: 'normal', - center: false, -}; +`; \ No newline at end of file -- cgit