1.7.1 • Published 4 years ago

@fantassin/utils v1.7.1

Weekly downloads
14
License
ISC
Repository
gitlab
Last release
4 years ago

CSS Utils

Collection of mixins to help during development

npm i @fantassin/utils

A11Y

  • Colors
  • Screen Reader

Layout

  • Spacings
  • Line Widths
  • Media Queries (breakpoints)

Typography

  • Headings
  • Convert px to rem with rem-calc()

Animations

  • Easings

Examples

Colors

$colors: (
        'black': var(--black),
        'white': var(--white),
        'red': $red,
        'transparent': transparent,
);

$color-from-background-color: (
        'white': getColorFromName('black'),
        'black': var(--white),
        'red': $white,
);

.has-red-background-color {
    background-color: getColorFromName('red');
    color: getColorFromBackgroundColorName('red');
}

Headings

$headings: (
	'h1': (
		'small': (24px, 30px),
		'large': (48px, 60px)
	),
	'h2': (
		'small': (20px, 27px),
		'large': (33px, 45px)
	),
	'h3': (
		'small': (18px, 24px),
		'large': (26px, 35px)
	),
	'h4': (
		'small': (16px, 22px),
		'large': (20px, 27px)
	),
	'h5': (
		'small': (14px, 19px),
		'large': (18px, 27px)
	),
	'h6': (
		'small': (12px, 16px),
		'large': (14px, 19px)
	),
);

h1 {
    @include getHn( 'h1' );
}

Spacings

$spacings : (
    'cover': (
        'small': 20px,
        'large': 40px
    )
    'group': 60px
);

.wp-block-cover {
    getSpacing( 'margin-top', 'cover' );
    getSpacing( 'margin-bottom', 'cover' );
}

.wp-block-group {
    getSpacing( 'padding-top', 'group' );
    getSpacing( 'padding-bottom', 'group' );
}

Line Widths

$line-widths : (
    'paragraph': 720px,
    'heading': 900px
);

h1, 
h2, 
h3, 
h4, 
h5, 
h6 {
    max-width: getLineWidthValue( 'heading' );
}

p, 
ol,
ul {
    max-width: getLineWidth( 'paragraph' ); // Alias of getLineWidthValue().
}

Made by Fantassin

1.7.1

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.0.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

6 years ago

1.1.2

6 years ago