Skip to content

Commit

Permalink
feat: create new typography UI components & update welcome screen layout
Browse files Browse the repository at this point in the history
  • Loading branch information
hiwelo committed Mar 29, 2020
1 parent 924be87 commit 7a4be2c
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 28 deletions.
24 changes: 8 additions & 16 deletions src/components/Heading/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { Text, TextProps } from '@ui-kitten/components';
import React from 'react';

import Space from '../Space';

const Heading: React.FC<HeadingProps> = ({ children }) => {
return (
<Space type="comfortable">
<Text category="h1">{children}</Text>
</Space>
);
};

export interface HeadingProps extends TextProps {
children: string;
}
import { Text } from '@ui-kitten/components';
import styled from 'styled-components/native';

const Heading = styled(Text).attrs({ category: 'h1' })`
font-size: 31px;
font-weight: 800;
line-height: 46px;
`;

export default Heading;
16 changes: 10 additions & 6 deletions src/components/Paragraph/Paragraph.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { Text } from '@ui-kitten/components';
import styled from 'styled-components/native';
import { TextProps } from '@ui-kitten/components';
import React from 'react';

const Paragraph = styled(Text).attrs({ category: 'p1' })`
font-size: 18px;
line-height: 26px;
`;
import Space from '../Space';
import Text from '../Text';

const Paragraph: React.FC<TextProps> = ({ children }) => (
<Space>
<Text>{children}</Text>
</Space>
);

export default Paragraph;
10 changes: 10 additions & 0 deletions src/components/Subheading/Subheading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Text } from '@ui-kitten/components';
import styled from 'styled-components/native';

const Subheading = styled(Text).attrs({ category: 'h2' })`
font-size: 25px;
font-weight: 600;
line-height: 38px;
`;

export default Subheading;
1 change: 1 addition & 0 deletions src/components/Subheading/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Subheading';
9 changes: 9 additions & 0 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Text as UIKitText } from '@ui-kitten/components';
import styled from 'styled-components/native';

const Text = styled(UIKitText)`
font-size: 18px;
line-height: 27px;
`;

export default Text;
1 change: 1 addition & 0 deletions src/components/Text/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Text';
11 changes: 5 additions & 6 deletions src/views/Wizard/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react';
import Heading from '../../components/Heading';
import Paragraph from '../../components/Paragraph';
import Space from '../../components/Space';
import Subheading from '../../components/Subheading';
import ViewLayout from '../../components/ViewLayout';
import { useI18n } from '../../services/LocalizationProvider';

Expand All @@ -13,16 +14,14 @@ const WelcomeScreen: React.FC = () => {
return (
<ViewLayout>
<Layout style={{ marginBottom: 'auto', marginTop: 'auto' }}>
<Heading>{__('welcomeScreen.title')}</Heading>
<Space>
<Paragraph>{__('welcomeScreen.greeting')}</Paragraph>
<Heading>{__('welcomeScreen.title')}</Heading>
</Space>
<Space>
<Paragraph>{__('welcomeScreen.whoAmI')}</Paragraph>
</Space>
<Space>
<Paragraph>{__('welcomeScreen.ready')}</Paragraph>
<Subheading>{__('welcomeScreen.greeting')}</Subheading>
</Space>
<Paragraph>{__('welcomeScreen.whoAmI')}</Paragraph>
<Paragraph>{__('welcomeScreen.ready')}</Paragraph>
</Layout>
<Layout style={{ marginTop: 'auto' }}>
<Button>{__('welcomeScreen.cta')}</Button>
Expand Down

0 comments on commit 7a4be2c

Please sign in to comment.