Skip to content

Commit 6859e48

Browse files
authored
Issue 741 (#761)
* set widget link hover to match body link hover * fix linting issues * fix link preview
1 parent b86ae7a commit 6859e48

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

src/assets/js/customizer/typography/link-preview.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,22 @@ export class LinkPreview {
122122
footerLinkColorHover = parseInt( footerLinkColorHover, 10 ) / 100,
123123
footerShiftedColorVal = colorLib.Color( footerLinkColor ).lightenByAmount( footerLinkColorHover ).toCSS();
124124

125+
let colorPaletteOption = JSON.parse( api( 'boldgrid_color_palette' )() );
126+
127+
let paletteColors = colorPaletteOption.state.palettes['palette-primary'].colors;
128+
let paletteNeutral = colorPaletteOption.state.palettes['palette-primary']['neutral-color'];
129+
130+
[ 1, 2, 3, 4, 5, 'neutral' ].map( sidebarColorClass => {
131+
var sidebarColor = 'neutral' === sidebarColorClass ? paletteNeutral : paletteColors[ sidebarColorClass - 1 ],
132+
sidebarColorHover = api( 'bgtfw_body_link_color_hover' )() || 0,
133+
sidebarAriColor;
134+
135+
sidebarColorHover = parseInt( sidebarColorHover, 10 ) / 100;
136+
sidebarAriColor = colorLib.Color( sidebarColor ).lightenByAmount( sidebarColorHover ).toCSS();
137+
138+
css += `.sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):hover, .sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):focus { color: ${sidebarAriColor} !important; }`;
139+
} );
140+
125141
css += `
126142
#colophon .bgtfw-footer.footer-content > a:not( .btn ),
127143
#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) {

src/assets/scss/custom-color/color-classes.scss

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,13 @@ $names: background background-color;
105105
a:not( .btn ) {
106106
color: #{nth($colors, $each)};
107107
}
108-
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
109-
color: hover( nth($colors, $color), nth($colors, $each) );
110-
}
111108
}
112109
}
113110
@if variable-exists( palette-primary-neutral-color ) {
114111
&.color-neutral-link-color {
115112
a:not( .btn ) {
116113
color: $palette-primary-neutral-color;
117114
}
118-
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
119-
color: hover( nth($colors, $color), $palette-primary-neutral-color );
120-
}
121115
}
122116
&.color-neutral-sub-link-color.sm {
123117
ul {
@@ -159,9 +153,6 @@ $names: background background-color;
159153
a:not( .btn ) {
160154
color: #{nth($colors, $each)};
161155
}
162-
a:not( .btn ):hover, a:not( .btn ):focus, a:not( .btn ):active, a:not( .btn ).highlighted {
163-
color: hover( nth($colors, $color), nth($colors, $each) );
164-
}
165156
}
166157
}
167158
&.sm {
@@ -249,8 +240,10 @@ $names: background background-color;
249240
a {
250241
color: #{nth($colors, $each)};
251242
}
252-
a:hover, a:focus, a:active, a.highlighted {
253-
color: hover( $palette-primary-neutral-color, nth($colors, $each) );
243+
&:not( .sidebar ) {
244+
a:hover, a:focus, a:active, a.highlighted {
245+
color: hover( $palette-primary-neutral-color, nth($colors, $each) );
246+
}
254247
}
255248
}
256249
&.color-#{$each}-sub-link-color.sm {

src/includes/class-boldgrid-framework-links.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,17 @@ public function get_styles( $prefix ) {
168168
$footer_lightness = max( $footer_lightness, 0 );
169169
$footer_color_hover = $footer_ari_color->getNew( 'lightness', $footer_lightness )->toCSS( 'hsla' );
170170

171+
foreach ( array( '1', '2', '3', '4', '5', 'neutral' ) as $sidebar_color_class ) {
172+
$sidebar_color_value = BoldGrid::color_from_class( $sidebar_color_class );
173+
$sidebar_color_hover = get_theme_mod( 'bgtfw_body_link_color_hover' ) ? get_theme_mod( 'bgtfw_body_link_color_hover' ) : 0;
174+
$sidebar_ari_color = ariColor::newColor( $sidebar_color_value );
175+
$sidebar_lightness = min( $sidebar_ari_color->lightness + $sidebar_color_hover, 100 );
176+
$sidebar_lightness = max( $sidebar_lightness, 0 );
177+
$sidebar_color_hover = $sidebar_ari_color->getNew( 'lightness', $sidebar_lightness )->toCSS( 'hsla' );
178+
179+
$css .= ".sidebar.color-${sidebar_color_class}-link-color a:not( .btn ):hover, .sidebar.color-${sidebar_color_class}-link-color a:not( .btn ):focus { color: ${sidebar_color_hover} !important; }";
180+
}
181+
171182
$css .= "#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) { text-decoration: ${decoration};}";
172183
$css .= "#colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ):hover, .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ):focus {color: ${footer_color_hover};text-decoration: ${decoration_hover};}";
173184
}

0 commit comments

Comments
 (0)