Integrate the menu button in the search box
Allows us to make the search box wider, too
This commit is contained in:
@@ -24,16 +24,7 @@ export default class AppHeaderComponent extends Component {
|
|||||||
<template>
|
<template>
|
||||||
<header class="app-header">
|
<header class="app-header">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<button
|
<SearchBox @onToggleMenu={{@onToggleMenu}} />
|
||||||
class="menu-btn btn-press"
|
|
||||||
type="button"
|
|
||||||
aria-label="Menu"
|
|
||||||
{{on "click" @onToggleMenu}}
|
|
||||||
>
|
|
||||||
<Icon @name="menu" @size={{24}} @color="#333" />
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<SearchBox />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
|
|||||||
@@ -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 phone from 'feather-icons/dist/icons/phone.svg?raw';
|
||||||
import plus from 'feather-icons/dist/icons/plus.svg?raw';
|
import plus from 'feather-icons/dist/icons/plus.svg?raw';
|
||||||
import server from 'feather-icons/dist/icons/server.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 settings from 'feather-icons/dist/icons/settings.svg?raw';
|
||||||
import target from 'feather-icons/dist/icons/target.svg?raw';
|
import target from 'feather-icons/dist/icons/target.svg?raw';
|
||||||
import user from 'feather-icons/dist/icons/user.svg?raw';
|
import user from 'feather-icons/dist/icons/user.svg?raw';
|
||||||
@@ -40,6 +41,7 @@ const ICONS = {
|
|||||||
phone,
|
phone,
|
||||||
plus,
|
plus,
|
||||||
server,
|
server,
|
||||||
|
search,
|
||||||
settings,
|
settings,
|
||||||
target,
|
target,
|
||||||
user,
|
user,
|
||||||
|
|||||||
@@ -122,9 +122,15 @@ export default class SearchBoxComponent extends Component {
|
|||||||
<template>
|
<template>
|
||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
<form class="search-form" {{on "submit" this.handleSubmit}}>
|
<form class="search-form" {{on "submit" this.handleSubmit}}>
|
||||||
<div class="search-icon">
|
<button
|
||||||
<Icon @name="search" @size={{18}} @color="#666" />
|
type="button"
|
||||||
</div>
|
class="menu-btn-integrated"
|
||||||
|
aria-label="Menu"
|
||||||
|
{{on "click" @onToggleMenu}}
|
||||||
|
>
|
||||||
|
<Icon @name="menu" @size={{24}} @color="#5f6368" />
|
||||||
|
</button>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
class="search-input"
|
class="search-input"
|
||||||
@@ -136,6 +142,15 @@ export default class SearchBoxComponent extends Component {
|
|||||||
{{on "blur" this.handleBlur}}
|
{{on "blur" this.handleBlur}}
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="search-submit-btn"
|
||||||
|
aria-label="Search"
|
||||||
|
>
|
||||||
|
<Icon @name="search" @size={{20}} @color="#5f6368" />
|
||||||
|
</button>
|
||||||
|
|
||||||
{{#if this.query}}
|
{{#if this.query}}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -143,7 +158,7 @@ export default class SearchBoxComponent extends Component {
|
|||||||
{{on "click" this.clear}}
|
{{on "click" this.clear}}
|
||||||
aria-label="Clear"
|
aria-label="Clear"
|
||||||
>
|
>
|
||||||
<Icon @name="x" @size={{16}} @color="#999" />
|
<Icon @name="x" @size={{16}} @color="#5f6368" />
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -87,19 +87,6 @@ body {
|
|||||||
transform: scale(0.95);
|
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 {
|
.user-btn {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
@@ -760,14 +747,14 @@ button.create-place {
|
|||||||
.search-box {
|
.search-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 320px;
|
max-width: 400px;
|
||||||
margin-left: 1rem;
|
margin-left: 0;
|
||||||
z-index: 3002; /* Higher than menu button to be safe */
|
z-index: 3002; /* Higher than menu button to be safe */
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.search-box {
|
.search-box {
|
||||||
max-width: 200px; /* Smaller on mobile */
|
max-width: calc(100vw - 80px); /* Smaller on mobile but wider than before */
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -778,8 +765,8 @@ button.create-place {
|
|||||||
background: white;
|
background: white;
|
||||||
border-radius: 24px; /* Pill shape */
|
border-radius: 24px; /* Pill shape */
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
|
||||||
padding: 0 0.75rem;
|
padding: 0 0.5rem;
|
||||||
height: 40px;
|
height: 48px; /* Slightly taller for touch targets */
|
||||||
transition: box-shadow 0.2s;
|
transition: box-shadow 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,23 +774,45 @@ button.create-place {
|
|||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
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 {
|
.search-icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #666;
|
justify-content: center;
|
||||||
|
color: #5f6368;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
|
padding: 8px; /* Match button size */
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: #333;
|
color: #333;
|
||||||
outline: none;
|
outline: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0;
|
padding: 0 4px;
|
||||||
/* Remove native search cancel button in WebKit */
|
/* Remove native search cancel button in WebKit */
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
}
|
}
|
||||||
@@ -813,20 +822,56 @@ button.create-place {
|
|||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-clear-btn {
|
/* Submit Button (Right) */
|
||||||
background: none;
|
.search-submit-btn {
|
||||||
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 4px;
|
padding: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #999;
|
justify-content: center;
|
||||||
|
color: #5f6368;
|
||||||
border-radius: 50%;
|
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 {
|
.search-clear-btn:hover {
|
||||||
background: #f0f0f0;
|
background: rgba(0, 0, 0, 0.05);
|
||||||
color: #666;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search Results Popover */
|
/* Search Results Popover */
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ module('Integration | Component | app-header', function (hooks) {
|
|||||||
|
|
||||||
assert.dom('header.app-header').exists();
|
assert.dom('header.app-header').exists();
|
||||||
assert.dom('.search-box').exists('Search box is present in the header');
|
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user