feat(v2): allow to change location of search bar (#4199)

* feat(v2): allow to change location of search bar

* add SearchBar swizzle comment

* quickfix for NavbarItem theme config

* typing quickfix

* doc typo

Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
Alexey Pyltsyn 2021-02-09 18:31:52 +03:00 committed by GitHub
parent 2a12869fc0
commit b3b658f687
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 91 additions and 24 deletions

View file

@ -107,6 +107,11 @@ const LocaleDropdownNavbarItemSchema = Joi.object({
className: Joi.string(),
});
const SearchItemSchema = Joi.object({
type: Joi.string().equal('search').required(),
position: NavbarItemPosition,
});
// Can this be made easier? :/
const isOfType = (type) => {
let typeSchema = Joi.string().required();
@ -139,6 +144,10 @@ const NavbarItemSchema = Joi.object().when({
is: isOfType('localeDropdown'),
then: LocaleDropdownNavbarItemSchema,
},
{
is: isOfType('search'),
then: SearchItemSchema,
},
{
is: isOfType(undefined),
then: Joi.forbidden().messages({