Banshee Studio Dev Guide

General Best Practices:

Sass

Specificity

When writing Sass, use 1 selector (element or class, not both). Follow a BEM naming convention for all class names and elements.

Architecture


Abstracts – refers to all variables, mixins and functions.
Base – Top level theme styles such as font sizes, grid and the basic style guide.
Global – Globle components: forms, menu, header and footer etc.
Components – Atoms/components. Buttons, cards, things that appear within layouts across multiple blocks
Utilities – Utility classes.

Measurements

All measurements are on a base 16 system, with 1 Grid Unit being 0.25rem. Throughout the code you may see utility classes like u-marginBottom8gu. This means add a margin-bottom of 8 grid units (0.25rem * 8 = 2rem = 32px). Use rems. Do not use px values for spacing.

Colors:

Utility classes, CSS, SCSS variables are generated with every project and are theme specific.

      swatch('color');

      in action:

      .u-bgColorPink {
        background-color: swatch('Pink');
      }
    

Full List:

  • Green
  • Blue
  • Pink
  • Orange
  • Yellow
  • Gray
  • Neutral
  • Black
  • White
  • Error
  • Success
Primary
Secondary
Tertiary
Neutral
Blue
Orange
Yellow
Green
Pink
Gray
Black
White
Success
Error

Fonts and Type Scale:

This site follows a Minor Third on a base size of 16px or 1rem. This means that each step up is 1.2^step size power, and each step down is 0.833^step size. For more on this see type-scale.com and select the minor third scale.

That's a lot of math, so rather than calculating use the 2 functions where the number you enter is the step away from the baseline.

      typeScalePlus($number)
      typeScaleMinus($number)
    

For example, the copyright in the footer is 2 steps below the baseline so the scss for that could be written like so:

      .copyright {
        font-size: typeScaleMinus(2);
      }
    

There are also utility classes where this can be applied:

.u-textSizePlus5 = 39.81px

.u-textSizePlus2 = 23.04px

.u-textSizePlus1 = 19.20px

.u-textSizeMinus1 = 13.33px

Layouts:

All layouts are to be built on a consistent layout with blocks, containers, then columns if needed. For code reference see

assets/src/sass/base/_grid.scss

The basics

The basic structure is this:

      <section class="block block--modifier">
        <div class="container container--modifier">
          Contents
        </div><!--.container-->
      </section><!--.block-->
    

Or for a multi-column layout:

      <section class="block block--modifier">
        <div class="container container--modifier grid grid--modifier">
          <div class="grid__col">
            Content
          </div><!--.grid__col-->

          <div class="grid__col">
            Content
          </div><!--.grid__col-->
        </div><!--.container-->
      </section><!--.block-->
    

Containers

There are a number of container widths that can be added as class modifiers. The base container class is 85% mobile/95% tablet and up, with a max width to keep it centered. Modifiers will change the max-width or the overall width percentage

.container--narrow container minus 1 column on each side
.container
.container--wide - container plus 1 column on each side
.container--ultra-wide - container with no max width
.container--full - 100% container, no max-width

Multi-column Layouts

As mentioned this is a flexbox grid, based on 12 columns. There are 2 main styles, standard or gutters. In a standard layout all columns are flush, gutters adds gutters.

Note: you can overlay a basic guide over any page of the site by adding ?guides=standard or ?guides=gutters to the url.

In Action:

To make it work add a grid class to your container, and give all child columns the grid__col class. This will make it a flex layout, by default all .grid__col's are even. There are also modifiers for the grid itself that match up with flexbox properties, examples below. You can also reference

assets/src/sass/base/_grid.scss

.grid modifiers
.grid--justify-(start, center, end, space-around, space-between)
Adjusts how the columns are aligned horizontall
.grid--align-(top, center, bottom, stretch)
Adjusts how the columns are aligned vertically
.grid--(row, row-reverse, column, column-reverse)
Directions and row/columns
.grid--(no-wrap, wrap, wrap-reverse)
Rarely used, but they're there
.grid-(sm, md, lg, xl)--(property)
Breakpoint modifiers!! Super important, adding these will apply that class to the specified breakpoint and up. Mobile requires none. .grid-md--row-reverse means that from the medium breakpoint up, the grid will be row reverse.
.grid__col modifiers
.grid__col--(1 thru 12)
How many columns this should span
.grid__col--#--strict
By default these will grow. If you only want it to be X columns, add --strict to it.
.grid__col--#--spaced
For use with the .grid--gutters wrapper, this will add in some margin to create gutters around this column.
.grid__col--offset-(1-11)
Adds margin before this element equal to the columns specified. .grid__col--offset-1 would add 1 column space before, 2 would add 2 etc.
.grid__col--fit-content
Makes this column take up the width of it's children.
.grid__col--flex-(first, last)
Moves this first or last in the order
.grid__col-(sm, md, lg, xl)--(property)
Breakpoint modifiers!! Super important, adding these will apply that class to the specified breakpoint and up. Mobile requires none. .grid__col--12 .grid__col-md--8 would mean at mobile it's full width, at the medium breakpoint and up it's 8 columns.

Standard

.grid__col
.grid__col
.grid__col
.grid__col
.grid__col
.grid__col

Horizontally centered, capped column width

.grid__col--12
.grid__col-md--3--strict
.grid__col--12
.grid__col-md--2--strict
.grid__col--12
.grid__col-md--5--strict

Vertically centered, gutters

.grid__col--12
.grid__col-md--4--spaced
.grid__col--12
.grid__col-md--2--spaced
.grid__col--12
.grid__col-md--6--spaced

Utility Classes

This theme has a large number of premade Utility Classes that are available for use. You do not need to use them, but know that they do exist and you're welcome to them. The goal of having them is so you can make small style changes to elements without having to write additional Sass.

All follow the same naming convention, u-camalcasePropertyValue Some examples are below:

Text Color

  • u-textColorPrimary
  • u-textColorPrimary300
  • u-textColorSecondary
  • u-textColorSecondary300
  • u-textColorNeutral900

Background Color

  • u-bgColorBlack, u-textColorWhite
  • u-bgColorNeutral900, u-textColorPrimary100
  • u-bgColorSecondary

Padding/margin

These behave the same, so they're grouped. These also accept breakpoint modifiers: u-{sm, md, lg, xl}-marginBottom12gu for example.

u-padding8gu
u-paddingHoriz12gu
u-paddingVert20gu u-paddingLeft12gu u-paddingRight4gu
u-marginBottom8gu
u-textUppercase

Others

There are others, check the Sass directory for more.

/assets/src/sass/utilities/
There are some for positions: u-positionFixed, u-positionRelative etc. and displays: u-hidden u-md-block (to show on desktop) as well as others.