| 1 |
@use 'sass:map'; |
| 2 |
@use 'sass:list'; |
| 3 |
@use 'sass:color'; |
| 4 |
@use 'theme'; |
| 5 |
|
| 6 |
// Badges are wrapped in links that filter by type. The white ring separates the |
| 7 |
// focus indicator from the badge, matching the activation switch. `:focus` is |
| 8 |
// included because a click otherwise leaves the WordPress ring, which hugs the |
| 9 |
// badge. |
| 10 |
@mixin badge-link { |
| 11 |
display: inline-flex; |
| 12 |
border-radius: 3px; |
| 13 |
|
| 14 |
&:focus, |
| 15 |
&:focus-visible { |
| 16 |
outline: none; |
| 17 |
box-shadow: 0 0 0 2px #fff, 0 0 0 4px theme.$accent; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
.badge { |
| 22 |
font-size: 12px; |
| 23 |
font-weight: 700; |
| 24 |
text-transform: uppercase; |
| 25 |
border-radius: 3px; |
| 26 |
text-align: center; |
| 27 |
min-inline-size: 43px; |
| 28 |
min-block-size: 24px; |
| 29 |
display: inline-flex; |
| 30 |
justify-content: center; |
| 31 |
align-items: center; |
| 32 |
padding-block: 0; |
| 33 |
padding-inline: 3px; |
| 34 |
box-sizing: border-box; |
| 35 |
gap: 5px; |
| 36 |
line-height: 1; |
| 37 |
|
| 38 |
@at-root .row-actions & { |
| 39 |
color: #8c8c8c; |
| 40 |
padding-inline: 0; |
| 41 |
text-transform: capitalize; |
| 42 |
font-weight: 500; |
| 43 |
} |
| 44 |
|
| 45 |
.dashicons { |
| 46 |
font-size: 18px; |
| 47 |
inline-size: 18px; |
| 48 |
block-size: 18px; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
.network-shared { |
| 53 |
color: theme.$accent; |
| 54 |
font-size: 22px; |
| 55 |
inline-size: 100%; |
| 56 |
cursor: help; |
| 57 |
} |
| 58 |
|
| 59 |
.small-badge { |
| 60 |
block-size: auto; |
| 61 |
inline-size: auto; |
| 62 |
font-size: smaller; |
| 63 |
padding-block: 0; |
| 64 |
padding-inline: 0.5em; |
| 65 |
} |
| 66 |
|
| 67 |
.wp-core-ui .button.nav-tab-button { |
| 68 |
margin-inline-start: 0.5em; |
| 69 |
float: inline-end; |
| 70 |
color: #a7aaad; |
| 71 |
background: #f6f7f7; |
| 72 |
border-color: #f6f7f7; |
| 73 |
align-self: center; |
| 74 |
display: flex; |
| 75 |
justify-content: center; |
| 76 |
align-items: center; |
| 77 |
gap: 2px; |
| 78 |
} |
| 79 |
|
| 80 |
.nav-tab-button .dashicons-external { |
| 81 |
font-size: 15px; |
| 82 |
color: #666; |
| 83 |
} |
| 84 |
|
| 85 |
@each $name, $colors in theme.$badges { |
| 86 |
$text-color: #fff; |
| 87 |
$background-color: list.nth($colors, 1); |
| 88 |
|
| 89 |
@if list.length($colors) > 1 { |
| 90 |
$text-color: list.nth($colors, 2); |
| 91 |
} |
| 92 |
|
| 93 |
.badge.#{$name}-badge, |
| 94 |
.nav-tab-inactive:hover .badge.#{$name}-badge, |
| 95 |
:hover > .inverted-badges .#{$name}-badge { |
| 96 |
color: $text-color; |
| 97 |
background-color: $background-color; |
| 98 |
} |
| 99 |
|
| 100 |
a.badge.#{$name}-badge:hover, |
| 101 |
button.badge.#{$name}-badge:hover { |
| 102 |
color: $text-color; |
| 103 |
background-color: color.adjust($background-color, $lightness: -5%); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
// #646970 (WP gray-50) keeps white badge text at 5.5:1 so locked/unlicensed |
| 108 |
// states stay WCAG AA without hover; #a7aaad was 2.3:1. |
| 109 |
.nav-tab-inactive .badge, |
| 110 |
.inverted-badges .badge { |
| 111 |
color: #fff; |
| 112 |
background-color: #646970; |
| 113 |
border-color: #fff !important; |
| 114 |
|
| 115 |
.dashicons { |
| 116 |
color: #fff; |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
.nav-tab-inactive { |
| 121 |
$colors: map.get(theme.$badges, 'pro'); |
| 122 |
$text-color: list.nth($colors, 2); |
| 123 |
$background-color: list.nth($colors, 1); |
| 124 |
|
| 125 |
background: transparent; |
| 126 |
|
| 127 |
.badge.pro-badge { |
| 128 |
color: $text-color; |
| 129 |
background-color: $background-color; |
| 130 |
} |
| 131 |
|
| 132 |
&:hover { |
| 133 |
&.button, .dashicons-external { |
| 134 |
color: #3c434a; |
| 135 |
} |
| 136 |
|
| 137 |
.badge.pro-badge { |
| 138 |
color: $background-color; |
| 139 |
background-color: $text-color; |
| 140 |
} |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
// Override WordPress' .wp-core-ui .button .dashicons { line-height: 1.9 } — |
| 145 |
// inside a button the inflated line-box would shift the glyph below the |
| 146 |
// badge's bottom border. Placed at end-of-file so it follows all other |
| 147 |
// .dashicons rules in source order (no-descending-specificity). |
| 148 |
.wp-core-ui .button .badge .dashicons { |
| 149 |
line-height: 1; |
| 150 |
} |
| 151 |
|
| 152 |
// Pro badge consolidated to the navigation pro-chip style: a light accent pill |
| 153 |
// in every context, overriding the badge colour map and the inverted/nav-tab |
| 154 |
// variants (whose white !important border must be beaten here). This is a |
| 155 |
// deliberate final override, so it intentionally follows higher-specificity |
| 156 |
// context rules above. |
| 157 |
/* stylelint-disable no-descending-specificity */ |
| 158 |
.badge.pro-badge, |
| 159 |
.inverted-badges .badge.pro-badge, |
| 160 |
.nav-tab-inactive .badge.pro-badge { |
| 161 |
color: theme.$accent; |
| 162 |
background-color: #eff5f9; |
| 163 |
border: 1px solid rgb(34 113 177 / 10%) !important; |
| 164 |
border-radius: 999px; |
| 165 |
padding-block: 3px; |
| 166 |
padding-inline: 10px; |
| 167 |
line-height: normal; |
| 168 |
} |
| 169 |
/* stylelint-enable no-descending-specificity */ |
| 170 |
|