Browse Source

adding new helpers

refactoring
master
HerrHase 6 years ago
parent
commit
d820037394
15 changed files with 169 additions and 134 deletions
  1. +37
    -1
      src/scss/_config.scss
  2. +8
    -37
      src/scss/components/_button.scss
  3. +29
    -0
      src/scss/components/_code.scss
  4. +4
    -0
      src/scss/components/_table.scss
  5. +0
    -24
      src/scss/components/_typography.scss
  6. +9
    -0
      src/scss/crispy.scss
  7. +1
    -1
      src/scss/helpers/_align.scss
  8. +0
    -19
      src/scss/helpers/_background-color.scss
  9. +1
    -3
      src/scss/helpers/_helpers.scss
  10. +4
    -5
      src/scss/helpers/_margin.scss
  11. +40
    -0
      src/scss/helpers/_media.scss
  12. +0
    -19
      src/scss/helpers/_text-color.scss
  13. +33
    -0
      src/scss/helpers/_text.scss
  14. +2
    -20
      src/scss/mixins/_font.scss
  15. +1
    -5
      src/scss/mixins/_mixins.scss

+ 37
- 1
src/scss/_config.scss View File

@ -11,7 +11,7 @@ $crispy__font-size: 16px !default;
$crispy__golden-ratio: 1.618 !default; $crispy__golden-ratio: 1.618 !default;
// margin // margin
$crispy__margin: pxToEm(20px) !default;
$crispy__margin: 5px !default;
// colors // colors
$crispy__color-primary: #f0c209 !default; $crispy__color-primary: #f0c209 !default;
@ -23,6 +23,7 @@ $crispy__color-info: #0090d4 !default;
$crispy__color-text: #363636 !default; $crispy__color-text: #363636 !default;
$crispy__color-background: #ffffff !default; $crispy__color-background: #ffffff !default;
// colors as map
$crispy__colors: ( $crispy__colors: (
'primary': $crispy__color-primary, 'primary': $crispy__color-primary,
'secondary': $crispy__color-secondary, 'secondary': $crispy__color-secondary,
@ -39,3 +40,38 @@ $crispy__body__line-height: $crispy__golden-ratio !default;
$crispy__body__direction: ltr !default; $crispy__body__direction: ltr !default;
$crispy__body__color: $crispy__color-text !default; $crispy__body__color: $crispy__color-text !default;
$crispy__body__background-color: $crispy__color-background !default; $crispy__body__background-color: $crispy__color-background !default;
// font-sizes as map
$crispy__font-sizes: (
'default': $crispy__body__font-size,
'small': 16px,
'large': 20px
) !default;
// buttons colors
$crispy__button__colors: (
'default': (
'color': #ffffff,
'background-color': $crispy__color-primary
),
'secondary': (
'color': #ffffff,
'background-color': $crispy__color-secondary
),
'success': (
'color': #ffffff,
'background-color': $crispy__color-success
),
'warning': (
'color': #ffffff,
'background-color': $crispy__color-warning
),
'danger': (
'color': #ffffff,
'background-color': $crispy__color-danger
),
'info': (
'color': #ffffff,
'background-color': $crispy__color-info
)
) !default;

+ 8
- 37
src/scss/components/_button.scss View File

@ -12,39 +12,6 @@ $crispy__button__border: 0 !default;
$crispy__button__up-margin: pxToEm(20px) !default; $crispy__button__up-margin: pxToEm(20px) !default;
$crispy__button__up-padding: pxToEm(8px) pxToEm(13px) !default; $crispy__button__up-padding: pxToEm(8px) pxToEm(13px) !default;
$crispy__button__font-sizes: (
'default': $crispy__body__font-size,
'small': 14px,
'large': 28px
) !default;
$crispy__button__colors: (
'default': (
'color': #ffffff,
'background-color': $crispy__color-primary
),
'secondary': (
'color': #ffffff,
'background-color': $crispy__color-secondary
),
'success': (
'color': #ffffff,
'background-color': $crispy__color-success
),
'warning': (
'color': #ffffff,
'background-color': $crispy__color-warning
),
'danger': (
'color': #ffffff,
'background-color': $crispy__color-danger
),
'info': (
'color': #ffffff,
'background-color': $crispy__color-info
)
) !default;
@mixin crispy__button() { @mixin crispy__button() {
.button { .button {
position: relative; position: relative;
@ -86,10 +53,6 @@ $crispy__button__colors: (
&:focus { &:focus {
outline: none; outline: none;
} }
// font-sizes & colors
@include font-sizes($crispy__button__font-sizes);
@include crispy__button__colors($crispy__button__colors);
} }
/** /**
@ -106,6 +69,10 @@ $crispy__button__colors: (
} }
} }
/**
*
*
*/
@mixin crispy__button__colors($colors) { @mixin crispy__button__colors($colors) {
@each $name, $color in $colors { @each $name, $color in $colors {
@ -121,6 +88,10 @@ $crispy__button__colors: (
} }
} }
/**
*
*
*/
@mixin crispy__button__color($color) { @mixin crispy__button__color($color) {
$background-color: false; $background-color: false;
$text-color: false; $text-color: false;


+ 29
- 0
src/scss/components/_code.scss View File

@ -0,0 +1,29 @@
/**
* code
*
*
* @author Björn Hase
*
*/
$crispy__code__font-family: monospace, monospace !default;
$crispy__code__padding: pxToEm(10px) pxToEm(20px) !default;
$crispy__code__margin: 0 0 pxToEm($crispy__margin) !default;
$crispy__code__border: 1px solid #d4d4d4 !default;
$crispy__code__background-color: #f9f9f9 !default;
@mixin crispy__code() {
.code {
font-family: $crispy__code__font-family;
white-space: pre;
display: block;
overflow-y: hidden;
overflow-x: auto;
padding: $crispy__code__padding;
border: $crispy__code__border;
background-color: $crispy__code__background-color;
margin: $crispy__code__margin;
}
}

+ 4
- 0
src/scss/components/_table.scss View File

@ -40,6 +40,10 @@ $crispy__table__striped__background-color: lighten($crispy__color-text, 75%) !de
} }
} }
&--scroll {
overflow-x: auto;
}
td { td {
color: $crispy__table__color; color: $crispy__table__color;
} }


+ 0
- 24
src/scss/components/_typography.scss View File

@ -1,24 +0,0 @@
/**
*
*
* @author Björn Hase
*
*/
@mixin crispy__typography() {
code {
font-family: monospace, monospace;
font-size: 1em;
white-space: pre;
display: block;
overflow-y: hidden;
overflow-x: auto;
padding: 10px 20px;
border: 1px solid #d4d4d4;
background-color: #f9f9f9;
margin: 0 0 $crispy__margin;
}
}

+ 9
- 0
src/scss/crispy.scss View File

@ -13,11 +13,20 @@
'helpers/helpers'; 'helpers/helpers';
// button
@include crispy__button(); @include crispy__button();
// font-sizes & colors
.button {
@include crispy__font-sizes($crispy__button__font-sizes);
@include crispy__button__colors($crispy__button__colors);
}
@include crispy__heading(); @include crispy__heading();
@include crispy__table(); @include crispy__table();
@include crispy__typography(); @include crispy__typography();
// helpers
@include crispy__align(); @include crispy__align();
@include crispy__margin(); @include crispy__margin();
@include crispy__background-color(); @include crispy__background-color();

+ 1
- 1
src/scss/helpers/_align.scss View File

@ -1,5 +1,5 @@
/** /**
* align
* helpers for align
* *
* *
* *


+ 0
- 19
src/scss/helpers/_background-color.scss View File

@ -1,19 +0,0 @@
/**
* background-color
*
* modificators for text-color
*
*
* @author Björn Hase
*
*/
$crispy__background-colors: $crispy__colors !default;
@mixin crispy__background-color() {
@each $name, $color in $crispy__background-colors {
.background-#{$name} {
background-color: $color;
}
}
}

+ 1
- 3
src/scss/helpers/_helpers.scss View File

@ -1,7 +1,5 @@
@import @import
'align', 'align',
'background-color',
'margin', 'margin',
'media', 'media',
'text-color',
'visibilty';
'text';

+ 4
- 5
src/scss/helpers/_margin.scss View File

@ -1,15 +1,14 @@
/** /**
* margin
*
*
* helpers for margin
* *
*
* *
* @author Björn Hase * @author Björn Hase
* *
*/ */
$crispy__margin-top: $crispy__margin !default;
$crispy__margin-bottom: $crispy__margin !default;
$crispy__margin-top: pxToEm($crispy__margin) !default;
$crispy__margin-bottom: pxToEm($crispy__margin) !default;
@mixin crispy__margin() { @mixin crispy__margin() {
.margin-top-0x { .margin-top-0x {


+ 40
- 0
src/scss/helpers/_media.scss View File

@ -0,0 +1,40 @@
/**
* helpers for media elements
*
*
* @author Björn Hase
*
*/
@mixin crispy__media() {
.img-responsive {
}
.img-fit-contain {
object-fit: contain;
}
.img-fit-cover {
object-fit: cover;
}
.video-responsive {
display: block;
overflow: hidden;
padding: 0;
position: relative;
width: 100%;
iframe, object, embed {
border: 0;
bottom: 0;
height: 100%;
left: 0;
position: absolute;
right: 0;
top: 0;
width: 100%;
}
}
}

+ 0
- 19
src/scss/helpers/_text-color.scss View File

@ -1,19 +0,0 @@
/**
* text-colors
*
* modificators for text-color
*
*
* @author Björn Hase
*
*/
$crispy__text-colors: $crispy__colors !default;
@mixin crispy__text-colors() {
@each $name, $color in $crispy__text-colors {
.text-#{$name} {
color: $color;
}
}
}

+ 33
- 0
src/scss/helpers/_text.scss View File

@ -0,0 +1,33 @@
/**
* helpers for text
*
* - font-sizes
* - color
* - background-color
*
*
* @author Björn Hase
*
*/
$crispy__text-colors: $crispy__colors !default;
@mixin crispy__text() {
@each $name, $color in $crispy__font-sizes {
.text-#{$name} {
@include font-size($font-size);
}
}
@each $name, $color in $crispy__text-colors {
.text-#{$name} {
color: $color;
}
}
@each $name, $color in $crispy__text-colors {
.background-#{$name} {
background-color: $color;
}
}
}

+ 2
- 20
src/scss/mixins/_font.scss View File

@ -1,4 +1,5 @@
/** /**
* fonts
* *
* *
* *
@ -13,26 +14,7 @@
* @param {px} $font-size * @param {px} $font-size
* *
*/ */
@mixin font-size($font-size) {
@mixin crispy__font-size($font-size) {
font-size: $font-size; font-size: $font-size;
font-size: pxToRem($font-size); font-size: pxToRem($font-size);
} }
/**
* add modificators for font-size from a map
*
*
* @param {map} $font-sizes
*
*/
@mixin font-sizes($font-sizes) {
@each $name, $font-size in $font-sizes {
@if ($name == 'default') {
@include font-size($font-size);
} @else {
&--#{$name} {
@include font-size($font-size);
}
}
}
}

+ 1
- 5
src/scss/mixins/_mixins.scss View File

@ -1,7 +1,3 @@
@import
'font',
'media-queries';
/** /**
* clearfix to end floating * clearfix to end floating
* *
@ -25,7 +21,7 @@
* *
* *
*/ */
@mixin crispy__list-clear() {
@mixin crispy__clearlist() {
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;


Loading…
Cancel
Save