diff --git a/README.md b/README.md index 6179e9b1e..cc8c76e24 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,6 @@ Seem overwhelming? It's time to talk with a front-end dev on the Pivotal team on For example, to create a button: ``` - npm install --save pui-react-typography npm install --save pui-react-buttons ``` @@ -135,7 +134,6 @@ Seem overwhelming? It's time to talk with a front-end dev on the Pivotal team on Javascript: ```jsx var React = require('react'); - var DefaultH1 = require('pui-react-typography').DefaultH1; var DefaultButton = require('pui-react-buttons').DefaultButton; var MyTestPage = React.createClass({ @@ -151,7 +149,7 @@ Seem overwhelming? It's time to talk with a front-end dev on the Pivotal team on return (
Show Message - { this.state.showMessage ? Hello world! : null } + { this.state.showMessage ?

Hello world!

: null }
); } diff --git a/library/spec/pivotal-ui-react/typography/typography_spec.js b/library/spec/pivotal-ui-react/typography/typography_spec.js deleted file mode 100644 index 03845e616..000000000 --- a/library/spec/pivotal-ui-react/typography/typography_spec.js +++ /dev/null @@ -1,108 +0,0 @@ -require('../spec_helper'); -import {itPropagatesAttributes} from '../support/shared_examples'; - -describe('Heading', function() { - var typography, Heading; - beforeEach(function() { - typography = require('../../../src/pivotal-ui-react/typography/typography'); - Heading = typography.Heading; - }); - - afterEach(function() { - ReactDOM.unmountComponentAtNode(root); - }); - - describe('when the Heading has no properties passed in', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('creates a p tag', function() { - expect('p:contains("Heading text here")').toExist(); - }); - - it('sets no additional classes', function() { - expect('p:contains("Heading text here")').toHaveAttr('class', undefined); - }); - }); - - ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].forEach(function(element) { - describe('when passing in element="' + element + '"', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('creates an element of the specified heading', function() { - expect(element + ':contains("Heading text here")').toExist(); - }); - }); - }); - - describe('when the Heading has attrs provided', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('has the default classes', function() { - expect('h1:contains("Heading text here")').toHaveClass('myClass'); - expect('h1:contains("Heading text here")').toHaveClass('em-alt'); - }); - - itPropagatesAttributes('h1:contains("Heading text here")', {className: 'myClass', id: 'myId', style: {opacity: '0.5'}}); - }); - - describe('when the Heading has size provided', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('creates an element with the size class set', function() { - expect('h1:contains("Heading text here")').toHaveClass('small'); - }); - }); - - describe('when the Heading has allCaps set', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('creates an element with the em-alt class', function() { - expect('h2:contains("Heading text here")').toHaveClass('em-alt'); - }); - }); - - describe('when the Heading has a bold set', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('creates an element with the em-{bold} class', function() { - expect('h2:contains("Heading text here")').toHaveClass('em-high'); - }); - }); - - describe('when the Heading has color set', function() { - beforeEach(function() { - ReactDOM.render((), root); - }); - - it('creates an element with the color class', function() { - expect('h2:contains("Heading text here")').toHaveClass('purple'); - }); - }); - - describe('when Heading has many properties set', function() { - beforeEach(function() { - ReactDOM.render( - (), - root); - }); - - it('creates an element all the necessary classes', function() { - expect('h2:contains("Heading text here")').toHaveClass('purple'); - expect('h2:contains("Heading text here")').toHaveClass('em-alt'); - expect('h2:contains("Heading text here")').toHaveClass('em-max'); - expect('h2:contains("Heading text here")').toHaveClass('h4'); - }); - }); -}); diff --git a/library/src/pivotal-ui-react/modals/modals.js b/library/src/pivotal-ui-react/modals/modals.js index 28cc9e9bb..86957a6c1 100644 --- a/library/src/pivotal-ui-react/modals/modals.js +++ b/library/src/pivotal-ui-react/modals/modals.js @@ -1,7 +1,7 @@ var React = require('react'); -var {DefaultH4} = require('pui-react-typography'); import {mergeProps} from 'pui-react-helpers'; import 'pui-css-modals'; +import 'pui-css-typography'; const BsModal = require('react-bootstrap/lib/Modal'); const BsModalHeader = require('react-bootstrap/lib/ModalHeader'); @@ -24,7 +24,7 @@ class BaseModal extends React.Component { return ( - {title} +

{title}

{children}
diff --git a/library/src/pivotal-ui-react/modals/package.json b/library/src/pivotal-ui-react/modals/package.json index 341593554..da53f6440 100644 --- a/library/src/pivotal-ui-react/modals/package.json +++ b/library/src/pivotal-ui-react/modals/package.json @@ -4,7 +4,7 @@ "homepage": "http://styleguide.pivotal.io/", "dependencies": { "pui-css-modals": "^3.4.2", - "pui-react-typography": "^3.4.2", + "pui-css-typography": "^3.4.2", "pui-react-helpers": "^3.4.2", "react-bootstrap": "0.28.3" } diff --git a/library/src/pivotal-ui-react/typography/package.json b/library/src/pivotal-ui-react/typography/package.json deleted file mode 100644 index 9e56e1ea9..000000000 --- a/library/src/pivotal-ui-react/typography/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "3.4.2", - "description": "A collection of React components that provide standard typographical headers", - "homepage": "http://styleguide.pivotal.io/", - "dependencies": { - "pui-css-typography": "^3.4.2", - "pui-react-helpers": "^3.4.2" - } -} \ No newline at end of file diff --git a/library/src/pivotal-ui-react/typography/typography.js b/library/src/pivotal-ui-react/typography/typography.js deleted file mode 100644 index 7e035bd4e..000000000 --- a/library/src/pivotal-ui-react/typography/typography.js +++ /dev/null @@ -1,103 +0,0 @@ -const React = require('react'); -import {mergeProps} from 'pui-react-helpers'; -import 'pui-css-typography'; - -class Heading extends React.Component { - static propTypes = { - allCaps: React.PropTypes.bool, - bold: React.PropTypes.oneOf(['low', 'default', 'high', 'max']), - color: React.PropTypes.string, - element: React.PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']), - size: React.PropTypes.oneOf(['title', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'small']) - }; - - render() { - var {size, bold, allCaps, color, element = 'p', children, ...other} = this.props; - - var classes = [ - size, - bold && `em-${bold}`, - allCaps && 'em-alt', - color - ] - .filter(Boolean) - .join(' '); - - const props = mergeProps(other, {className: classes}); - var Klass = element; - return {children}; - } -} - -function defHeader(props) { - return class extends React.Component { - static propTypes = { - allCaps: React.PropTypes.bool, - bold: React.PropTypes.oneOf(['low', 'default', 'high', 'max']), - color: React.PropTypes.string, - element: React.PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']), - size: React.PropTypes.oneOf(['title', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'small']) - }; - - render() { - return (); - } - } -} - -var DefaultH1 = defHeader({element: 'h1'}); -var DefaultH2 = defHeader({element: 'h2'}); - -var DefaultH3 = defHeader({element: 'h3'}); - -var DefaultH4 = defHeader({element: 'h4'}); - -var DefaultH5 = defHeader({element: 'h5'}); - -var DefaultH6 = defHeader({element: 'h6'}); - -var AlternateH1 = defHeader({element: 'h1', color: 'type-dark-2', bold: 'max'}); - -var AlternateH2 = defHeader({element: 'h2', size: 'h4', bold: 'high', allCaps: true}); - -var AlternateH3 = defHeader({element: 'h3', size: 'h4'}); - -var AlternateH4 = defHeader({element: 'h4', size: 'h6', bold: 'high', allCaps: true}); - -var AlternateH5 = defHeader({element: 'h5', size: 'h6', bold: 'high'}); - -var AlternateH6 = defHeader({element: 'h6'}); - -var MarketingH1 = defHeader({element: 'h1', size: 'title', bold: 'high', color: 'type-dark-2'}); - -var MarketingH2 = defHeader({element: 'h2', size: 'h1', bold: 'high', color: 'type-dark-2'}); - -var MarketingH3 = defHeader({element: 'h3', size: 'h2', bold: 'high', color: 'type-dark-2'}); - -var MarketingH4 = defHeader({element: 'h4', size: 'h3', bold: 'high', color: 'type-dark-2'}); - -var MarketingH5 = defHeader({element: 'h5', size: 'h4', bold: 'high', color: 'type-dark-2'}); - -var MarketingH6 = defHeader({element: 'h6', size: 'h5', bold: 'high', color: 'type-dark-2'}); - -module.exports = { - DefaultH1, - DefaultH2, - DefaultH3, - DefaultH4, - DefaultH5, - DefaultH6, - AlternateH1, - AlternateH2, - AlternateH3, - AlternateH4, - AlternateH5, - AlternateH6, - MarketingH1, - MarketingH2, - MarketingH3, - MarketingH4, - MarketingH5, - MarketingH6, - Heading -}; diff --git a/library/src/pivotal-ui/components/mixins.scss b/library/src/pivotal-ui/components/mixins.scss index e1798493c..166c9707d 100644 --- a/library/src/pivotal-ui/components/mixins.scss +++ b/library/src/pivotal-ui/components/mixins.scss @@ -110,7 +110,6 @@ //pui margin-top: $whitespace-xl; margin-bottom: $whitespace-l; - font-weight: $font-weight-h1; @media all and (max-width: $screen-sm) { & { diff --git a/library/src/pivotal-ui/components/pui-variables.scss b/library/src/pivotal-ui/components/pui-variables.scss index 90bf7ac99..32271998b 100644 --- a/library/src/pivotal-ui/components/pui-variables.scss +++ b/library/src/pivotal-ui/components/pui-variables.scss @@ -302,7 +302,7 @@ $headings-font-weight: 400 !default; $former-headings-line-height: 1.5; $headings-line-height: 1.286 !default; $headings-padding: 1em * ($former-headings-line-height - $headings-line-height) / 2; -$headings-color: null; +$headings-color: $dark-2; //TODO: create a mixin that will determine multiplers based on px-size $font-size-h1: 31px; diff --git a/library/src/pivotal-ui/components/typography/typography.scss b/library/src/pivotal-ui/components/typography/typography.scss index e429bc255..68136891f 100644 --- a/library/src/pivotal-ui/components/typography/typography.scss +++ b/library/src/pivotal-ui/components/typography/typography.scss @@ -29,6 +29,7 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { + color: $headings-color; padding-top: $headings-padding; padding-bottom: $headings-padding; } @@ -55,62 +56,30 @@ h4, .h4, h5, .h5, h6, .h6 { } } -// We handle font-weight here, bootstrap handles font-size and color +//If you add new h1 styles, make sure to update the h1 mixin -h1 { - //If you add new h1 styles, make sure to update the h1 mixin - font-weight: $font-weight-h1; +h1, .h1 { + font-size: $font-size-h1; } -h2 { - font-weight: $font-weight-h2; +h2, .h2 { + font-size: $font-size-h2; } -h3 { - font-weight: $font-weight-h3; +h3, .h3 { + font-size: $font-size-h3; } -h4 { - font-weight: $font-weight-h4; +h4, .h4 { + font-size: $font-size-h4; } -h5 { - font-weight: $font-weight-h5; +h5, .h5 { + font-size: $font-size-h5; } -h6 { - font-weight: $font-weight-h6; -} - - -.h1 { - font-size: $font-size-h1 !important; - font-weight: $font-weight-h1 !important; -} - -.h2 { - font-size: $font-size-h2 !important; - font-weight: $font-weight-h2 !important; -} - -.h3 { - font-size: $font-size-h3 !important; - font-weight: $font-weight-h3 !important; -} - -.h4 { - font-size: $font-size-h4 !important; - font-weight: $font-weight-h4 !important; -} - -.h5 { - font-size: $font-size-h5 !important; - font-weight: $font-weight-h5 !important; -} - -.h6 { - font-size: $font-size-h6 !important; - font-weight: $font-weight-h6 !important; +h6, .h6 { + font-size: $font-size-h6; } small, .type-sm { diff --git a/library/src/pivotal-ui/javascripts/components.js b/library/src/pivotal-ui/javascripts/components.js index 677e2db9d..594981603 100644 --- a/library/src/pivotal-ui/javascripts/components.js +++ b/library/src/pivotal-ui/javascripts/components.js @@ -3,29 +3,6 @@ import autocomplete from 'pui-react-autocomplete'; import TileLayout from 'pui-react-tile-layout'; module.exports = { - DefaultH1: require('pui-react-typography').DefaultH1, - DefaultH2: require('pui-react-typography').DefaultH2, - DefaultH3: require('pui-react-typography').DefaultH3, - DefaultH4: require('pui-react-typography').DefaultH4, - DefaultH5: require('pui-react-typography').DefaultH5, - DefaultH6: require('pui-react-typography').DefaultH6, - - AlternateH1: require('pui-react-typography').AlternateH1, - AlternateH2: require('pui-react-typography').AlternateH2, - AlternateH3: require('pui-react-typography').AlternateH3, - AlternateH4: require('pui-react-typography').AlternateH4, - AlternateH5: require('pui-react-typography').AlternateH5, - AlternateH6: require('pui-react-typography').AlternateH6, - - MarketingH1: require('pui-react-typography').MarketingH1, - MarketingH2: require('pui-react-typography').MarketingH2, - MarketingH3: require('pui-react-typography').MarketingH3, - MarketingH4: require('pui-react-typography').MarketingH4, - MarketingH5: require('pui-react-typography').MarketingH5, - MarketingH6: require('pui-react-typography').MarketingH6, - - Heading: require('pui-react-typography').Heading, - BasePane: require('pui-react-panes').BasePane, Pane: require('pui-react-panes').Pane, diff --git a/styleguide/docs/getting-started.scss b/styleguide/docs/getting-started.scss index 8ee7e1dda..ebee3c29e 100644 --- a/styleguide/docs/getting-started.scss +++ b/styleguide/docs/getting-started.scss @@ -102,7 +102,6 @@ npm install -g dr-frankenstyle For example, to create a button: ``` -npm install --save pui-react-typography npm install --save pui-react-buttons ``` @@ -136,7 +135,6 @@ npm install --save pui-react-buttons ``` var React = require('react'); - var DefaultH1 = require('pui-react-typography').DefaultH1; var DefaultButton = require('pui-react-buttons').DefaultButton; var MyTestPage = React.createClass({ @@ -152,7 +150,7 @@ npm install --save pui-react-buttons return (
Show Message - { this.state.showMessage ? Hello world! : null } + { this.state.showMessage ?

Hello world!

: null }
); } diff --git a/styleguide/docs/react/labels.js b/styleguide/docs/react/labels.js index 3dc1411dd..307bf5265 100644 --- a/styleguide/docs/react/labels.js +++ b/styleguide/docs/react/labels.js @@ -17,9 +17,6 @@ Require the subcomponents: ``` var Label = require('pui-react-labels').Label; - -// for the example -var DefaultH3 = require('pui-react-typography').DefaultH3; ``` Labels are a straightforward implementation of the [Label][label] style. @@ -32,8 +29,8 @@ Labels can be used on their own: Labels used within an element which already has font modifier styles will use the parents' styling. For example: ```react_example - +

Now the label is in a typography component - +

``` */ diff --git a/styleguide/docs/react/notifications.js b/styleguide/docs/react/notifications.js index 53a79c79c..db104df8a 100644 --- a/styleguide/docs/react/notifications.js +++ b/styleguide/docs/react/notifications.js @@ -24,8 +24,6 @@ var NotificationItem = require('pui-react-notifications').NotificationItem; var Flag = require('pui-react-media').Flag; var Label = require('pui-react-labels').Label; var Icon = require('pui-react-iconography').Icon; -var DefaultH3 = require('pui-react-typography').DefaultH3; -var DefaultH5 = require('pui-react-typography').DefaultH5; ``` Here's an example if there are no notifications: @@ -37,14 +35,14 @@ Here's an example if there are no notifications: Here's an example if there are notifications: ```jsx_example -var newLabel = ; +var newLabel =

; ``` ```react_example_table - Notification +
Notification

Click for Cute Gif

@@ -121,7 +119,7 @@ var alertImage = - WARNING +
WARNING

Click for Cute Gif

diff --git a/styleguide/docs/react/panes.js b/styleguide/docs/react/panes.js index b4672f169..bceb97dc5 100644 --- a/styleguide/docs/react/panes.js +++ b/styleguide/docs/react/panes.js @@ -18,9 +18,6 @@ Require the subcomponents: ``` var Pane = require('pui-react-panes').Pane; var BasePane = require('pui-react-panes').BasePane; - -// for the example -var DefaultH1 = require('pui-react-typography').DefaultH1; ``` The `Pane` component is a straightforward implementation of the [Pane][pane] styling. @@ -28,7 +25,7 @@ Any className values passed through are passed to the underlying `.pane`. ```react_example - This is a pane +

This is a pane

``` @@ -39,7 +36,7 @@ These values are added to the class name of the `.pane` and the `.container` res ```react_example - This is a pane (configurable) +

This is a pane (configurable)

``` */ diff --git a/styleguide/docs/react/typography.js b/styleguide/docs/react/typography.js deleted file mode 100644 index 403b12c21..000000000 --- a/styleguide/docs/react/typography.js +++ /dev/null @@ -1,138 +0,0 @@ -/*doc ---- -title: Typography -name: type_react -categories: - - react_base_typography - - react_all ---- - - - -npm install pui-react-typography --save - - - - We have three type systems. Which one you choose depends on your product. - - * Marketing sites should use the largest styles, for example `A Top Level Heading` - * Most sites will use our default headings, for example `A Top Level Heading` - * Rarely, sites will need a smaller type scale, for example `A Top Level Heading` - -Require the subcomponents: - - -*/ - -/*doc ---- -title: Default -name: 01_type_default_react -parent: type_react ---- - -``` -var DefaultH1 = require('pui-react-typography').DefaultH1; -var DefaultH2 = require('pui-react-typography').DefaultH2; -var DefaultH3 = require('pui-react-typography').DefaultH3; -var DefaultH4 = require('pui-react-typography').DefaultH4; -var DefaultH5 = require('pui-react-typography').DefaultH5; -var DefaultH6 = require('pui-react-typography').DefaultH6; -``` - -```react_example_table -h1 31px - -h2 25px - -h3 20px - -h4 18px - -h5 16px - -h6 13px -``` -*/ - -/*doc ---- -title: Alternate -name: 02_type_alt_react -parent: type_react ---- - -``` -var AlternateH1 = require('pui-react-typography').AlternateH1; -var AlternateH2 = require('pui-react-typography').AlternateH2; -var AlternateH3 = require('pui-react-typography').AlternateH3; -var AlternateH4 = require('pui-react-typography').AlternateH4; -var AlternateH5 = require('pui-react-typography').AlternateH5; -var AlternateH6 = require('pui-react-typography').AlternateH6; -``` - -```react_example_table -This is an H1 - -This is an H2 - -This is an H3 - -This is an H4 - -This is an H5 - -This is an H6 -``` -*/ - -/*doc ---- -title: Marketing -name: 03_type_marketing_react -parent: type_react ---- - -``` -var MarketingH1 = require('pui-react-typography').MarketingH1; -var MarketingH2 = require('pui-react-typography').MarketingH2; -var MarketingH3 = require('pui-react-typography').MarketingH3; -var MarketingH4 = require('pui-react-typography').MarketingH4; -var MarketingH5 = require('pui-react-typography').MarketingH5; -var MarketingH6 = require('pui-react-typography').MarketingH6; -``` - -```react_example_table -This is an h1 - -This is an h2 - -This is an h3 - -This is an h4 - -This is an h5 - -This is an h6 -``` -*/ - -/*doc ---- -title: Custom -name: 04_type_custom_react -parent: type_react ---- - -``` -var Heading = require('pui-react-typography').Heading; -``` - -Usually, you want to use the provided headings. If your mock doesn't exactly match, you should try the normal headings, -and see if it still looks ok. If it doesn't (this should be rare!) you can use our custom type generator. - -You may want to wrap this in a custom reusable React component rather than calling it directly. - -```react_example -This is a custom h1 -```*/ diff --git a/styleguide/package.json b/styleguide/package.json index 0703ce0a0..9366a88be 100644 --- a/styleguide/package.json +++ b/styleguide/package.json @@ -87,7 +87,6 @@ "pui-react-tile-layout": "file:../library/dist/react/tile-layout", "pui-react-toggle": "file:../library/dist/react/toggle", "pui-react-tooltip": "file:../library/dist/react/tooltip", - "pui-react-typography": "file:../library/dist/react/typography", "react": "^0.14.2", "zeroclipboard": "^2.1.6" }, diff --git a/styleguide/src/pivotal-ui-components.js b/styleguide/src/pivotal-ui-components.js index 7b0bb76ba..8eb329e79 100644 --- a/styleguide/src/pivotal-ui-components.js +++ b/styleguide/src/pivotal-ui-components.js @@ -26,7 +26,6 @@ assignToGlobal([ require('pui-react-images'), require('pui-react-inputs'), require('pui-react-labels'), - require('pui-react-typography'), require('pui-react-media'), require('pui-react-modals'), require('pui-react-notifications'),