AdminLTE/build/scss/_mixins.scss

307 lines
6.7 KiB
SCSS
Raw Normal View History

2016-01-16 17:27:23 +01:00
// AdminLTE mixins
// ===============
2015-10-31 22:00:16 +01:00
2016-01-16 17:27:23 +01:00
// Changes the color and the hovering properties of the navbar
2015-10-31 22:00:16 +01:00
@mixin navbar-variant($color, $font-color: rgba(255, 255, 255, 0.8), $hover-color: #f6f6f6, $hover-bg: rgba(0, 0, 0, 0.1)) {
background-color: $color;
2016-01-16 17:27:23 +01:00
// Navbar links
2015-10-31 22:00:16 +01:00
.nav > li > a {
color: $font-color;
}
.nav > li > a:hover,
.nav > li > a:active,
.nav > li > a:focus,
.nav .open > a,
.nav .open > a:hover,
.nav .open > a:focus,
.nav > .active > a {
background: $hover-bg;
color: $hover-color;
}
2016-01-16 17:27:23 +01:00
// Add color to the sidebar toggle button
2015-10-31 22:00:16 +01:00
.sidebar-toggle {
color: $font-color;
&:hover {
color: $hover-color;
background: $hover-bg;
}
}
}
2016-01-16 17:27:23 +01:00
// Logo color variation
2015-10-31 22:00:16 +01:00
@mixin logo-variant($bg-color, $color: #fff, $border-bottom-color: transparent, $border-bottom-width: 0) {
background-color: $bg-color;
color: $color;
border-bottom: $border-bottom-width solid $border-bottom-color;
&:hover {
background-color: darken($bg-color, 1%);
}
}
2016-01-16 17:27:23 +01:00
// Box solid color variantion creator
2015-10-31 22:00:16 +01:00
@mixin box-solid-variant($color, $text-color: #fff) {
border: 1px solid $color;
2018-03-17 18:07:55 +01:00
> .card-header {
2015-10-31 22:00:16 +01:00
color: $text-color;
background: $color;
background-color: $color;
a,
.btn {
color: $text-color;
}
}
}
2016-01-16 17:27:23 +01:00
// Direct Chat Variant
2015-10-31 22:00:16 +01:00
@mixin direct-chat-variant($bg-color, $color: #fff) {
.right > .direct-chat-text {
background: $bg-color;
border-color: $bg-color;
2018-03-17 18:07:55 +01:00
color: color-yiq($bg-color);
2015-10-31 22:00:16 +01:00
&:after,
&:before {
border-left-color: $bg-color;
}
}
}
@mixin translate($x, $y) {
2015-11-09 14:51:11 +01:00
-webkit-transform: translate($x, $y);
2015-10-31 22:00:16 +01:00
-ms-transform: translate($x, $y); // IE9 only
transform: translate($x, $y);
}
2016-01-16 17:27:23 +01:00
// Different radius each side
2016-10-15 19:20:09 +02:00
@mixin border-radius-sides($top-left, $top-right, $bottom-left, $bottom-right) {
2015-10-31 22:00:16 +01:00
border-radius: $top-left $top-right $bottom-left $bottom-right;
}
2016-01-16 17:27:23 +01:00
@mixin calc($property, $expression) {
#{$property}: -webkit-calc(#{$expression});
#{$property}: calc(#{$expression});
}
2015-10-31 22:00:16 +01:00
@mixin rotate($value) {
-ms-transform: rotate($value);
transform: rotate($value);
}
@mixin animation($animation) {
animation: $animation;
}
2016-01-16 17:27:23 +01:00
// Gradient background
2015-10-31 22:00:16 +01:00
@mixin gradient($color: #F5F5F5, $start: #EEE, $stop: #FFF) {
background: $color;
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, $start), color-stop(1, $stop));
background: -ms-linear-gradient(bottom, $start, $stop);
background: -moz-linear-gradient(center bottom, $start 0%, $stop 100%);
background: -o-linear-gradient($stop, $start);
}
2016-01-16 17:27:23 +01:00
// Skins Mixins
2015-10-31 22:00:16 +01:00
2016-01-16 17:27:23 +01:00
// Dark Sidebar Mixin
2015-10-31 22:00:16 +01:00
@mixin skin-dark-sidebar($link-hover-border-color) {
2018-03-17 18:07:55 +01:00
// Sidebar background color
background-color: $sidebar-dark-bg;
2016-10-15 19:20:09 +02:00
2016-01-16 17:27:23 +01:00
// User Panel (resides in the sidebar)
2015-10-31 22:00:16 +01:00
.user-panel {
2018-03-17 18:07:55 +01:00
a:hover {
color: $sidebar-dark-hover-color;
2015-10-31 22:00:16 +01:00
}
2016-10-15 19:20:09 +02:00
.status {
color: $sidebar-dark-color;
background: $sidebar-dark-hover-bg;
&:hover,
&:focus,
&:active {
color: $sidebar-dark-hover-color;
background: darken($sidebar-dark-hover-bg, 3%);
}
}
.dropdown-menu {
border-color: darken($sidebar-dark-hover-bg, 5%);
@include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
2016-10-15 19:20:09 +02:00
}
.dropdown-item {
color: $body-color;
}
2015-10-31 22:00:16 +01:00
}
2016-10-15 19:20:09 +02:00
2016-01-16 17:27:23 +01:00
// Sidebar Menu. First level links
.nav-sidebar > .nav-item {
// links
> .nav-link {
2018-03-17 18:07:55 +01:00
// border-left: 3px solid transparent;
2016-01-16 17:27:23 +01:00
&:active,
&:focus {
color: $sidebar-dark-color;
}
2015-10-31 22:00:16 +01:00
}
2016-10-15 19:20:09 +02:00
2016-01-16 17:27:23 +01:00
// Hover and active states
2016-10-15 19:20:09 +02:00
&.menu-open > .nav-link,
2018-03-17 18:07:55 +01:00
&:hover > .nav-link {
2015-10-31 22:00:16 +01:00
color: $sidebar-dark-hover-color;
2018-03-17 18:07:55 +01:00
background-color: $sidebar-dark-hover-bg;
2016-10-15 19:20:09 +02:00
}
> .nav-link.active {
2018-03-17 18:07:55 +01:00
color: $sidebar-dark-hover-color;
background-color: $link-hover-border-color;
@if $enable-shadows {
@extend .elevation-1;
}
2015-10-31 22:00:16 +01:00
}
2016-10-15 19:20:09 +02:00
2016-01-16 17:27:23 +01:00
// First Level Submenu
> .nav-treeview {
2015-10-31 22:00:16 +01:00
background: $sidebar-dark-submenu-bg;
}
}
2016-10-15 19:20:09 +02:00
// Section Heading
2016-01-16 17:27:23 +01:00
.nav-header {
2018-03-17 18:07:55 +01:00
color: lighten($sidebar-dark-color, 5%);
2016-10-15 19:20:09 +02:00
background: inherit; //darken($sidebar-dark-bg, 3%);
2016-01-16 17:27:23 +01:00
}
2016-10-15 19:20:09 +02:00
2016-01-16 17:27:23 +01:00
// All links within the sidebar menu
2015-10-31 22:00:16 +01:00
.sidebar a {
color: $sidebar-dark-color;
&:hover {
text-decoration: none;
}
}
2016-10-15 19:20:09 +02:00
2016-01-16 17:27:23 +01:00
// All submenus
.nav-treeview {
> .nav-item {
> .nav-link {
2015-10-31 22:00:16 +01:00
color: $sidebar-dark-submenu-color;
2016-10-15 19:20:09 +02:00
2018-03-17 18:07:55 +01:00
&:hover {
color: $sidebar-dark-submenu-hover-color;
background-color: $sidebar-dark-submenu-hover-bg
}
}
2018-03-17 18:07:55 +01:00
> .nav-link.active {
&,
&:hover {
color: $sidebar-dark-submenu-active-color;
background-color: $sidebar-dark-submenu-active-bg;
}
2015-10-31 22:00:16 +01:00
}
}
}
}
2016-01-16 17:27:23 +01:00
// Light Sidebar Mixin
2018-03-17 18:07:55 +01:00
@mixin skin-light-sidebar($link-hover-border-color) {
2016-01-16 17:27:23 +01:00
// Sidebar background color
2018-03-17 18:07:55 +01:00
background-color: $sidebar-light-bg;
2016-01-16 17:27:23 +01:00
// User Panel (resides in the sidebar)
2015-10-31 22:00:16 +01:00
.user-panel {
2018-03-17 18:07:55 +01:00
a:hover {
color: $sidebar-light-hover-color;
}
.status {
2015-10-31 22:00:16 +01:00
color: $sidebar-light-color;
2018-03-17 18:07:55 +01:00
background: $sidebar-light-hover-bg;
&:hover,
&:focus,
&:active {
color: $sidebar-light-hover-color;
background: darken($sidebar-light-hover-bg, 3%);
}
}
.dropdown-menu {
border-color: darken($sidebar-light-hover-bg, 5%);
@include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
}
.dropdown-item {
color: $body-color;
2015-10-31 22:00:16 +01:00
}
}
2018-03-17 18:07:55 +01:00
2016-01-16 17:27:23 +01:00
// Sidebar Menu. First level links
2018-03-17 18:07:55 +01:00
.nav-sidebar > .nav-item {
2016-01-16 17:27:23 +01:00
// links
> .nav-link {
2018-03-17 18:07:55 +01:00
// border-left: 3px solid transparent;
&:active,
2016-01-16 17:27:23 +01:00
&:focus {
color: $sidebar-light-color;
}
2015-10-31 22:00:16 +01:00
}
2018-03-17 18:07:55 +01:00
2016-01-16 17:27:23 +01:00
// Hover and active states
2018-03-17 18:07:55 +01:00
&.menu-open > .nav-link,
&:hover > .nav-link {
2015-10-31 22:00:16 +01:00
color: $sidebar-light-hover-color;
2018-03-17 18:07:55 +01:00
background-color: $sidebar-light-hover-bg;
2015-10-31 22:00:16 +01:00
}
2018-03-17 18:07:55 +01:00
> .nav-link.active {
color: $sidebar-light-active-color;
background-color: $link-hover-border-color;
@if $enable-shadows {
@extend .elevation-1;
2015-10-31 22:00:16 +01:00
}
}
2018-03-17 18:07:55 +01:00
2016-01-16 17:27:23 +01:00
// First Level Submenu
> .nav-treeview {
2015-10-31 22:00:16 +01:00
background: $sidebar-light-submenu-bg;
}
}
2018-03-17 18:07:55 +01:00
// Section Heading
2016-01-16 17:27:23 +01:00
.nav-header {
2018-03-17 18:07:55 +01:00
color: darken($sidebar-light-color, 5%);
background: inherit;
2016-01-16 17:27:23 +01:00
}
2018-03-17 18:07:55 +01:00
2016-01-16 17:27:23 +01:00
// All links within the sidebar menu
2018-03-17 18:07:55 +01:00
.sidebar a {
2015-10-31 22:00:16 +01:00
color: $sidebar-light-color;
&:hover {
text-decoration: none;
}
}
2018-03-17 18:07:55 +01:00
2016-01-16 17:27:23 +01:00
// All submenus
.nav-treeview {
> .nav-item {
> .nav-link {
2015-10-31 22:00:16 +01:00
color: $sidebar-light-submenu-color;
}
2018-03-17 18:07:55 +01:00
> .nav-link.active {
&,
&:hover {
color: $sidebar-light-submenu-active-color;
background-color: $sidebar-light-submenu-active-bg;
}
2015-10-31 22:00:16 +01:00
}
2018-03-17 18:07:55 +01:00
> .nav-link:hover {
background-color: $sidebar-light-submenu-hover-bg;
2015-10-31 22:00:16 +01:00
}
}
}
}