Giter VIP home page Giter VIP logo

athenaeum's Introduction

Athenaeum - A React Component Library (RCL)

The RCL is a tool to help create and maintain robust design systems, allowing a developer to roll out higher quality, more consistent User Interfaces (UI) faster.

To see it in action, visit: http://rcl.policygenius.com/v4.1.2/index.html

The RCL relies heavily on the following technologies. If you want to learn more about them and how to customize/configure the RCL, take a look at the documentation:

We use Babel to compile our JS, which allows us to use the latest features of the language.

Using the RCL locally

  1. Clone the repo:

git clone [email protected]:policygenius/athenaeum.git

  1. Install dependencies

yarn

  1. Start the server

yarn start

  1. If you want to work on the RCL and another repo simultaneously, symlink to Athenaeum while continuously watching and building to the lib directory, which is what is used to publish the package to npm:

yarn link && yarn build:publish:watch

and in your other repo:

yarn link 'athenaeum'

  1. Rebuild your dependencies, yarn run reset

Using the NPM package

The RCL is published as a package called "Athenaeum", which can be found here.

Installing the package:

yarn add athenaeum or npm install athenaeum

Using an RCL component:

RCL components are React components, which are exported as a collection of modules you can import/require like you would any other JS dependency:

e.g.

import { TextComponent, Button, Layout, Col } from 'athenaeum';

function MyReactComponent( props ) {
return (
  <div>
    <Layout>
      <TextComponent type={6}>I am a header!</TextComponent>
      <Col>
        I am a column!
      </Col>
      <Button>Submit!</Button>
    </Layout>
  </div>
  )
}

export default MyReactComponent;

The RCL gets exported with a bundled JS file and a CSS file. To use the RCL stylesheet, you can either import them directly into your project:

import 'athenaeum/lib/assets/styles.css';

OR simply link to the latest version of the styles in your HTML:

<link href="http://rcl.policygenius.com/{{v5.5.2 or latest version}}/assets/styles.css" rel="stylesheet">

Running tests

Note: Test will be run automatically as part of a githook on git push

yarn test

OR

yarn test [filepath]

The RCL uses the following for testing. If you want to learn more about them and how to customize/configure the RCL, take a look at the documentation:

Finding your way around

/src
- atoms (Buttons, Icons, Text, etc.)
- molecules (Form Fields, Lists, Image Asides, etc.)
- organisms (Forms, Tables, etc.)
- templates (Headers, Navigators, Footers, etc.)

Our RCL is structured around the concepts put forth by Atomic Design. The smallest components are ATOMS, which are used to make MOLECULES, which are used to make ORGANISMS, which are lastly used to make TEMPLATES.

Adding New Icons

Upload the icons to our Google Cloud Bucket:

  1. gzip the svg
  • gzip -9 -S 'z' newIcon.svg
  1. Upload newIcon.svgz
  • gsutil -h "Content-Encoding:gzip" -h "Content-Type:image/svg+xml" -h "Cache-Control:public,max-age=31536000" cp newIcon.svgz gs://pg-static-assets/svgs/newIcon.svgz

Add icon name to the list of possible icon values:

  1. src/atoms/Icon/constants.js

Contributing

Gotchas:

SCSS / CSS and How our CSS-Module config works

  • Our CSS Module config creates complex, hashed classes like this: animate-module__shake--3Q0r1 which is [name of the component]__[local classname]--[hash:base64:5]'.
  • When webpack comes across an imported SCSS (import styles from './button.module.scss'), a new class is created name-spaced with the directory from where that file exists and added to the file css output file.
  • That import styles.. will return a "styles" object of key / value pairs in this format: { "plain classname": "complex hashed classname" }
  • You can then add classes to your JSX thus: className: styles['classname']

To prevent a bloated final CSS file, DON'T use the @import to import scss files that contain CSS selectors. %placeholders, @mixin, @functions are OK.

Coding styles and standards

Most of our styles are enforced by linters (stylelint, eslint, eslint-plugin-markdown), which must follow for the builds to pass.

For anything not specifically addressed in the linters, use Airbnb's styleguides:

Continuous Integration and Deployment

We use Buildkite as a CI server. Every commit triggers a build with Buildkite that will run a series of checks and tests before giving a green light to merge to master.

There is 1 pipelines associated with this project:

athenaeum pipeline - builds the project, runs test. When a branch is then merged to master, a new build is triggered. After a build on master passes all of its, it will need to be manually unblocked before being deployed to production and published to npm. This manual unblock is a prompt requiring you to bump the package version, for which we use Semantic Versioning.

Code reviews

Your branch code should always be reviewed before it gets merged to master. Do not work on the master branch.

Here's a nice guide on how to Code Review.


The RCL and the Athenaeum project is a product by PolicyGenius.

athenaeum's People

Contributors

randy-the-robot avatar jmcolella avatar drewdrewthis avatar patrickkim avatar patrickskim avatar sunnymis avatar danielnovograd avatar trevornelson avatar jexeones24 avatar j-clark avatar randy-concepcion avatar p-duke avatar bradwheel avatar jdanz avatar petrgazarov avatar jl08 avatar gdhagger avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.