| 1 |
/** |
| 2 |
* Shared SCSS Mixins |
| 3 |
* |
| 4 |
* Reusable mixins for common patterns across admin and metabox components |
| 5 |
* |
| 6 |
* @package ThinkRank |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
@use 'variables' as *; |
| 11 |
|
| 12 |
// Responsive breakpoints |
| 13 |
@mixin mobile-only { |
| 14 |
@media (max-width: #{$breakpoint-md - 1px}) { |
| 15 |
@content; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
@mixin tablet-up { |
| 20 |
@media (min-width: #{$breakpoint-md}) { |
| 21 |
@content; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
@mixin desktop-up { |
| 26 |
@media (min-width: #{$breakpoint-lg}) { |
| 27 |
@content; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
@mixin large-desktop-up { |
| 32 |
@media (min-width: #{$breakpoint-xl}) { |
| 33 |
@content; |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
// Flexbox utilities |
| 38 |
@mixin flex-center { |
| 39 |
display: flex; |
| 40 |
align-items: center; |
| 41 |
justify-content: center; |
| 42 |
} |
| 43 |
|
| 44 |
@mixin flex-between { |
| 45 |
display: flex; |
| 46 |
align-items: center; |
| 47 |
justify-content: space-between; |
| 48 |
} |
| 49 |
|
| 50 |
@mixin flex-start { |
| 51 |
display: flex; |
| 52 |
align-items: center; |
| 53 |
justify-content: flex-start; |
| 54 |
} |
| 55 |
|
| 56 |
@mixin flex-end { |
| 57 |
display: flex; |
| 58 |
align-items: center; |
| 59 |
justify-content: flex-end; |
| 60 |
} |
| 61 |
|
| 62 |
// Text utilities |
| 63 |
@mixin text-truncate { |
| 64 |
overflow: hidden; |
| 65 |
text-overflow: ellipsis; |
| 66 |
white-space: nowrap; |
| 67 |
} |
| 68 |
|
| 69 |
@mixin text-clamp($lines: 2) { |
| 70 |
display: -webkit-box; |
| 71 |
-webkit-line-clamp: $lines; |
| 72 |
-webkit-box-orient: vertical; |
| 73 |
overflow: hidden; |
| 74 |
} |
| 75 |
|
| 76 |
// Button base styles |
| 77 |
@mixin button-base { |
| 78 |
display: inline-flex; |
| 79 |
align-items: center; |
| 80 |
justify-content: center; |
| 81 |
border: 1px solid transparent; |
| 82 |
border-radius: $thinkrank-radius; |
| 83 |
font-weight: $font-weight-medium; |
| 84 |
text-decoration: none; |
| 85 |
cursor: pointer; |
| 86 |
transition: all $duration-normal $ease-in-out; |
| 87 |
outline: none; |
| 88 |
|
| 89 |
&:focus { |
| 90 |
box-shadow: 0 0 0 2px rgba($thinkrank-primary, 0.2); |
| 91 |
} |
| 92 |
|
| 93 |
&:disabled { |
| 94 |
opacity: 0.5; |
| 95 |
cursor: not-allowed; |
| 96 |
transform: none !important; |
| 97 |
box-shadow: none !important; |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
// Card styles |
| 102 |
@mixin card-base { |
| 103 |
background: $thinkrank-white; |
| 104 |
border: 1px solid $thinkrank-border-light; |
| 105 |
border-radius: 8px; |
| 106 |
box-shadow: $thinkrank-shadow; |
| 107 |
overflow: hidden; |
| 108 |
} |
| 109 |
|
| 110 |
@mixin card-elevated { |
| 111 |
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); |
| 112 |
|
| 113 |
&:hover { |
| 114 |
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
// Form elements |
| 119 |
@mixin input-base { |
| 120 |
width: 100%; |
| 121 |
padding: $spacing-2 $spacing-3; |
| 122 |
border: 1px solid $thinkrank-border; |
| 123 |
border-radius: $thinkrank-radius; |
| 124 |
font-size: $font-size-sm; |
| 125 |
line-height: $line-height-normal; |
| 126 |
transition: border-color $duration-normal $ease-in-out; |
| 127 |
|
| 128 |
&:focus { |
| 129 |
border-color: $thinkrank-primary; |
| 130 |
box-shadow: 0 0 0 1px $thinkrank-primary; |
| 131 |
outline: none; |
| 132 |
} |
| 133 |
|
| 134 |
&:disabled { |
| 135 |
background-color: $thinkrank-bg; |
| 136 |
color: $thinkrank-text-secondary; |
| 137 |
cursor: not-allowed; |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
// Loading spinner |
| 142 |
@mixin spinner($size: 20px, $color: $thinkrank-primary) { |
| 143 |
width: $size; |
| 144 |
height: $size; |
| 145 |
border: 2px solid rgba($color, 0.2); |
| 146 |
border-top: 2px solid $color; |
| 147 |
border-radius: 50%; |
| 148 |
animation: spin 1s linear infinite; |
| 149 |
} |
| 150 |
|
| 151 |
@keyframes spin { |
| 152 |
0% { transform: rotate(0deg); } |
| 153 |
100% { transform: rotate(360deg); } |
| 154 |
} |
| 155 |
|
| 156 |
// Score circle styles |
| 157 |
@mixin score-circle($size: 80px) { |
| 158 |
width: $size; |
| 159 |
height: $size; |
| 160 |
border-radius: 50%; |
| 161 |
display: flex; |
| 162 |
flex-direction: column; |
| 163 |
align-items: center; |
| 164 |
justify-content: center; |
| 165 |
font-weight: $font-weight-bold; |
| 166 |
position: relative; |
| 167 |
} |
| 168 |
|
| 169 |
// Gradient backgrounds |
| 170 |
@mixin gradient-primary { |
| 171 |
background: linear-gradient(135deg, $thinkrank-primary, darken($thinkrank-primary, 10%)); |
| 172 |
} |
| 173 |
|
| 174 |
@mixin gradient-success { |
| 175 |
background: linear-gradient(135deg, $thinkrank-success, darken($thinkrank-success, 10%)); |
| 176 |
} |
| 177 |
|
| 178 |
@mixin gradient-warning { |
| 179 |
background: linear-gradient(135deg, $thinkrank-warning, darken($thinkrank-warning, 10%)); |
| 180 |
} |
| 181 |
|
| 182 |
@mixin gradient-error { |
| 183 |
background: linear-gradient(135deg, $thinkrank-error, darken($thinkrank-error, 10%)); |
| 184 |
} |
| 185 |
|