mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 20:46:58 +02:00
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:
parent
2a12869fc0
commit
b3b658f687
10 changed files with 91 additions and 24 deletions
|
@ -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({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue