Skip to content

Commit

Permalink
Refactor UI Framework directory structure to house everything in a sr…
Browse files Browse the repository at this point in the history
…c directory.

- Add components.js and services.js files to continue to export JS modules from the root.
  • Loading branch information
cjcenizal committed Jul 14, 2017
1 parent ab131c0 commit 2dc97c7
Show file tree
Hide file tree
Showing 37 changed files with 106 additions and 24 deletions.
6 changes: 3 additions & 3 deletions tasks/ui_framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ module.exports = function (grunt) {

function uiFrameworkCompile() {
sass.render({
file: 'ui_framework/components/index.scss'
file: 'ui_framework/src/index.scss'
}, function (error, result) {
if (error) {
grunt.log.error(error);
}

postcss([postcssConfig])
.process(result.css, { from: 'ui_framework/components/index.scss', to: 'ui_framework/dist/ui_framework.css' })
.process(result.css, { from: 'ui_framework/src/index.scss', to: 'ui_framework/dist/ui_framework.css' })
.then(result => {
grunt.file.write('ui_framework/dist/ui_framework.css', result.css);

Expand All @@ -102,7 +102,7 @@ module.exports = function (grunt) {
return new Promise(() => {
debouncedCompile();

chokidar.watch('ui_framework/components', { ignoreInitial: true }).on('all', (event, path) => {
chokidar.watch('ui_framework/src', { ignoreInitial: true }).on('all', (event, path) => {
grunt.log.writeln(event, path);
debouncedCompile();
});
Expand Down
1 change: 1 addition & 0 deletions ui_framework/components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/components';
3 changes: 0 additions & 3 deletions ui_framework/components/global_styles/_index.scss

This file was deleted.

18 changes: 0 additions & 18 deletions ui_framework/components/index.scss

This file was deleted.

1 change: 1 addition & 0 deletions ui_framework/services.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/services';
File renamed without changes.
File renamed without changes.
Empty file.
17 changes: 17 additions & 0 deletions ui_framework/src/global_styling/mixins/_typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Some mixins that help us deal with browser scaling of text more consistantly.
// Essentially, fonts across kui should scale agains the root html element, not
// against parent inheritance.


// Typography mixins

@function convertToRem($size) {
@return #{$size / $kuiFontSize}rem;
}

// Spit out rem and px

@mixin fontSize($size: $kuiFontSize) {
font-size: $size;
font-size: convert-to-rem($size);
}
Empty file.
73 changes: 73 additions & 0 deletions ui_framework/src/global_styling/variables/_typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Font

// Families
$kuiFontFamily: "Roboto", Helvetica, Arial, sans-serif;
$kuiCodeFontFamily: "Roboto Mono", monospace;

// Font sizes
$kuiFontSize: $kuiSize;

$kuiFontSizeXS: 12px;
$kuiFontSizeS: 14px;
$kuiFontSizeM: $kuiFontSize;
$kuiFontSizeL: 24px;
$kuiFontSizeXL: 32px;
$kuiFontSizeXXL: 48px;

// Line height

$kuiLineHeight: 1.5 * $kuiFontSize;

// Font weights

$kuiFontWeightLight: 300;
$kuiFontWeightRegular: 400;
$kuiFontWeightMedium: 500;

// Our base fonts

%kuiFont {
font-family: $kuiFontFamily;
font-weight: $kuiFontWeightRegular;
}

%kuiCodeFont {
font-family: $kuiCodeFontFamily;
}

// Font sizing extends, using rem mixin

%kuiFontSize {
font-size: rem($kuiFontSize);
line-height: $kuiLineHeight;
}

%kuiFontSizeXS {
font-size: rem($kuiFontSizeXS);
line-height: $kuiLineHeight;
}

%kuiFontSizeS {
font-size: rem($kuiFontSizeS);
line-height: $kuiLineHeight;
}

%kuiFontSizeM {
font-size: rem($kuiFontSizeM);
line-height: $kuiLineHeight;
}

%kuiFontSizeL {
font-size: rem($kuiFontSizeL);
line-height: $kuiLineHeight * 1.5;
}

%kuiFontSizeXL {
font-size: rem($kuiFontSizeXL);
line-height: $kuiLineHeight * 2;
}

%kuiFontSizeXXL {
font-size: rem($kuiFontSizeXXL);
line-height: $kuiLineHeight * 3;
}
11 changes: 11 additions & 0 deletions ui_framework/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Configuration
@import 'global_styling/variables/index';
@import 'themes/light_theme/index';

// Core
@import 'global_styling/mixins/index';
@import 'global_styling/reset/index';
@import 'global_styling/utilities/index';

// Components
@import 'components/index';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.

0 comments on commit 2dc97c7

Please sign in to comment.