Skip to content

Instantly share code, notes, and snippets.

View ahaywood's full-sized avatar

Amy Haywood Dutton ahaywood

View GitHub Profile
@ahaywood
ahaywood / _icons.scss
Created March 23, 2017 15:48
Setting up an icon system - 2 different options. one that establishes the icon with the style, another as a pseudo element.
$icons: (
  checkmark: a,
  plus: b,
  minus: c
);
 
/* For each key in the map, created an own class */
@each $name, $value in $icons {
  .icon--#{$name} {
    content: $value;
@ahaywood
ahaywood / _colors.scss
Created March 23, 2017 15:48
iMom Color Maping - Wanted a specific color for each of the blog categories
$category-colors : (imom-morning, $ff-yellow, $gray-8),
(movie-monitor, $ff-coral, white),
(pillow-talk, $ff-l-blue, white),
(susan, $ff-limey-green, white),
(marriage, $ff-red, white),
(family-fun, $ff-orange, white),
(printables, $ff-teal, white),
(mom-life, $ff-blue, white),
(quotes, $ff-purple, white),
(parenting, $ff-green, white);
@ahaywood
ahaywood / _social-media.scss
Created March 23, 2017 15:47
Jen Chooses Joy - random background position for social media icons
/* 5 is the number of list items and the number within $list */
$list: "0 0", "50px 0", "100px 0", "150px 0", "200px 0";
@for $i from 1 through 5 {
li:nth-child(#{$i}) {
$imgKey: random(5);
$nth: nth($list, $imgKey);
background-position: #{$nth};
}
}
$types: 4;
$type-width: 20px;
@while $types > 0 {
.while—#{$types} {
width: $type-width + $types;
}
$types: $types - 1;
}
$list: “Amy”, “Henry”, “Isaac”, “Adele”;
@each $person in $list {
.avatar—#{$person} {
background: url(‘avatars/#{$person}.jpg”) no-repeat;
}
}
@ahaywood
ahaywood / _grid.scss
Created March 23, 2017 15:45
Sass @for loop to create a grid system
$class-slug: span !default;
@for $i from 1 through 4 {
.#{$class-slug}-#{$i} {
width: 60px + $i
}
}
@ahaywood
ahaywood / _conditional.scss
Created March 23, 2017 15:43
Sass Conditionals
$white-theme: true !default;
@if $white-theme {
@debug “we’re using the #{$white-theme}”;
background: white;
text: black;
} @else {
@debug “we’re using the #{$black-theme}”;
background: black;
text: white;
@ahaywood
ahaywood / _implementation.scss
Created March 23, 2017 15:42
z-index with Sass maps
.something {
z-index: map-get($zindex, change-your-world);
}
@ahaywood
ahaywood / _breakpoints.scss
Last active March 23, 2017 15:40
Setting up breakpoints
$breakpoints: (
small: 767px,
medium: 992px,
large: 1200px
);
// _mixins.scss
@mixin breakpoint($breakpoint) {
@if map-has-key($breakpoints, $breakpoint) {
@media (min-width: #{map-get($breakpoints, $breakpoint)}) {
@ahaywood
ahaywood / header.scss
Last active September 29, 2021 18:33
WordPress: Mega Menu
/*------------------------------------*\
#PRIMARY-MENU
\*------------------------------------*/
.primary-menu {
@include grid;
@include sans-serif;
font-weight: $bold;
height: $nav-bar-height;
&__wrapper {