1.5.6 • Published 1 year ago

@luaguillande/scss_helpers v1.5.6

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

Scss Helpers Library

Scss Helpers Lbrary is a toolkit of mixins and classes designated to help you to style your SCSS.

Quick start guide

1. Add the library to your project

    $ npm install @luaguillande/scss_helpers

2. Import

2.1 Import as needed in app.scss

  @import '~@luaguillande/scss_helpers/_text';
  @import '~@luaguillande/scss_helpers/_colors';
  @import '~@luaguillande/scss_helpers/_display';
  @import '~@luaguillande/scss_helpers/_flexbox';
  @import '~@luaguillande/scss_helpers/_paddings';
  @import '~@luaguillande/scss_helpers/_margins';
  @import '~@luaguillande/scss_helpers/_helpers';
  @import '~@luaguillande/scss_helpers/normalize';

2.2 Or import all the files

    @import '~@luaguillande/scss_helpers/all';

3. Set your colors

Set the theme in a _color_set.scss then map the colors in the @include in the app.scss (or the file where your are importing the library). You also can create new class names by changing the variable name. Now you wil be able to use the variables in other scss files importing the _color_set file and also use like classes in your html.

  //_color_set.scss

  $primary:  #f9cd16;
  $secondary: #3C3C3B;
  $error: #ff5d48;
  // ...
  //app.scss
  
  @include colors(
      $primary:  $primary,
      $secondary: $secondary,
      $error: $error,
      // ...
  )

4. Use the classes in your html

  <div class="primary-text secondary pa-5 mx-10 my-3">My Div</div>

5. Classes List

Margins and Paddings

The Paddings and Margins are responsive and can be changed according the device

{property}{direction}-{device}-{size}

PropertyDirectionDeviceSizes
p for paddingspa, py, px, pl, pr, pt, pbnothing, xs, sm, md, lg, xl1 to 24
m for paddingsma, my, mx, ml, mr, mt, mbnothing, xs, sm, md, lg, xl1 to 24

PropertyMedia Query
nothingAplies in all devices
xsmax-width 420px
smmax-width 800px
mdmax-width 1025px
lgmax-width 1601px
xlmin-width 1601px

Paddings

PropertyDirection
papadding
pypadding-top and padding-bottom
pxpadding-left and padding-right
plpadding-left
prpadding-right
ptpadding-top
pbpadding-bottom

Margins

PropertyDirection
mamargin
mymargin-top and margin-bottom
mxmargin-left and margin-right
mlmargin-left
mrmargin-right
mtmargin-top
mbmargin-bottom

Example:

  <div class="pa-10 pa-xs-2 my-lg-10">My Div</div>

Colors

For backgrounds: {name} For text colors: {name}--text

Example:

  <div class="primary white--text">My Div</div>

You can also use 5 lighter and darker color variables automatically generated from your theme.

  <div class="primary-lighten-1--text secondary--darken-3">My Div</div>

In scss files:

@import '_color_set.scss

  .my-class{
    color: $primary,
    border 1px solid $secondary
    background-color: $error
  }

Align Text

Classes to help the text alignment

ClassProperty
text-lefttext-align: left
text-righttext-align: right
text-centertext-align: center

Example:

  <div class="text-left">My Div</div>

Text Transform

Classes to change the text case

ClassProperty
text-uppercasetext-transform:: uppercase
text-lowercasetext-transform:: lowercase
text-capitalizetext-transform:: capitalize

Example:

  <div class="text-uppercase">My Div</div>

Font Weight

Classes to change the font-weight

ClassProperty
font-100font-weight: 100
font-200font-weight: 200
font-300font-weight: 300
font-400font-weight: 400
font-500font-weight: 500
font-600font-weight: 600
font-700font-weight: 700
font-800font-weight: 800
font-900font-weight: 900

Display by Device

Classes to change the display property. Use d-{device}-{value}

ClassAttributeDevice
d-nonedisplay: noneall devices
d-blockdisplay: blockall devices
d-flexdisplay: flexall devices
d-griddisplay: gridall devices
d-inlinedisplay: inlineall devices
d-inline-flexdisplay: inline-flexall devices
d-inline-blockdisplay: inline-blockall devices
d-{device}-nonedisplay: noneapply media query
d-{device}-blockdisplay: blockapply media query
d-{device}-flexdisplay: flexapply media query
d-{device}-griddisplay: gridall devices
d-{device}-inlinedisplay: inlineapply media query
d-{device}-inline-flexdisplay: inline-flexall devices
d-{device}-inline-blockdisplay: inline-blockall devices

PropertyMedia Query
xsmax-width 420px
smmin-width 421px
mdmin-width 800px
lgmin-width 1025px
xlmin-width 1601px

Example:

  <div class="d-xs-none d-sm-flex">My Div</div>

FlexBox

Classes to help the layout with display:flex

Use the class="d-flex" to apply the display:flex style.

Wrapping

ClassPropertyDetails
flex-wrapflex-wrap: wrapbreaks child elements into new lines when space runs out
flex-no-wrapflex-wrap: nowrapkeeps child elements on the same line, even if there is no space
flex-{device}-wrapdisplay: flexapply media query
flex-{device}-no-wrapdisplay: inlineapply media query

PropertyMedia Query
xsmax-width 420px
smmin-width 421px
mdmin-width 800px
lgmin-width 1025px
xlmin-width 1601px

Vertical Align

ClassPropertyDetails
align-centeralign-items: centervertically centers the child element
align-flex-endalign-items: flex-endaligns the child element at the end of the parent element
align-stretchalign-items: stretchvertically distribute the child elements
align-baselinealign-items: baselinealign the child elements in baseline

Horizontal Align

ClassPropertyDetails
justify-centerjustify-items: centerhorizontally centers the child element
justify-flex-endjustify-items: flex-endhorizontally aligns the child element at the end of the parent element
justify-space-betweenjustify-items: space-betweenhorizontally distribute the child elements
justify-space-aroundjustify-items: space-aroundhorizontally distribute the child elements

Example:

  <div class="d-flex flex-wrap justify-space-around align-center">My Div</div>

Helpers

Ellipsis for text-overflow.

ClassPropertyDetails
ellipsisscss .ellipsis{ white-space: nowrap; text-overflow: ellipsis; overflow: hidden }Make truncate effect.

]

Example:

  <div class="ellipsis">My Div</div>

Smooth Scroll

The _helpers.scss file includes a smooth scroll set tho the scroll behavior.

Scroll

You can import the _scroll.scss in your app.sccs and set a color to make a beautiful scrollbar.

$scroll-color: $primary;

@import "node_modules/@luaguillande/scss_helpers/_scroll";

or

$scroll-color: '#333';

@import "node_modules/@luaguillande/scss_helpers/_scroll";

Normalize

This package includes the Normalize Library v8.0.1.

Enjoy!

@luaguillande - 31solutions.com

1.5.6

1 year ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.5.2

3 years ago

1.4.3

3 years ago

1.5.1

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.0

4 years ago

1.1.4

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.1

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago