Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Clean up base PL styles #236

Merged
merged 3 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 0 additions & 93 deletions components/_patterns/00-base/_mixins.scss

This file was deleted.

2 changes: 1 addition & 1 deletion components/_patterns/00-base/global/01-colors/colors.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="sg-colors">
{% for item in items %}
<li>
<div class="sg-swatch" style="background: {{item.value}};"></div>
<div class="sg-colors__sample" style="background: {{item.value}};"></div>
<div class="sg-info">
<span>{{item.value}}</span> <br/>
<code>{{item.name}}</code>
Expand Down
13 changes: 0 additions & 13 deletions components/_patterns/00-base/global/02-animations/_animation.scss

This file was deleted.

22 changes: 22 additions & 0 deletions components/_patterns/00-base/global/animations/_animation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// Mixin - Transition
@mixin transition($transition-property, $transition-time, $method) {
-webkit-transition: $transition-property $transition-time $method;
-moz-transition: $transition-property $transition-time $method;
-ms-transition: $transition-property $transition-time $method;
-o-transition: $transition-property $transition-time $method;
transition: $transition-property $transition-time $method;
}

.animate-fade {
@include transition(opacity, 0.3s, ease-out);

&:hover {
opacity: 0;
}
}

.animate-move {
> .demo-shape {
@include transition(all, 0.8s, ease-in-out);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
@include add-grid(12);
@include add-gutter(1/4);

// Breakpoints variables
$xs: 25em;
$small: 26em;
$medium: 41em;
$large: 48em;
$xl: 75em;
/////////////////////
// Global Breakpoints

// Avoid using in favor of atomic, content-specific, breakpoints.
// These should be used for generic code, like layouts and typography, only.
$xs: 320px;
$small: 480px;
$medium: 720px;
$large: 920px;
$xl: 1224px;
// The max-width breakpoint is used when the design should be applied at whatever the
// largest breakpoint is regardless of actual pixel value. e.g. removing outer margin on body wrapper
$max-width: $xl;

/// Mixin - xs Breakpoint
Expand Down
50 changes: 50 additions & 0 deletions components/_patterns/00-base/global/base/_03-mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/////////////////////
// General Mixins (put specific ones in component files where applicable)

/// Mixin - Clearfix.
/// Adds clearfix based on http://bourbon.io/docs/#clearfix
/// use example = @include cleafix

@mixin clearfix {
&::after {
clear: both;
content: "";
display: table;
}
}

/// Mixin - Wrapper
/// Outer container mixin for large screens
@mixin wrapper($container-max-width: $max-width, $outer-container-break: $small, $v-margin: 0, $v-padding: 0, $h-padding: $space, $h-padding-large: $h-padding) {
max-width: #{$container-max-width};
width: 100%;
margin: #{$v-margin} auto;
padding: #{$v-padding} #{$h-padding};

@include breakpoint($outer-container-break) {
padding: #{$v-padding} #{$h-padding-large};
}

@include breakpoint($container-max-width) {
padding-left: calc(#{$h-padding-large} + calc(-50vw + calc(#{$container-max-width} / 2)));
padding-right: calc(#{$h-padding-large} + calc(-50vw + calc(#{$container-max-width} / 2)));
}
}

/// Use the breakout mixin for elements that should be edge-to-edge
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about separating all the full-width pieces out into a gist? I like the code, but this is really a project-specific need and makes the wrapper mixin a little less approachable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The breakout mixin doesn't affect the wrapper mixin in any way. The wrapper mixin will stay exactly the same, even if we remove the breakout mixin.

I'd like to keep the breakout in here. Maybe I just need to record a quick "Here's how to use this" video, or write a blogpost.

I don't think it's project-specific, it's just "any time you have a broad-context container (like body or main) and you need a way to have a full-width element, this is how you do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries - it was a minor nitpick to begin with. More prescriptive than my taste for Emulsify "core," but you're right about it not simplifying the breakout mixin. I was thinking we could get rid of some of the breakout mixin args, but you're using them all anyway.

I don't think a post/video is necessary for such a small piece of code (although showing off how it was used on a client project might be cool). It might not hurt to add some CSS comments or a link to someone else's post in the code (not necessary but maybe helpful for someone who hadn't come across that technique).

/// Even when a parent container uses the wrapper mixin
@mixin breakout($v-padding: $space-double) {
margin-left: calc(-50vw + 50%);
margin-right: calc(-50vw + 50%);
padding-left: calc(#{$v-padding} + calc(-50vw + 50%));
padding-right: calc(#{$v-padding} + calc(-50vw + 50%));
}

/// Mixin - Standard Margin
@mixin margin {
margin-bottom: 1em;
}

@mixin no-bottom {
margin-bottom: 0;
}
5 changes: 5 additions & 0 deletions components/_patterns/00-base/global/base/_04-base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.main {
@include wrapper;

display: block; // Fix for IE weirdness
}
82 changes: 82 additions & 0 deletions components/_patterns/00-base/global/base/_pl-base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// These styles are specifically for Pattern Lab.
// They are not used by the site in any way.

.sg-main {
@include wrapper;
}

.pl-template {
display: flex;
flex-flow: column nowrap;
}

.pl,
.sg-main {
.sg-subtype h2 {
font-size: 3rem;
text-transform: uppercase;
background-color: $gray-darker;
margin: 0 calc(-50vw + 50%) $space calc(-50vw + 50%);

a {
@include wrapper(
$v-padding: $space
);

display: block;
color: $white;
text-decoration: none;
line-height: 1;
}
}

.sg-pattern-title {
color: #738ba3;
font-size: 1.4rem !important;
text-transform: none !important;

a {
color: #1169ba !important;
font-family: Calibre;
font-size: 2.2rem;
font-weight: 500;
text-transform: uppercase !important;
}
}

.sg-pattern-extra-info {
width: 100%;
}

.sg-pattern-extra-code {
display: none;
}

.visually-hidden {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
overflow: hidden;
height: 1px;
width: 1px;
word-wrap: normal;
}

.sg-colors {
display: flex;
flex-wrap: wrap;
list-style: none;
padding: 0;
margin: 0;

li {
flex: 0 0 100px;
margin: 0 0.5rem 1rem;
}

&__sample {
display: block;
height: 100px;
margin-bottom: 0.3em;
}
}
}
6 changes: 4 additions & 2 deletions components/_patterns/01-atoms/02-text/text/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
margin: #{$margin};
}

@mixin no-bottom {
margin-bottom: 0;
@mixin body-copy {
font-family: $font-body;
font-size: 0.9rem;
line-height: 1.6em;
}

body {
Expand Down
8 changes: 8 additions & 0 deletions components/_patterns/01-atoms/03-lists/_lists.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/// Mixin - list-reset
/// Reset list item defaults when no margin, padding, list styles needed
@mixin list-reset {
list-style: none;
margin: 0;
padding: 0;
}

ul,
ol {
padding-left: 1em;
Expand Down
1 change: 0 additions & 1 deletion components/css/README.md

This file was deleted.

63 changes: 0 additions & 63 deletions components/css/pattern-scaffolding.css

This file was deleted.

Loading