Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K7] Add Typography components #13048

Merged
merged 12 commits into from
Jul 24, 2017
61 changes: 45 additions & 16 deletions ui_framework/dist/ui_framework.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
.kui--codeFont {
font-family: "Roboto Mono", monospace; }

.kui--fontSizeSmall, .kuiKeyPad {
font-size: 14px;
font-size: 0.875rem;
line-height: 24px; }

.kuiTitle--small, .kuiText {
font-size: 16px;
font-size: 1rem;
line-height: 24px; }

.kuiTitle {
font-size: 24px;
font-size: 1.5rem;
line-height: 36px; }

.kuiTitle--large {
font-size: 32px;
font-size: 2rem;
line-height: 48px; }

/**
* Adapted from Eric Meyer's reset (http://meyerweb.com/eric/tools/css/reset/, v2.0 | 20110126).
*
Expand Down Expand Up @@ -128,25 +146,12 @@ table {
.kui--verticalAlignMiddle {
vertical-align: middle !important; }

.kui--subduedText {
color: #666; }

.kui--bottomShadow {
box-shadow: 0 16px 16px -8px rgba(0, 0, 0, 0.1); }

.kuiIcon {
display: inline-block;
fill: #3F3F3F; }
.kuiIcon--medium {
width: 16px;
height: 16px; }
.kuiIcon--large {
width: 24px;
height: 24px; }
.kuiIcon--xLarge {
width: 32px;
height: 32px; }
.kuiIcon--xxLarge {
width: 40px;
height: 40px; }

.kuiHeader {
background: #FFF;
border-bottom: 1px solid #D9D9D9; }
Expand Down Expand Up @@ -236,6 +241,22 @@ table {
.kuiHeaderItem__button:focus {
background: #e6f2f6; }

.kuiIcon {
display: inline-block;
fill: #3F3F3F; }
.kuiIcon--medium {
width: 16px;
height: 16px; }
.kuiIcon--large {
width: 24px;
height: 24px; }
.kuiIcon--xLarge {
width: 32px;
height: 32px; }
.kuiIcon--xxLarge {
width: 40px;
height: 40px; }

.kuiKeyPad {
display: -webkit-box;
display: -webkit-flex;
Expand Down Expand Up @@ -335,3 +356,11 @@ table {
.kuiPopMenu--anchorRight .kuiPopMenu__body:before, .kuiPopMenu--anchorRight .kuiPopMenu__body:after {
right: 16px;
left: auto; }

.kuiTitle {
color: #000;
font-weight: 300; }

.kuiText {
color: #3F3F3F;
font-weight: 400; }
2 changes: 1 addition & 1 deletion ui_framework/doc_site/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500|Roboto+Mono:400" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<script src="https://use.fontawesome.com/a9649923ac.js"></script>
</head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.guideCode {
padding: 2px 4px;
font-family: 'Ubuntu Mono', monospace;
font-family: 'Roboto Mono', monospace;
background-color: #e8e8e8;
color: #565656;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
color: #637c84;
font-size: 14px;
line-height: 1.3;
font-family: 'Ubuntu Mono', monospace;
font-family: 'Roboto Mono', monospace;
}

.hljs-keyword {
Expand Down
8 changes: 8 additions & 0 deletions ui_framework/doc_site/src/services/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import IconExample
import HeaderExample
from '../../views/header/header_example';

import TypographyExample
from '../../views/typography/typography_example';

// Component route names should match the component name exactly.
const components = [{
name: 'Accessibility',
Expand All @@ -17,9 +20,14 @@ const components = [{
}, {
name: 'Icon',
component: IconExample,
hasReact: true,
}, {
name: 'Header',
component: HeaderExample,
}, {
name: 'Typography',
component: TypographyExample,
hasReact: true,
}];

const sandboxes = [];
Expand Down
2 changes: 1 addition & 1 deletion ui_framework/doc_site/src/views/header/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<p>Discover</p>
</a>
<a href="" class="kuiKeyPad__item">
<svg class="kuiIcon kuiIcon--xLarge">
<svg class="kuiIcon kuiIcon--xLarge kuiKeyPad__icon">
<use href="#app_dashboard" />
</svg>
<p>Discover</p>
Expand Down
17 changes: 17 additions & 0 deletions ui_framework/doc_site/src/views/typography/large_title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';

import {
KuiTitle,
} from '../../../../components';

export default () => (
<div>
<KuiTitle size="large">
<h1>This is the title of the page</h1>
</KuiTitle>

<KuiTitle size="large">
<h2>This is a LargeTitle applied to an h2 element</h2>
</KuiTitle>
</div>
);
11 changes: 11 additions & 0 deletions ui_framework/doc_site/src/views/typography/medium_title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import {
KuiTitle,
} from '../../../../components';

export default () => (
<KuiTitle>
<h2>Here's the title of a section</h2>
</KuiTitle>
);
11 changes: 11 additions & 0 deletions ui_framework/doc_site/src/views/typography/small_title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import {
KuiTitle,
} from '../../../../components';

export default () => (
<KuiTitle size="small">
<h3>An h3 element is used for this title</h3>
</KuiTitle>
);
15 changes: 15 additions & 0 deletions ui_framework/doc_site/src/views/typography/text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

import {
KuiText,
} from '../../../../components';

export default () => (
<KuiText>
<p>
The quick brown fox jumped over the lazy dog. But the lazy dog wasn't lazy, it was just
practicing mindfulness, so really in the long run it was much more satisfied with its
life than that fox was.
</p>
</KuiText>
);
36 changes: 36 additions & 0 deletions ui_framework/doc_site/src/views/typography/typography.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';

import {
KuiTitle,
KuiText,
} from '../../../../components';

export default () => (
<div>
<KuiTitle size="large">
<h1>This is the title of the page -- descriptive enough for ya?</h1>
</KuiTitle>

<KuiTitle>
<h2>And this is a section within the page</h2>
</KuiTitle>

<KuiTitle size="small">
<h3>Note</h3>
</KuiTitle>

<KuiText>
<p>
The quick brown fox jumped over the lazy dog.
</p>
</KuiText>

<KuiText>
<p>
But the dog wasn't lazy, it was just
practicing mindfulness, so it had a greater sense of
life-satisfaction than that fox with all its jumping.
</p>
</KuiText>
</div>
);
132 changes: 132 additions & 0 deletions ui_framework/doc_site/src/views/typography/typography_example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import React from 'react';

import { renderToHtml } from '../../services';

import {
GuideDemo,
GuidePage,
GuideSection,
GuideSectionTypes,
GuideText,
} from '../../components';

import Typography from './typography';
const typographySource = require('!!raw!./typography');
const typographyHtml = renderToHtml(Typography);

import LargeTitle from './large_title';
const pageTitleSource = require('!!raw!./large_title');
const pageTitleHtml = renderToHtml(LargeTitle);

import MediumTitle from './medium_title';
const sectionTitleSource = require('!!raw!./medium_title');
const sectionTitleHtml = renderToHtml(MediumTitle);

import SmallTitle from './small_title';
const objectTitleSource = require('!!raw!./small_title');
const objectTitleHtml = renderToHtml(SmallTitle);

import Text from './text';
const textSource = require('!!raw!./text');
const textHtml = renderToHtml(Text);

export default props => (
<GuidePage title={props.route.name}>
<GuideSection
title="Typography"
source={[{
type: GuideSectionTypes.JS,
code: typographySource,
}, {
type: GuideSectionTypes.HTML,
code: typographyHtml,
}]}
>
<GuideDemo>
<Typography />
</GuideDemo>
</GuideSection>

<GuideSection
title="Large Title"
source={[{
type: GuideSectionTypes.JS,
code: pageTitleSource,
}, {
type: GuideSectionTypes.HTML,
code: pageTitleHtml,
}]}
>
<GuideText>
The large size is usually used to identify the page you're on. Generally, there should
only be one of these used at a time.
</GuideText>

<GuideText>
You can specify which heading element to use by passing it in
as a child. The heading element can be absolutely anything.
</GuideText>

<GuideDemo>
<LargeTitle />
</GuideDemo>
</GuideSection>

<GuideSection
title="Medium Title"
source={[{
type: GuideSectionTypes.JS,
code: sectionTitleSource,
}, {
type: GuideSectionTypes.HTML,
code: sectionTitleHtml,
}]}
>
<GuideText>
This size is commonly used to identify sections within a page. It's also the default size.
</GuideText>

<GuideDemo>
<MediumTitle />
</GuideDemo>
</GuideSection>

<GuideSection
title="Small Title"
source={[{
type: GuideSectionTypes.JS,
code: objectTitleSource,
}, {
type: GuideSectionTypes.HTML,
code: objectTitleHtml,
}]}
>
<GuideText>
This size is commonly used to identify subsections within a section.
</GuideText>

<GuideDemo>
<SmallTitle />
</GuideDemo>
</GuideSection>

<GuideSection
title="Text"
source={[{
type: GuideSectionTypes.JS,
code: textSource,
}, {
type: GuideSectionTypes.HTML,
code: textHtml,
}]}
>
<GuideText>
You'll generally use this component for paragraphs.
</GuideText>

<GuideDemo>
<Text />
</GuideDemo>
</GuideSection>
</GuidePage>
);
5 changes: 5 additions & 0 deletions ui_framework/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ export {
export {
KuiIcon,
} from './icon';

export {
KuiTitle,
KuiText,
} from './typography';
3 changes: 2 additions & 1 deletion ui_framework/src/components/index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import './icon/index';
@import './header/index';
@import './icon/index';
@import './key_pad/index';
@import './pop_menu/index';
@import './typography/index';
Loading