FIX: Adjust button styling when custom text is used (#45)

This commit is contained in:
Jordan Vidrine 2023-11-20 12:52:29 -06:00 committed by GitHub
parent b0b6448e7c
commit 5fb25748da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -74,7 +74,7 @@ $max-width: 600px;
text-align: center; text-align: center;
} }
.btn.search-icon { .btn.search-icon:not(.has-search-button-text) {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
background: transparent; background: transparent;
@ -91,6 +91,22 @@ $max-width: 600px;
} }
} }
} }
.btn.search-icon.has-search-button-text {
order: 2;
margin-left: 0.5em;
column-gap: 0.5em;
background-color: var(--tertiary);
color: var(--secondary);
&:hover {
background-color: var(--tertiary-hover);
}
.d-icon {
color: var(--secondary);
}
+ .search-input #search-term[type="text"] {
padding-left: 0.5em;
}
}
.search-input .btn.search-context { .search-input .btn.search-context {
margin: 0; margin: 0;

View File

@ -108,18 +108,23 @@ export default apiInitializer("1.14.0", (api) => {
this.state.showHeaderResults === true; this.state.showHeaderResults === true;
let contents = []; let contents = [];
let buttonClass =
I18n.t(themePrefix("search_banner.search_button_text")) === ""
? "btn search-icon"
: "btn search-icon has-search-button-text";
if (formFactor === "widget") { if (formFactor === "widget") {
contents.push( contents.push(
this.attach("link", { this.attach("link", {
href: this.fullSearchUrl({ expanded: true }), href: this.fullSearchUrl({ expanded: true }),
contents: () => [ contents: () => [
iconNode("search"),
h( h(
"span", "span",
I18n.t(themePrefix("search_banner.search_button_text")) I18n.t(themePrefix("search_banner.search_button_text"))
), ),
iconNode("search"),
], ],
className: "btn search-icon", className: buttonClass,
title: "search.open_advanced", title: "search.open_advanced",
}) })
); );