Skip to content

Commit

Permalink
feat(visual): added flex layout
Browse files Browse the repository at this point in the history
* without media-q
  • Loading branch information
pimenovoleg committed Jul 14, 2018
1 parent 0d3294d commit b487f28
Show file tree
Hide file tree
Showing 15 changed files with 666 additions and 160 deletions.
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
'progress-bar',
'datepicker',
'timepicker',
'layout'
'visual'
]
]
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
"server-dev:typography": "npm run server-dev -- --env.component typography",
"server-dev:badge": "npm run server-dev -- --env.component badge",
"server-dev:checkbox": "npm run server-dev -- --env.component checkbox",
"server-dev:navbar": "npm run server-dev -- --env.component navbar"
"server-dev:navbar": "npm run server-dev -- --env.component navbar",
"server-dev:layout": "npm run server-dev -- --env.component layout"
},
"lint-staged": {
"linters": {
Expand Down
31 changes: 31 additions & 0 deletions src/lib-dev/layout/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Component, NgModule, ViewEncapsulation } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';


@Component({
selector: 'app',
template: require('./template.html'),
styleUrls: ['./styles.scss'],
encapsulation: ViewEncapsulation.None
})
export class DemoComponent {}


@NgModule({
declarations: [
DemoComponent
],
imports: [
BrowserModule
],
bootstrap: [
DemoComponent
]
})
export class DemoModule {}

platformBrowserDynamic()
.bootstrapModule(DemoModule)
.catch((error) => console.error(error));

36 changes: 36 additions & 0 deletions src/lib-dev/layout/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import '../../lib/core/visual/prebuilt/default-visual';

@include mosaic-visual();

.colorNested > div div {
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.26);
opacity: 0.9;
color: white;
text-align: center;
}

.colorNested > div div:nth-child(1) {
background-color: #009688;
}
.colorNested > div div:nth-child(2) {
background-color: #3949ab;
}
.colorNested > div div:nth-child(3) {
background-color: #9c27b0;
}

.colorNested > div div:nth-child(4) {
background-color: #8bc34a;
}

.colorNested > div div:nth-child(5) {
background-color: #deb867;
}

.colorNested > div div:nth-child(6) {
background-color: #FF5722;
}

.colorNested > div div:nth-child(7) {
background-color: #03A9F4;
}
76 changes: 76 additions & 0 deletions src/lib-dev/layout/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<h2>Layout</h2>

<div class="colorNested">
<div class="layout-row">
<div class="flex">
class="flex"
</div>
<div class="flex">
class="flex"
</div>
</div>
</div>

<h2>Flex Percent Values</h2>
<div class="colorNested">
<div class="layout-row layout-wrap">
<div class="flex-30">
class="flex-30"
</div>
<div class="flex-45">
class="flex-45"
</div>
<div class="flex-25">
class="flex-25"
</div>
<div class="flex-33">
class="flex-33"
</div>
<div class="flex-66">
class="flex-66"
</div>
<div class="flex-50">
class="flex-50"
</div>
<div class="flex">
class="flex"
</div>
</div>
</div>

<h1>Other Flex Values</h1>
<div class="colorNested">
<div class="layout-wrap layout-row">
<div class="flex-none">
class=flex-none
</div>
<div class="flex">
class=flex
</div>
<div class="flex-grow">
class="flex-grow"
</div>
<div class="flex-auto">
class="flex-auto"
</div>
<div class="flex-auto">
class="flex-auto"
</div>
<div class="flex-initial">
class="flex-initial"
</div>
</div>
</div>

<h2>Flex Offset Attribute</h2>

<div class="colorNested">
<div class="layout-row">
<div class="flex flex-offset-33">
class="flex flex-offset-33"
</div>
<div class="flex">
class="flex"
</div>
</div>
</div>
30 changes: 30 additions & 0 deletions src/lib/core/styles/common/_rtl.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// mixin definition ; sets LTR and RTL within the same style call
// @see https://css-tricks.com/almanac/properties/d/direction/

@mixin rtl($prop, $ltr-value, $rtl-value) {
#{$prop}: $ltr-value;

[dir=rtl] & {
#{$prop}: $rtl-value;
}
}

@mixin rtl-prop($ltr-prop, $rtl-prop, $value, $reset-value) {
#{$ltr-prop}: $value;

[dir=rtl] & {
#{$ltr-prop}: $reset-value;
#{$rtl-prop}: $value;
}
}

// To reverse padding (top left bottom right) -> (top right bottom left)
@function rtl-value($list) {
@if length($list) == 4 {
@return nth($list, 1) nth($list, 4) nth($list, 3) nth($list, 2)
}
@if length($list) == 5 {
@return nth($list, 1) nth($list, 4) nth($list, 3) nth($list, 2) nth($list, 5)
}
@return $list;
}
8 changes: 0 additions & 8 deletions src/lib/core/styles/grid/_grid-utils.scss

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/core/styles/grid/_grid.scss

This file was deleted.

136 changes: 0 additions & 136 deletions src/lib/core/styles/grid/_layout.scss

This file was deleted.

12 changes: 0 additions & 12 deletions src/lib/core/styles/grid/_variables.scss

This file was deleted.

8 changes: 8 additions & 0 deletions src/lib/core/visual/_all-visual.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
@import './body';
@import './layout';
@import './layout-media';


@mixin mosaic-visual() {

// include specific mixins

@include layouts_for_breakpoint();
@include layout-padding-margin();

@include media-print();
}
11 changes: 11 additions & 0 deletions src/lib/core/visual/_layout-media.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


@mixin media-print {

@media print {

.hide-print:not(.show-print):not(.show) {
display: none !important;
}
}
}
Loading

0 comments on commit b487f28

Please sign in to comment.