cloudfoundry/cloud_controller_ng

View on GitHub
docs/v3/source/stylesheets/screen.css.scss

Summary

Maintainability
Test Coverage
@charset "utf-8";
@import 'normalize';
@import 'variables';
@import 'icon-font';
@import 'version-dropdown';

/*
Copyright 2008-2013 Concur Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
*/

////////////////////////////////////////////////////////////////////////////////
// GENERAL STUFF
////////////////////////////////////////////////////////////////////////////////

html, body {
  color: $main-text;
  padding: 0;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: $font-size-s;
  @extend %default-font;
  background-color: $main-bg;
  height: 100%;
  -webkit-text-size-adjust: none; /* Never autoresize text */
}

*, *::before, *::after {
  box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
  margin: 1.414em 0 0.5em;
  font-weight: bold;
  line-height: 1.2;
}

h1, .h1 {
  margin-top: 0;
  font-size: $font-size-xxl;
}

h2, .h2 {
  font-size: $font-size-xl;
}

h3, .h3 {
  font-size: $font-size-l;
}

h4, .h4 {
  font-size: $font-size-m;
}

h5, .h5 {
  font-size: $font-size-s;
}

a, .link {
  border-bottom: 1px dotted #cddce5;
  color: $blue1;
  text-decoration: none;
  -webkit-transition: all 0.1s linear;
  -moz-transition: all 0.1s linear;
  transition: all 0.1s linear;
}

////////////////////////////////////////////////////////////////////////////////
// TABLE OF CONTENTS
////////////////////////////////////////////////////////////////////////////////

#toc > ul > li > a > span {
  float: right;
  background-color: #2484FF;
  border-radius: 40px;
  width: 20px;
}

nav {
  background: $main-bg;
  padding: 16px;
}

.toc-wrapper {
  transition: left 0.3s ease-in-out;

  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  bottom: 0;
  width: $nav-width;
  font-size: 14px;
  border-right: 1px solid #ccc;

  // This is the logo at the top of the ToC
  & > img {
    display: block;
    width: 100%;
  }

  & > .search {
    position: relative;

    input {
      border: none;
      border-bottom: 1px solid #ccc;
      padding: 4px 0 4px 28px;
      margin-top: $nav-v-padding;
      height: 32px;
      width: 100%;
      box-sizing: border-box;
      border-radius: 0;
    }

    &:before {
      position: absolute;
      top: 18px;
      left: 8px;
      color: $nav-text;
      @extend %icon-search;
    }
  }

  img + .toc {
    margin-top: $logo-margin;
  }

  .search-results {
    margin-top: 0;
    margin-bottom: 1em;
    height: 0;
    background: #fbfbfb;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    transition-property: height, margin;
    transition-duration: 180ms;
    transition-timing-function: ease-in-out;
    padding: 0;
    box-shadow: inset 0px -4px 17px rgba(0,0,0,0.05);

    &.visible {
      height: 30%;
    }

    li {
      margin: 16px;
      line-height: 1;
    }

    a {
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }
  }

  .toc-item {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  .toc-link {
    color: $gray1;

    &.toc-focus {
      color: $blue1;
    }
  }

  // The Table of Contents is composed of multiple nested
  // unordered lists.  These styles remove the default
  // styling of an unordered list because it is ugly.
  ul, li {
    list-style: none;
    margin: 0;
    line-height: 28px;
  }

  li {
    padding: 0;
    transition-property: background;
    transition-timing-function: linear;
    transition-duration: 230ms;
  }

  // This is the currently selected ToC entry
  .toc-focus {
    box-shadow: 0px 1px 0px $nav-active-shadow;
    color: $nav-active-text;
  }

  .toc-header {
    padding: 0;
    font-weight: bold;
  }

  // Subheaders are the submenus that slide open
  // in the table of contents.
  .toc-subheader {
    display: none; // tocify will override this when needed
    font-weight: 400;
    padding-left: $nav-padding;
  }
}

// button to show navigation on mobile devices
#nav-button {
  span {
    display: block;
    $side-pad: $main-padding / 2 - 8px;
    padding: $side-pad $side-pad $side-pad;
    background-color: rgba($main-bg, 0.7);
    transform-origin: 0 0;
    transform: rotate(-90deg) translate(-100%, 0);
    border-radius: 0 0 0 5px;
  }

  padding: 0 1.5em 5em 0; // increase touch size area
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  color: #000;
  text-decoration: none;
  font-weight: bold;
  opacity: 0.7;
  line-height: 16px;
  border: none;

  img {
    height: 16px;
    vertical-align: bottom;
  }

  transition: left 0.3s ease-in-out;

  &:hover {
    opacity: 1;
  }

  &.open {
    left: $nav-width
  }
}


////////////////////////////////////////////////////////////////////////////////
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
////////////////////////////////////////////////////////////////////////////////

.page-wrapper {
  margin-left: $nav-width;
  position: relative;
  z-index: 10;
  background-color: $main-bg;
  min-height: 100%;

  padding-bottom: 1px; // prevent margin overflow

  // The dark box is what gives the code samples their dark background.
  // It sits essentially under the actual content block, which has a
  // transparent background.
  // I know, it's hackish, but it's the simplist way to make the left
  // half of the content always this background color.
  .dark-box {
    width: $examples-width;
    background-color: $code-background-color;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
  }
}

////////////////////////////////////////////////////////////////////////////////
// CONTENT STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff with the light background in the left half of the page

.content {
  // to place content above the dark box
  position: relative;
  z-index: 30;

  &:after {
    content: '';
    display: block;
    clear: both;
  }

  & > h1, & > h2, & > h3, & > h4, & > h5, & > h6, & > p, & > table, & > ul, & > ol, & > aside, & > dl {
    margin-right: $examples-width;
    padding: 0 $main-padding;
    display: block;

    @extend %left-col;
  }

  & > ul, & > ol {
    padding-left: $main-padding + 15px;
  }

  // the div is the toc hidden div for placeholding stuff
  & > h1, & > h2, & > div {
    clear: both;
  }

  h1 {
    @extend %header-font;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #ccc;
    margin-bottom: $h1-margin-bottom;
    margin-top: 2em;
    border-top: 1px solid #ddd;
  }

  h1:first-child, div:first-child + h1 {
    border-top-width: 0;
    margin-top: 0;
  }

  h2, h3 {
    @extend %header-font;
    margin-top: 4em;
    margin-bottom: 0;
    border-top: 1px solid #ccc;
    padding-top: 1.2em;
    padding-bottom: 1.2em;
    clear: both;
  }

  // h2s right after h1s should bump right up
  // against the h1s.
  h1 + h2, h1 + div + h2 {
    margin-top: $h1-margin-bottom * -1;
    border-top: none;
  }

  // Eliminate right-panel margin at p + h* border
  // Replace space-creating margin with padding
  p + div + h2 {
    margin-bottom: $section-divide-margin;
    padding-bottom: $section-divide-padding;
  }

  h1 + p, h1 + pre + p {
    margin-top: $section-divide-margin;
    padding-top: $section-divide-padding;
  }

  hr {
    margin: 2em 0;
    border-top: 2px solid $code-snippet-background-color;
    border-bottom: 2px solid $main-bg;
  }

  table {
    margin-bottom: 1em;
    overflow: auto;

    th, td {
      text-align: left;
      vertical-align: top;
      line-height: 1.6;
    }

    th {
      padding: 5px 10px;
      border-bottom: 1px solid #ccc;
      vertical-align: bottom;
      @extend %header-font;
      font-size: 15px;
    }

    td {
      padding: 10px;
      font-size: 14px;
    }

    tr:last-child {
      border-bottom: 1px solid #ccc;
    }

    tr:nth-child(odd) > td {
      background-color: lighten($table-row-bg, 4.2%);
    }

    tr:nth-child(even) > td {
      background-color: lighten($table-row-bg, 2.4%);
    }
  }

  dt {
    font-weight: bold;
  }

  dd {
    margin-left: 15px;
  }

  p, li, dt, dd {
    line-height: 1.6;
    margin-top: 0;
  }

  img {
    max-width: 100%;
  }

  code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 3px;
    border-radius: 3px;
    @extend %code-font;
    hyphens: auto;
  }

  pre > code {
    background-color: transparent;
    padding: 0;
  }

  aside {
    padding-top: 1em;
    padding-bottom: 1em;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    background: $aside-notice-bg;
    line-height: 1.6;

    &.warning {
      background-color: $aside-warning-bg;
    }

    &.success {
      background-color: $aside-success-bg;
    }
  }

  aside:before {
    vertical-align: middle;
    padding-right: 0.5em;
    font-size: 14px;
  }

  aside.notice:before {
    @extend %icon-info-sign;
  }

  aside.warning:before {
    @extend %icon-exclamation-sign;
  }

  aside.success:before {
    @extend %icon-ok-sign;
  }
}

////////////////////////////////////////////////////////////////////////////////
// CODE SAMPLE STYLES
////////////////////////////////////////////////////////////////////////////////
// This is all the stuff that appears in the right half of the page

.content {
  pre, blockquote {
    background-color: $code-background-color;
    color: #fff;

    padding: 32px;
    margin: 0;
    width: $examples-width;

    float: right;
    clear: right;

    @extend %right-col;

    & > p {
      margin: 0;
    }

    a {
      color: #fff;
      text-decoration: none;
      border-bottom: dashed 1px #ccc;
    }
  }

  pre {
    @extend %code-font;
    font-size: $font-size-xs;
  }

  // provide blockquote styles to pre tags as an alternative to changing which tag is produced by the Markdown processor
  @each $lang in $lexed-languages {
    pre.highlight.#{$lang} {
      border-radius: 0;
      color: #ccc;
      background-color: $code-snippet-background-color;
    }

    pre.highlight.#{$lang} > code {
      background-color: $code-snippet-background-color;
    }

    pre.highlight.#{$lang} > code .w {
      background-color: $code-snippet-background-color;
    }
  }

  pre.highlight.plaintext {
    background-color: darken($code-snippet-background-color, 10%);
    white-space: normal;
    padding: 16px 32px;

    code {
      @extend %default-font;
      font-weight: bold;
    }
  }

  blockquote {
    & > p {
      background-color: $code-annotation-bg;
      border-radius: 5px;
      padding: $code-annotation-padding;
      color: #ccc;
      border-top: 1px solid #000;
      border-bottom: 1px solid #404040;
    }
  }
}

////////////////////////////////////////////////////////////////////////////////
// RESPONSIVE DESIGN
////////////////////////////////////////////////////////////////////////////////
// These are the styles for phones and tablets
// There are also a couple styles disperesed

@media (max-width: $tablet-width) {
  .toc-wrapper {
    left: -$nav-width;

    &.open {
      left: 0;
    }
  }

  .page-wrapper {
    margin-left: 0;
  }

  #nav-button {
    display: block;
  }

  .toc-wrapper .toc-item > a {
    padding-top: 0.3em;
    padding-bottom: 0.3em;
  }
}

@media (max-width: $phone-width) {
  .dark-box {
    display: none;
  }

  %left-col {
    margin-right: 0;
  }

  %right-col {
    width: auto;
    float: none;
  }

  %right-col + %left-col {
    margin-top: $main-padding;
  }
}

.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs {
  color: #909090;
}

.highlight, .highlight .w {
  background-color: $code-background-color;
}