Replace search icon png with fontawesome icon

This commit is contained in:
Johannes Rauh 2025-04-24 14:08:59 +02:00 committed by Johannes Meyer
parent 0eea5cae51
commit aa7a60c893
5 changed files with 37 additions and 29 deletions

View File

@ -8,6 +8,7 @@ $searchDashboard->setUser($this->Auth()->getUser());
if ($searchDashboard->search('dummy')->getPane('search')->hasDashlets()): ?>
<form action="<?= $this->href('search') ?>" method="get" role="search" class="search-control">
<i class="icon fa-search fa search-icon"></i>
<input type="text" name="q" id="search" class="search search-input" required
placeholder="<?= $this->translate('Search') ?> &hellip;"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">

View File

@ -3,17 +3,17 @@
namespace Icinga\Web\Widget;
use Exception;
use Icinga\Application\Icinga;
use Icinga\Data\Filter\Filter;
use Icinga\Data\Filter\FilterChain;
use Icinga\Data\Filter\FilterExpression;
use Icinga\Data\Filter\FilterOr;
use Icinga\Data\Filterable;
use Icinga\Data\FilterColumns;
use Icinga\Data\Filter\Filter;
use Icinga\Data\Filter\FilterExpression;
use Icinga\Data\Filter\FilterChain;
use Icinga\Data\Filter\FilterOr;
use Icinga\Web\Url;
use Icinga\Application\Icinga;
use Icinga\Exception\ProgrammingError;
use Icinga\Web\Notification;
use Exception;
use Icinga\Web\Url;
/**
* Filter
@ -737,10 +737,11 @@ class FilterEditor extends AbstractWidget
$preservedUrl = $this->preservedUrl();
$html = ' <form method="post" class="search inline" action="'
. $preservedUrl
. '"><input type="text" name="q" class="search search-input" value="" placeholder="'
. t('Search...')
. '" /></form>';
. $preservedUrl
. '"><i class="icon fa-search fa search-icon"></i>'
. '<input type="text" name="q" class="search search-input" value="" placeholder="'
. t('Search...')
. '" /></form>';
if ($this->filter->isEmpty()) {
$title = t('Filter this list');

View File

@ -10,6 +10,7 @@ use ipl\Html\FormElement\InputElement;
use ipl\Html\HtmlElement;
use ipl\Web\Control\SearchBar\Suggestions;
use ipl\Web\Url;
use ipl\Web\Widget\Icon;
class SingleValueSearchControl extends Form
{
@ -106,6 +107,8 @@ class SingleValueSearchControl extends Form
{
$suggestionsId = Icinga::app()->getRequest()->protectId('single-value-suggestions');
$this->addHtml(new Icon('search', Attributes::create(['class' => 'search-icon'])));
$this->addElement(
'text',
$this->searchParameter,

View File

@ -21,35 +21,35 @@
}
}
form > .search-icon {
position: absolute;
left: 0.25em;
top: ~"calc(50% - 0.5em)";
pointer-events: none;
color: @menu-color;
opacity: 0.8;
}
form:has(> .search-icon) {
position: relative;
}
.controls input.search,
input.search {
.transition(border 0.3s ease);
.transition(background-image 0.2s ease);
background-image: url(../img/icons/search_white.png);
background-repeat: no-repeat;
background-size: 1em 1em;
background-position: .25em center;
outline: none;
padding-left: 1.5em;
width: 20em;
&:focus {
background-image: url(../img/icons/search_icinga_blue.png);
}
&:focus:not([readonly]) {
border-color: @icinga-blue;
}
}
@light-mode: {
#menu input.search,
.controls input.search,
input.search {
background-image: url(../img/icons/search.png);
}
};
form:has(input.search:focus) > .search-icon {
color: @icinga-blue;
}
.backend-selection,
.pagination-control,

View File

@ -210,9 +210,12 @@
opacity: .6;
}
#menu .search-icon {
left: 1em;
}
#menu input.search {
background: transparent url('../img/icons/search_white.png') no-repeat 1em center;
background-size: 1em auto;
background-color: @menu-bg-color;
border: none;
color: @menu-color;
line-height: 2.167em;