Code Monkey home page Code Monkey logo

shell's Introduction

Shell logo

Contents

What is Shell?

A powerful, lightweight, mostly unopinionated, responsive friendly CSS library that provides a solid foundation for any UI build.

Built with Β :blue_heart:Β  by Campaign Monitor, which is why we say mostly unopinionated πŸ˜„.

A docs website is in the works, in the meantime Shell's code is heavily documented.

If you would like to suggest any new additions or improvements to Shell, log any issues or bugs, or just ask a question, please open a new GitHub issue and label it appropriately. If you would like to contribute see CONTRIBUTING.md.

Install

npm install shell-csslib --save-dev

There are other install options e.g. git clone, however, it's advised to use a package manager like NPM to handle your third-party dependencies πŸ‘.

Setup

Once the shell-csslib NPM module is installed your project will look like this:

project root
└── node_modules
    β”œβ”€β”€ shell-csslib

Your master Sass stylesheetβ€”we typically call ours style.scssβ€”should be setup like this:

@charset 'UTF-8';

/* ============================================================================
   MASTER STYLESHEET
   ========================================================================= */

/**
 * CONTENTS:
 *
 * 1. Your settings
 * 2. Shell CSS library
 * 3. Your styles
 *
 * N.B. the above order of sections #1 and #2 must be maintained otherwise Sass
 * will not compile!
 */




/* 1. Your settings incl. any Shell setting overrides
   ========================================================================= */

@import 'settings';




/* 2. Shell CSS library
   ========================================================================= */

/**
 * N.B. do not change the order of these partial imports!
 */

@import '~shell-csslib/src/settings';

@import '~shell-csslib/src/mixins-functions';

@import '~shell-csslib/src/normalise-reset';

@import '~shell-csslib/src/base';

@import '~shell-csslib/src/container';

@import '~shell-csslib/src/grid';

@import '~shell-csslib/src/helpers';




/* 3. Your styles
   ========================================================================= */

// Away you go!

Shell won't work without _settings.scss and _mixins-functions.scss, the rest are optional.

Example architecture

project root
β”œβ”€β”€ css
β”‚   β”œβ”€β”€ components
β”‚   β”œβ”€β”€ vendor
β”‚   β”œβ”€β”€ _settings.scss
β”‚   └── style.scss
└── node_modules
    β”œβ”€β”€ shell-csslib

Dependencies

  • Sass (either Ruby or LibSass, we recommend LibSass).

  • Autoprefixer.

    PostCSS plugin to parse CSS and add vendor prefixes to CSS rules using values from Can I Use.

    We advise setting up Autoprefixer as part of your build process.

Docs and tests

Linting

Stylelint is used for linting and Shell follows these CSS conventions applied by stylelint.config.js.

Eventually linting will be setup as part of CI, see: #19.

For now, you can go to your Terminal, cd into the root of Shell, and run:

gulp lint

This will lint all of the .scss files in:

  • src/**/*.scss
  • docs/src/**/*.scss
  • test/src/**/*.scss

Browser support

  • Chrome (latest version)
  • Firefox (latest version)
  • Opera (latest version)
  • Safari (latest version)
  • Edge (latest version)
  • IE 10/11

Versioning

Shell is maintained under the Semantic Versioning guidelines. We'll do our best to adhere to those guidelines and strive to maintain backwards compatibility.

See the CHANGELOG.

License

Copyright 2016 Campaign Monitor.

View license.

shell's People

Contributors

chris-pearce avatar daveordead avatar davidberner avatar williamtsoi1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shell's Issues

Grid > Negative bottom margin bug

Steps to reproduce:

  • create component with 2 col grid inside (no modifiers).
  • put placeholder content in the cells
    • Put background colour on wrapping component to help visualise bug
  • create another 2 col grid beneath this with a heading in one of the cells.

You will see the second grid has been pulled up under the first so the heading is cut in half.

Apply Campaign Monitor CSS conventions via Stylelint, and update Stylelint

When this happens review all stylelint disable/enable comments, e.g.

@mixin hidpi-bg-img($img-url, $img-width: auto, $img-height: auto) {
    /* stylelint-disable */
    @media (min-resolution: $shell-g-hidpi-dppx),
           (min-resolution: $shell-g-hidpi-dpi) {
    /* stylelint-enable */
        background-image: url('#{$img-url}');
        background-size: $img-width $img-height;
    }
}

Make sure to update the config file and remove stylelint_config.js.

Questionable rule in Normalise/Reset

This rule in Normalise/Reset removes some of OS X's native styling:

Remove rounded corners that iOS applies to all `<input>` buttons and certain
browsers e.g. Chrome, apply rounded corners to `<select>`s.

With the rule:

screen shot 2016-02-24 at 3 55 58 pm

Without the rule:

screen shot 2016-02-24 at 3 55 50 pm

Add a new "Spacing none" helper

I found this is needed, something like:

.h-spacing-none {
    margin-bottom: 0 !important;
}

Can be added to the existing Spacing section in _helpers.scss.

Focus styles

I think this:

:focus
{
    /* normalized default styles for all browsers */
    outline: currentColor dotted thin;
    /* on webkit and blink use focus ring;
       style of β€œauto” hides it, when using mouse or touch */
    outline: -webkit-focus-ring-color auto 5px;
    /*
    if one don't like webkit's ring, use this instead:
    @supports (outline-color: -webkit-focus-ring-color)
    {
        :focus { outline-style: auto; }
    }
    */
}
/* don't use outline on mozilla browsers, if it's not needed */
:focus:not(:-moz-focusring)
{
    outline: none;
}

Should live in Base or Normalise/Reset.

New Grid modifiers

There's a need to add modifiers at the individual grid item level with the most common treatment being different alignments options using flex-self. Also making all grid item children equal height.

12 col grid item CSS missing from Grid

It got added as a setting in _settings.scss but not in _grid.scss 😒.

Should come after:

// 11 col
.l-grid__item--11-col {
    width: $shell-grid-11-col-width;
}

// Apply at breakpoints
@if $shell-grid-apply-11-col-width-at-breakpoints {
    @include apply-at-breakpoints(".l-grid__item--11-col", $shell-grid-define-11-col-width-breakpoints) {
        width: $shell-grid-11-col-width;
    }
}

Variable naming discrepancy

I've started using shell in a few projects now, and one of the things I've come across that threw me was the different naming variants for scales. (the base keyword on spacing for example)

Example:

$shell-g-font-size-heading-small
$shell-g-font-size-heading
$shell-g-font-size-heading-large

$shell-g-spacing-small
$shell-g-spacing-base
$shell-g-spacing-large

$shell-container-maximum-width-small
$shell-container-maximum-width
$shell-container-maximum-width-large

I'm used to the difference now, but I imagine new adopters will find this annoying too as the spacing variable is the only scale that includes the base word.

Why the f*** is it not compiling?!

  • Me

Disclaimer: I may not use shell in the way it was designed to be used. I never use any of the scaling helper classes. If i need to scale an element (either font-size, font-weight, padding, margin etc) that element will be part of a module, and so I'll be using the SASS variable $shell-g-font-size-heading-large rather than the heading heading--large helper classes.

Consider making the Base link styles into a mixin

It's a common UI pattern to have a <button> look like the default text link e.g. a Button Link component.

Making such a component means you have to copy the CSS for the default text link: https://github.com/campaignmonitor/shell/blob/master/src/_base.scss#L46-L58 which obviously isn't DRY.

Converting the default text link to a mixin will make things DRY as you can then just do this in your Button Link component:

.c-button-link {
    @include base-link;
}

Meaning there's only one source of truth.

Remove base naming convention from Shell's settings

Set up CI

CI Tasks
When a PR is pushed to the Shell repo
  • Passes all CSS linting rules (could use Gulp).
  • Sass compiles (currently a Grunt command exists: grunt testShell, in the test/ folder).
  • Versioning:
    • Grab the version from the .version file and apply it to the "version" object key in the package.json file.
    • Create a git tag: git tag -a vX -m "Version X" where "X" is the version number pulled from the .version file.
When a PR is merged to the master branch
  • Run npm publish.
  • Run git push origin [tagname].

Travis is a good option I think: https://travis-ci.org/.

Remove `l-side-by-side`

This layout module doesn't seem to give us anything we can't achieve with a 2 column grid.

Investigate and remove it if above concern is valid

Search inputs not normalised the same as other textual inputs

type="search" has a different border style than the rest of the textual inputs, see:

screen shot 2016-02-26 at 1 47 42 pm

Most likely due to this, which is needed to remove aggressive user-agent styles:

screen shot 2016-02-26 at 1 48 18 pm

This can be dealt with quite easy in the project styles, or it could be something we add to Normalise/Reset?

Add a new Helper to remove responsive images

This is currently in _base.scss -> Images:

/**
 * Third-party widgetsβ€”like Google Mapsβ€”cannot have their images be responsive
 * as this breaks any images used within them therefore we remove that by
 * applying the two possible Google Map container selectors plus a generic
 * container selector to be used for other third-party widgets.
 *
 * N.B. it is okay to use `!important` here as we're doing it pre-emptively
 * i.e. you know you will always want the rule it's applied to to take
 * precedence.
 */

/* stylelint-disable */

.remove-responsive-images img,
#map_canvas img,
.map_canvas img {
    max-width: none !important;
}

/* stylelint-enable */

It should be in _helpers.scss.

Remove spinner from `number` input type

This may be the CSS to use but make sure it's properly checked:

input[type='number'] {
    appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button,
input[type='number']:hover::-webkit-inner-spin-button,
input[type='number']:hover::-webkit-outer-spin-button {
    appearance: none;
}

Export `scss` libraries via object props

It would be great if we could expose all of shell's libraries via an npm entry js.

For example:

var shell = require('./src/shell.scss');
var settings = require('./src/_settings.scss');

module.exports = {
  settings: settings,
  shell: shell,
  ...
};

This would allow npm modules (and webpack) to consume either the whole scss lib or just relevant libraries.

Create version 1

  • Prepare npm module
  • Set up git tagging
  • Create CHANGELOG.md
  • Create CONTRIBUTING.md
  • Update README.md
  • Update .npmignore
  • #17

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.