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;
}
.btn.search-icon {
.btn.search-icon:not(.has-search-button-text) {
position: absolute;
z-index: 2;
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 {
margin: 0;

View File

@ -108,18 +108,23 @@ export default apiInitializer("1.14.0", (api) => {
this.state.showHeaderResults === true;
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") {
contents.push(
this.attach("link", {
href: this.fullSearchUrl({ expanded: true }),
contents: () => [
iconNode("search"),
h(
"span",
I18n.t(themePrefix("search_banner.search_button_text"))
),
iconNode("search"),
],
className: "btn search-icon",
className: buttonClass,
title: "search.open_advanced",
})
);