Integrate the menu button in the search box

Allows us to make the search box wider, too
This commit is contained in:
2026-02-20 18:35:01 +04:00
parent bf12305600
commit 00454c8fab
5 changed files with 94 additions and 41 deletions

View File

@@ -24,16 +24,7 @@ export default class AppHeaderComponent extends Component {
<template>
<header class="app-header">
<div class="header-left">
<button
class="menu-btn btn-press"
type="button"
aria-label="Menu"
{{on "click" @onToggleMenu}}
>
<Icon @name="menu" @size={{24}} @color="#333" />
</button>
<SearchBox />
<SearchBox @onToggleMenu={{@onToggleMenu}} />
</div>
<div class="header-right">

View File

@@ -17,6 +17,7 @@ import navigation from 'feather-icons/dist/icons/navigation.svg?raw';
import phone from 'feather-icons/dist/icons/phone.svg?raw';
import plus from 'feather-icons/dist/icons/plus.svg?raw';
import server from 'feather-icons/dist/icons/server.svg?raw';
import search from 'feather-icons/dist/icons/search.svg?raw';
import settings from 'feather-icons/dist/icons/settings.svg?raw';
import target from 'feather-icons/dist/icons/target.svg?raw';
import user from 'feather-icons/dist/icons/user.svg?raw';
@@ -40,6 +41,7 @@ const ICONS = {
phone,
plus,
server,
search,
settings,
target,
user,

View File

@@ -122,9 +122,15 @@ export default class SearchBoxComponent extends Component {
<template>
<div class="search-box">
<form class="search-form" {{on "submit" this.handleSubmit}}>
<div class="search-icon">
<Icon @name="search" @size={{18}} @color="#666" />
</div>
<button
type="button"
class="menu-btn-integrated"
aria-label="Menu"
{{on "click" @onToggleMenu}}
>
<Icon @name="menu" @size={{24}} @color="#5f6368" />
</button>
<input
type="search"
class="search-input"
@@ -136,6 +142,15 @@ export default class SearchBoxComponent extends Component {
{{on "blur" this.handleBlur}}
autocomplete="off"
/>
<button
type="submit"
class="search-submit-btn"
aria-label="Search"
>
<Icon @name="search" @size={{20}} @color="#5f6368" />
</button>
{{#if this.query}}
<button
type="button"
@@ -143,7 +158,7 @@ export default class SearchBoxComponent extends Component {
{{on "click" this.clear}}
aria-label="Clear"
>
<Icon @name="x" @size={{16}} @color="#999" />
<Icon @name="x" @size={{16}} @color="#5f6368" />
</button>
{{/if}}
</form>

View File

@@ -87,19 +87,6 @@ body {
transform: scale(0.95);
}
.menu-btn {
background: white;
border: none;
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 5px rgb(0 0 0 / 20%);
cursor: pointer;
}
.user-btn {
background: none;
border: none;
@@ -760,14 +747,14 @@ button.create-place {
.search-box {
position: relative;
width: 100%;
max-width: 320px;
margin-left: 1rem;
max-width: 400px;
margin-left: 0;
z-index: 3002; /* Higher than menu button to be safe */
}
@media (max-width: 768px) {
.search-box {
max-width: 200px; /* Smaller on mobile */
max-width: calc(100vw - 80px); /* Smaller on mobile but wider than before */
margin-left: 0.5rem;
}
}
@@ -778,8 +765,8 @@ button.create-place {
background: white;
border-radius: 24px; /* Pill shape */
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
padding: 0 0.75rem;
height: 40px;
padding: 0 0.5rem;
height: 48px; /* Slightly taller for touch targets */
transition: box-shadow 0.2s;
}
@@ -787,23 +774,45 @@ button.create-place {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
/* Integrated Menu Button */
.menu-btn-integrated {
background: transparent;
border: none;
padding: 8px;
margin-right: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
color: #5f6368;
}
.menu-btn-integrated:hover {
background: rgba(0, 0, 0, 0.05);
}
/* Fallback Search Icon (Left) */
.search-icon {
display: flex;
align-items: center;
color: #666;
justify-content: center;
color: #5f6368;
margin-right: 0.5rem;
padding: 8px; /* Match button size */
}
.search-input {
border: none;
background: transparent;
flex: 1;
min-width: 0;
height: 100%;
font-size: 1rem;
color: #333;
outline: none;
width: 100%;
padding: 0;
padding: 0 4px;
/* Remove native search cancel button in WebKit */
-webkit-appearance: none;
}
@@ -813,20 +822,56 @@ button.create-place {
-webkit-appearance: none;
}
.search-clear-btn {
background: none;
/* Submit Button (Right) */
.search-submit-btn {
background: transparent;
border: none;
padding: 4px;
padding: 8px;
cursor: pointer;
display: flex;
align-items: center;
color: #999;
justify-content: center;
color: #5f6368;
border-radius: 50%;
margin-left: 4px;
border-left: 1px solid #ddd; /* Separator like Google Maps */
padding-left: 12px;
border-radius: 0; /* Reset for separator look */
}
.search-submit-btn:hover {
/* No background on hover if we use separator style, or maybe just change icon color */
color: #1a73e8; /* Blue on hover */
}
/* If we want the separator style, we need to adjust border-radius carefully or use a pseudo element */
/* Let's stick to a simple button for now, maybe without the separator if it looks cleaner */
.search-submit-btn {
border-left: none; /* Remove separator for cleaner look */
padding-left: 8px;
border-radius: 50%;
}
.search-submit-btn:hover {
background: rgba(0, 0, 0, 0.05);
color: #333;
}
.search-clear-btn {
background: none;
border: none;
padding: 8px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: #5f6368;
border-radius: 50%;
margin-left: 2px;
}
.search-clear-btn:hover {
background: #f0f0f0;
color: #666;
background: rgba(0, 0, 0, 0.05);
color: #333;
}
/* Search Results Popover */

View File

@@ -14,6 +14,6 @@ module('Integration | Component | app-header', function (hooks) {
assert.dom('header.app-header').exists();
assert.dom('.search-box').exists('Search box is present in the header');
assert.dom('.menu-btn').exists('Menu button is present');
assert.dom('.menu-btn-integrated').exists('Menu button is integrated');
});
});