Skip to content

general cleanup #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 11, 2017
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
1 change: 0 additions & 1 deletion apps/drupal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Apply the Design System to a single Drupal behavior
*/

import $ from 'jquery';
import _ from 'lodash';

import designSystem from '../../source/design-system';
Expand Down
1 change: 1 addition & 0 deletions apps/drupal/particle.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ component-libraries:
pages:
paths:
- ../../source/_patterns/05-pages
- ../../source/_patterns/05-pages/homepage
4 changes: 4 additions & 0 deletions apps/pl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import _ from 'lodash';
// PL-only components, regardless of design system
import 'atoms/grid';
import 'atoms/image/demo';
import * as homepage from 'pages/homepage';

// Full design system. May dupe the above, but Webpack don't care.
import designSystem from '../../source/design-system';
Expand All @@ -30,3 +31,6 @@ _.forEach(designSystem, (component) => {
console.log(component.name);
component.enable($context, settings);
});

// PL-only components may need enabled as well!
homepage.enable();
1 change: 1 addition & 0 deletions apps/pl/pattern-lab/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ plugins:
pages:
paths:
- ../../../source/_patterns/05-pages
- ../../../source/_patterns/05-pages/homepage
6 changes: 5 additions & 1 deletion apps/pl/scss/_scss2json.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Import Everything from Base.
// This includes Bootstrap
@import '../../../source/_patterns/00-base/config';
@import '../../../source/_patterns/00-base/variables';

// Customized Sass Mapping
// Pulled from Bootstrap's _variables.scss
Expand All @@ -23,6 +23,8 @@ $font-weights-demo: (
bold: $font-weight-bold
);

$spacing-demo: $spacing;

// Import your Customized Variables here, example:
//@import '../_patterns/01-atoms/button/_button.scss';

Expand All @@ -40,6 +42,8 @@ $icons-demo: (
// Include your Customized Sass Maps here to JSONIFY
@include export-data('scssVariables.json', (
scssColors: $theme-colors, // Colors generated from Bootstrap's
scssBreakpoints: $grid-breakpoints,
scssSpacing: $spacing-demo,
fontFamilies: $font-families-demo,
fontSizes: $font-sizes-demo,
fontWeights: $font-weights-demo,
Expand Down
1 change: 0 additions & 1 deletion source/_data/baseScssVars.json

This file was deleted.

14 changes: 13 additions & 1 deletion source/_data/scssVariables.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
"dark": "rgb(52, 58, 64)",
"test": "rgb(255, 192, 203)"
},
"scssBreakpoints": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. If we update this in the grid component, this will update correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these values are coming from bootstrap's $grid-breakpoints(). if needed, they would get overridden probably inside of _variables.scss, similar to how we are able to override $theme-colors()

"xs": 0,
"sm": "576px",
"md": "768px",
"lg": "992px",
"xl": "1200px"
},
"scssSpacing": {
"s": "5px",
"m": "25px",
"l": "50px"
},
"fontFamilies": {
"$font-family-base": [
"-apple-system",
Expand Down Expand Up @@ -57,4 +69,4 @@
"search"
]
}
}
}
11 changes: 6 additions & 5 deletions source/_patterns/00-base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/// This guarantees both de-duplication and existence of required, generated CSS.
///

@import 'config';
@import 'variables';

// Bootstrap CSS-generating output
@import '~bootstrap/scss/root';
Expand All @@ -21,7 +21,8 @@
@import '~bootstrap/scss/code';

// Custom CSS-generating output
@import 'type';
@import 'forms';
@import 'tables';
@import 'transitions';
@import 'printing/type';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is much clearer. Thank you!

@import 'printing/forms';
@import 'printing/tables';
@import 'printing/transitions';
@import 'printing/html-elements';
16 changes: 0 additions & 16 deletions source/_patterns/00-base/_config.scss

This file was deleted.

37 changes: 37 additions & 0 deletions source/_patterns/00-base/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
///
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to aim to have this more fully documented on the front end docs project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. this is mostly a companion to the large comment in _base.scss, the other "main" sass file, to hopefully really underscore the printing/nonprinting difference. that distinction should/will be covered thoroughly in the FE docs

/// Global VARIABLES and HELPERS
///
/// Place global config here like Bootstrap's _variables.scss.
/// This kind of config is often required prior to importing any libraries (ie Bootstrap Sass), and
/// does not produce any CSS, just variables and maps.
///
/// All .scss files NEED TO INCLUDE this file as the top import to ensure consistent settings.
/// Particle does not glob Sass! Because there is no printing CSS output in this file, webpack will
/// safely squash any duplication.
///
/// @example
/// ```scss
/// @import '../../00-base/variables';
/// ```
/// This guarantees every component is styled with the same presets.
///

// Custom non-printing tools
@import 'non-printing/functions';
@import 'non-printing/colors';
@import 'non-printing/mixins';

// (Other non-printing .scss), ie font families, spacing, etc
$spacing: (
s: 5px,
m: 25px,
l: 50px,
);

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment right here that this is where we can override bootstrap variables (that aren't just overriden in a component later on).

// Bootstrap non-printing tools
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/mixins";

// import anything else non-printing that may depend on variables in this file!
// @import 'non-printing/project-specific-mixins'
9 changes: 4 additions & 5 deletions source/_patterns/00-base/demo/breakpoints.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

<div class="sg-breakpoints">
<ul class="breakpoints">
{% for bpVarName, bpVarData in baseScssVars if '$bp--' in bpVarName %}
{% set value = bpVarData.value ~ bpVarData.unit %}
{% for bp, value in scssBreakpoints %}
<li style="left: {{ value }}">
<span class="label">{{ bpVarName }}:<br/>{{ value }}</span>
<span class="label">{{ bp }}:<br/>{{ value }}</span>
</li>
{% endfor %}
</ul>
Expand All @@ -18,5 +17,5 @@
</ul>
</div>


<p>To add to these items, use Sass variables that start with $bp-- in _breakpoints.scss</p>
<p>To add or change these items, override Bootstrap's <code>$grid-breakpoints</code> inside <code>_variables.scss</code></p>
<p>See <a target="_blank" href="https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints">Bootstrap's docs</a> for more.</p>
10 changes: 4 additions & 6 deletions source/_patterns/00-base/demo/spacing.twig
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<h1>Spacing</h1>
{% for spacingVarName, spacingVarData in baseScssVars if '$spacing--' in spacingVarName %}
{% set value = spacingVarData.value ~ spacingVarData.unit %}

<div style="margin: 5px;">
{% for spacing, value in scssSpacing %}
<div style="margin: 10px;">
<div style="height: {{ value }}; width: {{ value }}; outline: solid 1px black; display: inline-block; margin-right: 5px;"></div>
<span>{{ valule }} : <code>{{ spacingVarName }}</code></span>
<span>{{ value }} : <code>$spacing({{ spacing }})</code></span>
</div>
{% endfor %}

<p>To add to these items, use Sass variables that start with <code>$spacing--</code> in <code>_spacing.scss</code></p>
<p>To add to these items, adjust <code>$spacing()</code> in <code>_variables.scss</code></p>

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'config';
@import '../variables';

// Bootstrap override variables go here.
// See available vars in ~bootstrap/scss/_variables.scss, i.e.
Expand Down
7 changes: 7 additions & 0 deletions source/_patterns/00-base/printing/_html-elements.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import '../variables';

// Use this file for any global layout rules you want applied after
// Bootstrap's Reboot does it's thing, but don't necessarily fit into
// another pattern here.
//
// @see https://v4-alpha.getbootstrap.com/content/reboot/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'config';
@import '../variables';

// Bootstrap override variables go here.
// See available vars in ~bootstrap/scss/_variables.scss, i.e.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'config';
@import '../variables';

// Bootstrap override variables go here.
// See available vars in ~bootstrap/scss/_variables.scss, i.e.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'config';
@import '../variables';

// Bootstrap override variables go here.
// See available vars in ~bootstrap/scss/_variables.scss, i.e.
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/badge/_badge.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap list-item variables,
// copy from ~bootstrap/scss/variables to here
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/branding/_branding.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// All component Sass needs non-printing base config
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap card variables, SEE ~bootstrap/scss/variables
// Add bootstrap variables here
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/breadcrumb/_breadcrumb.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// All component Sass needs non-printing base config
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap breadcrumb variables, SEE ~bootstrap/scss/variables
// Add bootstrap variables here
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/button/_button.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap card variables,
// copy from ~bootstrap/scss/variables to here
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/grid/_grid.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../00-base/config';
@import '../../00-base/variables';

// Bootstrap override variables go here.
// See available vars in ~bootstrap/scss/_variables.scss
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/icon/demo/icons.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<li>It is recommended that all SVGs be on the same size canvas (512px x 512px). All glyphs are scaled up to the size of the largest glyph otherwise.</li>
<li>Adding new SVGs to the folder requires restarting the webpack dev server.</li>
<li>Font icons inherit the color of their parent text.</li>
<li>The generated font named <strong>{{ scssIcons.fontname }}</strong> will be <a href="https://github.com/webpack-contrib/url-loader">base64 inlined</a> into the output CSS.</li>
<li>The generated font named <strong>{{ scssIcons.fontname }}</strong> will be <a href="https://github.com/webpack-contrib/url-loader" target="_blank">base64 inlined</a> into the output CSS.</li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/image/_image.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../00-base/config';
@import '../../00-base/variables';

// Override any Bootstrap image vars here
@import '~bootstrap/scss/images';
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/01-atoms/list-group/_list-group.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap list-item variables,
// copy from ~bootstrap/scss/variables to here
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/02-molecules/card/_card.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// All component Sass needs non-printing base config
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap card variables, SEE ~bootstrap/scss/variables
// Add bootstrap variables here
Expand Down
2 changes: 1 addition & 1 deletion source/_patterns/02-molecules/jumbotron/_jumbotron.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// All component Sass needs non-printing base config
@import '../../00-base/config';
@import '../../00-base/variables';

// To change default bootstrap jumbotron variables, SEE ~bootstrap/scss/variables
// Add bootstrap variables here
Expand Down
9 changes: 9 additions & 0 deletions source/_patterns/04-templates/site-container.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{#{% include '@organisms/header' %}#}

<main class="site-content">
{% block content %}
<h2>Site Content Here</h2>
{% endblock %}
</main>

{#{% include '@organisms/footer' %}#}
Empty file.
Empty file removed source/_patterns/05-pages/.gitkeep
Empty file.
12 changes: 0 additions & 12 deletions source/_patterns/05-pages/homepage.js

This file was deleted.

10 changes: 0 additions & 10 deletions source/_patterns/05-pages/homepage.twig

This file was deleted.

8 changes: 8 additions & 0 deletions source/_patterns/05-pages/homepage/homepage.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "@templates/site-container.twig" %}
{% block content %}
<h6>I should fail pa11y</h6>

<h1 class="homepage__header">this is a pattern lab only demo of the HOMEPAGE</h1>

<p class="homepage__text">asdfafdsd blerp</p>
{% endblock %}
14 changes: 14 additions & 0 deletions source/_patterns/05-pages/homepage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import $ from 'jquery';

const defaultSettings = { color: 'orange' };

export const name = 'homepage';

export function disable() {}

export function enable(context = $(document), settings = defaultSettings) {
$('.homepage__header', context).css('color', settings.color);
$('.homepage__text', context).html('overwritten from homepage js');
}

export default enable;