|
| 1 | +//// |
| 2 | +/// @group themes |
| 3 | +/// @access privet |
| 4 | +/// @author <a href="https://github.com/desig9stein" target="_blank">Marin Popov</a> |
| 5 | +//// |
| 6 | + |
| 7 | +/// Returns a map containing all style properties related to the theming the watermark directive. |
| 8 | +/// @param {Map} $palette [$default-palette] - The palette used as basis for styling the component. |
| 9 | +/// @param {Map} $schema [$light-schema] - The schema used as basis for styling the component. |
| 10 | +/// |
| 11 | +/// @requires $default-palette |
| 12 | +/// @requires $light-schema |
| 13 | +/// @requires apply-palette |
| 14 | +/// @requires extend |
| 15 | +/// @requires text-contrast |
| 16 | +/// @requires round-borders |
| 17 | +/// |
| 18 | +/// @example scss Change the watermark background |
| 19 | +/// $my-watermark-theme: igx-watermark-theme($background: magenta); |
| 20 | +/// // Pass the theme to the igx-watermark component mixin |
| 21 | +/// @include igx-watermark($my-checkbox-theme); |
| 22 | +@function igx-watermark-theme( |
| 23 | + $palette: $default-palette, |
| 24 | + $schema: $light-schema, |
| 25 | +
|
| 26 | + $border-radius: null, |
| 27 | + $background-image: null, |
| 28 | + $link-background: null, |
| 29 | + $color: null, |
| 30 | + $border-color: null, |
| 31 | +) { |
| 32 | + $name: 'igx-watermark'; |
| 33 | + $watermark-schema: (); |
| 34 | + |
| 35 | + @if map-has-key($schema, $name) { |
| 36 | + $watermark-schema: map-get($schema, $name); |
| 37 | + } @else { |
| 38 | + $watermark-schema: $schema; |
| 39 | + } |
| 40 | + |
| 41 | + $theme: apply-palette($watermark-schema, $palette); |
| 42 | + |
| 43 | + $border-radius: round-borders( |
| 44 | + if($border-radius, $border-radius, map-get($watermark-schema, 'border-radius')), 0, 16px |
| 45 | + ); |
| 46 | + |
| 47 | + @if not($color) and $link-background { |
| 48 | + $color: text-contrast($link-background); |
| 49 | + } |
| 50 | + |
| 51 | + @return extend($theme, ( |
| 52 | + name: $name, |
| 53 | + palette: $default-palette, |
| 54 | + background-image: $background-image, |
| 55 | + link-background: $link-background, |
| 56 | + border-radius: $border-radius, |
| 57 | + color: $color, |
| 58 | + border-color: $border-color, |
| 59 | + )); |
| 60 | +} |
| 61 | + |
| 62 | +/// @param {Map} $theme - The theme used to style the component. |
| 63 | +/// @requires {mixin} igx-root-css-vars |
| 64 | +/// @requires --var |
| 65 | +@mixin igx-watermark($theme) { |
| 66 | + @include igx-root-css-vars($theme); |
| 67 | + |
| 68 | + %igx-watermark { |
| 69 | + display: block; |
| 70 | + position: absolute; |
| 71 | + bottom: 0; |
| 72 | + right: 0; |
| 73 | + width: 100%; |
| 74 | + height: 100%; |
| 75 | + z-index: 10000; |
| 76 | + pointer-events: none; |
| 77 | + } |
| 78 | + |
| 79 | + %igx-watermark__link { |
| 80 | + display: inline-flex; |
| 81 | + align-items: center; |
| 82 | + position: absolute; |
| 83 | + bottom: 0; |
| 84 | + right: 0; |
| 85 | + font-size: rem(14px); |
| 86 | + padding: rem(2px) rem(4px); |
| 87 | + line-height: normal; |
| 88 | + border: 1px solid --var($theme, 'border-color'); |
| 89 | + color: --var($theme, 'color'); |
| 90 | + z-index: 10002; |
| 91 | + background-color: --var($theme, 'link-background'); |
| 92 | + pointer-events: all; |
| 93 | + text-decoration: none; |
| 94 | + } |
| 95 | + |
| 96 | + %igx-watermark__background-img { |
| 97 | + width: 100%; |
| 98 | + height: 100%; |
| 99 | + position: absolute; |
| 100 | + top: 0; |
| 101 | + left: 0; |
| 102 | + z-index: 10001; |
| 103 | + pointer-events: none; |
| 104 | + background-image: --var($theme, 'background-image'); |
| 105 | + background-repeat: repeat; |
| 106 | + background-position: rem(16px) rem(16px); |
| 107 | + // Target only IE 10,11. |
| 108 | + @media all and (-ms-high-contrast:none) |
| 109 | + { |
| 110 | + background-image: none; |
| 111 | + } |
| 112 | + // END Target only IE 10,11. |
| 113 | + } |
| 114 | +} |
0 commit comments