From 874d401bac4130b1e2f61bace0e4a330187e7631 Mon Sep 17 00:00:00 2001 From: mustafahlvc Date: Wed, 16 Aug 2017 15:19:26 +0300 Subject: [PATCH] Lots of Responsive refinements applied espacially for the apps + responsive variations of spacing class helpers added. --- src/app/core/scss/mixins/_breakpoints.scss | 113 +++++++++++++- src/app/core/scss/partials/_helpers.scss | 147 ++++++++++-------- src/app/core/scss/partials/_page-layouts.scss | 5 - src/app/core/scss/variables/_theme.scss | 4 +- src/app/core/services/match-media.service.ts | 17 -- .../apps/calendar/calendar.component.html | 4 +- .../event-form/event-form.component.scss | 2 +- .../event-form/event-form.component.ts | 2 +- .../contact-form/contact-form.component.scss | 1 - .../dashboards/project/project.component.html | 8 +- .../file-list/file-list.component.html | 24 +-- .../file-list/file-list.component.scss | 7 - .../file-manager/file-manager.component.html | 6 +- .../sidenavs/details/details.component.html | 2 +- .../dialogs/compose/compose.component.scss | 1 - .../mail-details/mail-details.component.scss | 3 - .../mail/mail-list/mail-list.component.scss | 3 - .../content/apps/mail/mail.component.html | 91 ++++++----- .../content/apps/mail/mail.component.scss | 30 +++- .../main/content/apps/mail/mail.component.ts | 22 +++ .../todo-details/todo-details.component.scss | 4 - .../todo/todo-list/todo-list.component.scss | 4 - .../todo/todo-list/todo-list.component.ts | 12 +- .../content/apps/todo/todo.component.html | 68 ++++---- .../content/apps/todo/todo.component.scss | 30 +++- .../main/content/apps/todo/todo.component.ts | 21 +++ src/app/main/navbar/navbar.component.scss | 2 +- src/app/main/navbar/navbar.component.ts | 4 +- src/app/main/toolbar/toolbar.component.html | 8 +- 29 files changed, 417 insertions(+), 228 deletions(-) diff --git a/src/app/core/scss/mixins/_breakpoints.scss b/src/app/core/scss/mixins/_breakpoints.scss index 5fb7e3b7..c5e38ba7 100644 --- a/src/app/core/scss/mixins/_breakpoints.scss +++ b/src/app/core/scss/mixins/_breakpoints.scss @@ -1,14 +1,26 @@ // Media step breakpoint mixin based on Angular Material lib $breakpoints: ( xs: 'screen and (max-width: 599px)', - gt-xs: 'screen and (min-width: 600px)', sm: 'screen and (min-width: 600px) and (max-width: 959px)', - gt-sm: 'screen and (min-width: 960px)', md: 'screen and (min-width: 960px) and (max-width: 1279px)', - gt-md: 'screen and (min-width: 1280px)', lg: 'screen and (min-width: 1280px) and (max-width: 1919px)', - gt-lg: 'screen and (min-width: 1920px)', - xl: 'screen and (min-width: 1920px) and (max-width: 5000px)' + xl: 'screen and (min-width: 1920px) and (max-width: 5000px)', + lt-sm: 'screen and (max-width: 599px)', + lt-md: 'screen and (max-width: 959px)', + lt-lg: 'screen and (max-width: 1279px)', + lt-xl: 'screen and (max-width: 1919px)', + gt-xs: 'screen and (min-width: 600px)', + gt-sm: 'screen and (min-width: 960px)', + gt-md: 'screen and (min-width: 1280px)', + gt-lg: 'screen and (min-width: 1920px)' +) !default; + +$grid-breakpoints: ( + xs: 0, + sm: 600px, + md: 960px, + lg: 1280px, + xl: 1920px ) !default; @mixin media-breakpoint($breakpointName) { @@ -22,3 +34,94 @@ $breakpoints: ( } } } + +// >> breakpoint-next(sm) +// md +// >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)) +// md +// >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl)) +// md +@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) { + $n: index($breakpoint-names, $name); + @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null); +} + +// Minimum breakpoint width. Null for the smallest (first) breakpoint. +// +// >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)) +// 576px +@function breakpoint-min($name, $breakpoints: $grid-breakpoints) { + $min: map-get($breakpoints, $name); + @return if($min != 0, $min, null); +} + +// Maximum breakpoint width. Null for the largest (last) breakpoint. +// The maximum value is calculated as the minimum of the next one less 0.1. +// +// >> breakpoint-max(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)) +// 767px +@function breakpoint-max($name, $breakpoints: $grid-breakpoints) { + $next: breakpoint-next($name, $breakpoints); + @return if($next, breakpoint-min($next, $breakpoints) - 1px, null); +} + +// Returns a blank string if smallest breakpoint, otherwise returns the name with a dash infront. +// Useful for making responsive utilities. +// +// >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)) +// "" (Returns a blank string) +// >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)) +// "-sm" +@function breakpoint-infix($name, $breakpoints: $grid-breakpoints) { + @return if(breakpoint-min($name, $breakpoints) == null, "", "-#{$name}"); +} + + +// Media of at least the minimum breakpoint width. No query for the smallest breakpoint. +// Makes the @content apply to the given breakpoint and wider. +@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) { + $min: breakpoint-min($name, $breakpoints); + @if $min { + @media (min-width: $min) { + @content; + } + } @else { + @content; + } +} + +// Media of at most the maximum breakpoint width. No query for the largest breakpoint. +// Makes the @content apply to the given breakpoint and narrower. +@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) { + $max: breakpoint-max($name, $breakpoints); + @if $max { + @media (max-width: $max) { + @content; + } + } @else { + @content; + } +} + +// Media that spans multiple breakpoint widths. +// Makes the @content apply between the min and max breakpoints +@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) { + $min: breakpoint-max($lower, $breakpoints); + $max: breakpoint-max($upper, $breakpoints); + + @media (min-width: $min) and (max-width: $max) { + @content; + } +} + +// Media between the breakpoint's minimum and maximum widths. +// No minimum for the smallest breakpoint, and no maximum for the largest one. +// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower. +@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) { + $min: breakpoint-min($name, $breakpoints); + $max: breakpoint-max($name, $breakpoints); + + @media (min-width: $min) and (max-width: $max) { + @content; + } +} diff --git a/src/app/core/scss/partials/_helpers.scss b/src/app/core/scss/partials/_helpers.scss index c517e7d3..6d261285 100644 --- a/src/app/core/scss/partials/_helpers.scss +++ b/src/app/core/scss/partials/_helpers.scss @@ -28,86 +28,101 @@ // ###################### // SPACING HELPERS // ###################### -@each $prop, $abbrev in (margin: m, padding: p) { - @for $index from 0 through 64 { - $size: $index * 4; - $length: #{$size}px; +@each $breakpoint in map-keys($grid-breakpoints) { - .#{$abbrev}-#{$size} { - #{$prop}: $length !important; - } - } + @include media-breakpoint-up($breakpoint) { - @for $index from 0 through 64 { - $size: $index * 4; - $length: #{$size}px; + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); - .#{$abbrev}x-#{$size} { - #{$prop}-right: $length !important; - #{$prop}-left: $length !important; - } + @each $prop, $abbrev in (margin: m, padding: p) { - .#{$abbrev}y-#{$size} { - #{$prop}-top: $length !important; - #{$prop}-bottom: $length !important; - } - } + @for $index from 0 through 64 { + $size: $index * 4; + $length: #{$size}px; - @for $index from 0 through 64 { - $size: $index * 4; - $length: #{$size}px; + .#{$abbrev}#{$infix}-#{$size} { + #{$prop}: $length !important; + } + } - .#{$abbrev}t-#{$size} { - #{$prop}-top: $length !important; - } + @for $index from 0 through 64 { + $size: $index * 4; + $length: #{$size}px; - .#{$abbrev}r-#{$size} { - #{$prop}-right: $length !important; - } + .#{$abbrev}x#{$infix}-#{$size} { + #{$prop}-right: $length !important; + #{$prop}-left: $length !important; + } - .#{$abbrev}b-#{$size} { - #{$prop}-bottom: $length !important; - } + .#{$abbrev}y#{$infix}-#{$size} { + #{$prop}-top: $length !important; + #{$prop}-bottom: $length !important; + } + } - .#{$abbrev}l-#{$size} { - #{$prop}-left: $length !important; + @for $index from 0 through 64 { + $size: $index * 4; + $length: #{$size}px; + + .#{$abbrev}t#{$infix}-#{$size} { + #{$prop}-top: $length !important; + } + + .#{$abbrev}r#{$infix}-#{$size} { + #{$prop}-right: $length !important; + } + + .#{$abbrev}b#{$infix}-#{$size} { + #{$prop}-bottom: $length !important; + } + + .#{$abbrev}l#{$infix}-#{$size} { + #{$prop}-left: $length !important; + } + } + + @if ($abbrev == m) { + @for $index from 0 through 64 { + $size: $index * 4; + $length: #{$size}px; + + // Some special margin utils for flex alignments + .m#{$infix}-auto { + margin: auto !important; + } + + .mt#{$infix}-auto { + margin-top: auto !important; + } + + .mr#{$infix}-auto { + margin-right: auto !important; + } + + .mb#{$infix}-auto { + margin-bottom: auto !important; + } + + .ml#{$infix}-auto { + margin-left: auto !important; + } + + .mx#{$infix}-auto { + margin-right: auto !important; + margin-left: auto !important; + } + + .my#{$infix}-auto { + margin-top: auto !important; + margin-bottom: auto !important; + } + } + } } } } -// Some special margin utils for flex alignments -.m-auto { - margin: auto !important; -} - -.mt-auto { - margin-top: auto !important; -} - -.mr-auto { - margin-right: auto !important; -} - -.mb-auto { - margin-bottom: auto !important; -} - -.ml-auto { - margin-left: auto !important; -} - -.mx-auto { - margin-right: auto !important; - margin-left: auto !important; -} - -.my-auto { - margin-top: auto !important; - margin-bottom: auto !important; -} - - // Border helpers $border-style: 1px solid rgba(0, 0, 0, 0.12); diff --git a/src/app/core/scss/partials/_page-layouts.scss b/src/app/core/scss/partials/_page-layouts.scss index e7ce0f64..c13de244 100644 --- a/src/app/core/scss/partials/_page-layouts.scss +++ b/src/app/core/scss/partials/_page-layouts.scss @@ -79,7 +79,6 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too flex-direction: column; flex: 1; overflow: hidden; - background: mat-color($background, background); @include mat-elevation(7); .toolbar { @@ -96,7 +95,6 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too display: flex; flex: 1; overflow: auto; - background: mat-color($background, background); } } } @@ -186,7 +184,6 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too flex-direction: column; flex: 1; overflow: hidden; - background: mat-color($background, background); @include mat-elevation(7); .toolbar { @@ -209,7 +206,6 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too .content { display: flex; flex: 1; - background: mat-color($background, background); overflow: auto; } } @@ -402,7 +398,6 @@ $carded-header-height-without-toolbar-sm: $carded-header-height-sm - $carded-too @include mat-elevation(7); .content { - background: mat-color($background, background); } } } diff --git a/src/app/core/scss/variables/_theme.scss b/src/app/core/scss/variables/_theme.scss index 77c75928..05256ad7 100644 --- a/src/app/core/scss/variables/_theme.scss +++ b/src/app/core/scss/variables/_theme.scss @@ -49,11 +49,11 @@ $mat-fusedark: ( // Palettes $primary: mat-palette($mat-fusedark); -$accent: mat-palette($mat-blue, 600, 400, 700); +$accent: mat-palette($mat-light-blue, 600, 400, 700); $warn: mat-palette($mat-red); // Create the theme object (a Sass map containing all of the palettes). $theme: mat-light-theme($primary, $accent, $warn); $background: map-get($theme, background); -$foreground: map-get($theme, foreground); \ No newline at end of file +$foreground: map-get($theme, foreground); diff --git a/src/app/core/services/match-media.service.ts b/src/app/core/services/match-media.service.ts index 5e58e525..d84dac0e 100644 --- a/src/app/core/services/match-media.service.ts +++ b/src/app/core/services/match-media.service.ts @@ -14,23 +14,6 @@ export class FuseMatchMedia { this.activeMediaQuery = ''; - /*this.onMediaChange = Observable.create((observer: Observer) => - { - this.observableMedia.subscribe((change: MediaChange) => - { - if ( this.activeMediaQuery !== change.mqAlias ) - { - this.activeMediaQuery = change.mqAlias; - observer.next(this.activeMediaQuery); - } - }); - });*/ - - /*this.onMediaChange = Observable.create((observer: Observer) => - { - - });*/ - this.observableMedia.subscribe((change: MediaChange) => { if ( this.activeMediaQuery !== change.mqAlias ) diff --git a/src/app/main/content/apps/calendar/calendar.component.html b/src/app/main/content/apps/calendar/calendar.component.html index bbef8b72..a0ab0deb 100644 --- a/src/app/main/content/apps/calendar/calendar.component.html +++ b/src/app/main/content/apps/calendar/calendar.component.html @@ -7,7 +7,7 @@
-