[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

nertzy/pivotal-ui

 
 

Repository files navigation

Welcome to Pivotal UI

Build pipeline

Pivotal UI is a collection of React components that are styled for the Pivotal brand. Visit the live styleguide here.

Starting with Pivotal UI

We've created two starter projects to help transitioning to Pivotal UI and React.

Using Pivotal UI - React Components

Environment

We assume your project has the following:

  • node/npm
  • A module loader such as Webpack or Browserify - Pivotal UI modules follow the CommonJS pattern
  • A JSX transpiler such as Babel - Pivotal UI components are written in JSX
  • React - Pivotal UI components are React components

Install

  1. cd /path/to/your/web/assets
  2. npm init
  3. npm install --save pui-react-buttons

Usage

Javascript:

var React = require('react');
var DefaultButton = require('pui-react-buttons').DefaultButton;

var MyTestPage = React.createClass({
 getInitialState: function() {
   return {showMessage: false};
 },

 showMessage: function() {
   this.setState({showMessage: true});
 },

 render: function() {
   return (
     <div className="container">
       <DefaultButton  Message</DefaultButton>
       { this.state.showMessage ? <h1>Hello world!</h1> : null }
     </div>
   );
 }
});

ReactDOM.render(<MyTestPage />, document.getElementById('root'));

HTML:

<html>
<body>
    <div id="root"></div>
    <script src="<path-to-your-project's-compiled-javascript-file>"></script>
</body>
</html>

Using Pivotal UI - CSS Components

React is the recommended approach, but some elements are available in HTML/CSS:

  1. curl http://styleguide.pivotal.io/components.css> <path-to-your-asset-build-folder>/components.css

  2. Add the css and javascript files to your html template

    <!doctype html>
    <html>
    <head>
        <link rel="stylesheet" href="<path-to-your-asset-build-folder>/components.css">
        <script src="<path-to-your-project's-root-folder>/node-modules/jquery/dist/jquery.js"></script>
        <script src="<path-to-your-project's-root-folder>/node-modules/bootstrap/dist/js/bootstrap.js"></script>
    </head>
    <body>
        <div class="container">
            <h1 class="type-brand-1 em-high">Hello world!</h1>
        </div>
    </body>
    </html>

Using Pivotal UI - SCSS variables and mixins

If you are building CSS using Sass, you can get pivotal-ui variables and mixins from the pui-css-variables-and-mixins node module:

  1. npm install --save pui-css-variables-and-mixins

  2. Use in your .scss files

    @import '<path-to-your-projects-node-modules>/pui-css-variables-and-mixins/pui-variables.scss';
    @import '<path-to-your-projects-node-modules>/pui-css-variables-and-mixins/mixins.scss';
    
    .bg-special {
      background-color: $brand-1;
    }

Contributing

Please refer to our contribution guidelines

Copyright Notice

Copyright 2016 Pivotal Software, Inc. All Rights Reserved.

Packages

No packages published

Languages

  • JavaScript 77.0%
  • CSS 22.8%
  • Other 0.2%