UX: add optional search button text (#33)

* UX: add optional search button text

* include i18n
This commit is contained in:
Kris 2023-07-27 17:46:38 -04:00 committed by GitHub
parent fab3594c81
commit eeeb391c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View File

@ -72,20 +72,24 @@ $max-width: 600px;
text-align: center; text-align: center;
} }
.search-icon { .btn.search-icon {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
order: 2; order: 2;
right: 0; right: 0;
background: transparent; background: transparent;
padding-top: 0.6em;
line-height: 1;
color: var(--primary-high);
.d-icon { .d-icon {
margin: 0; margin: 0 0 0 0.33em;
} }
.discourse-no-touch & { .discourse-no-touch & {
&:hover { &:hover {
background: transparent; background: transparent;
color: var(--primary);
.d-icon { .d-icon {
color: var(--primary-high); color: currentColor;
} }
} }
} }

View File

@ -1,6 +1,8 @@
import { apiInitializer } from "discourse/lib/api"; import { apiInitializer } from "discourse/lib/api";
import { logSearchLinkClick } from "discourse/lib/search"; import { logSearchLinkClick } from "discourse/lib/search";
import { iconNode } from "discourse-common/lib/icon-library"; import { iconNode } from "discourse-common/lib/icon-library";
import { h } from "virtual-dom";
import I18n from "I18n";
export default apiInitializer("0.8", (api) => { export default apiInitializer("0.8", (api) => {
const enableConnectorName = settings.plugin_outlet; const enableConnectorName = settings.plugin_outlet;
@ -114,7 +116,13 @@ export default apiInitializer("0.8", (api) => {
contents.push( contents.push(
this.attach("link", { this.attach("link", {
href: this.fullSearchUrl({ expanded: true }), href: this.fullSearchUrl({ expanded: true }),
contents: () => iconNode("search"), contents: () => [
h(
"span",
I18n.t(themePrefix("search_banner.search_button_text"))
),
iconNode("search"),
],
className: "btn search-icon", className: "btn search-icon",
title: "search.open_advanced", title: "search.open_advanced",
}) })

View File

@ -2,3 +2,4 @@ en:
search_banner: search_banner:
headline: "Welcome to our community" headline: "Welcome to our community"
subhead: "We're happy to have you here. If you need help, please search before you post." subhead: "We're happy to have you here. If you need help, please search before you post."
search_button_text: ""