mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 01:47:17 +02:00
fix(v2): navbar items: href/to validation is too strict (not retrocompatible) (#3106)
This commit is contained in:
parent
f926178e63
commit
0ecd71ec06
1 changed files with 7 additions and 1 deletions
|
@ -9,6 +9,9 @@ const Joi = require('@hapi/joi');
|
|||
|
||||
const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
||||
|
||||
// TODO we should probably create a custom navbar item type "dropdown"
|
||||
// having this recursive structure is bad because we only support 2 levels
|
||||
// + parent/child don't have exactly the same props
|
||||
const DefaultNavbarItemSchema = Joi.object({
|
||||
items: Joi.array().optional().items(Joi.link('...')),
|
||||
to: Joi.string(),
|
||||
|
@ -19,7 +22,10 @@ const DefaultNavbarItemSchema = Joi.object({
|
|||
activeBaseRegex: Joi.string(),
|
||||
className: Joi.string(),
|
||||
'aria-label': Joi.string(),
|
||||
}).xor('href', 'to');
|
||||
});
|
||||
// TODO the dropdown parent item can have no href/to
|
||||
// should check should not apply to dropdown parent item
|
||||
// .xor('href', 'to');
|
||||
|
||||
const DocsVersionNavbarItemSchema = Joi.object({
|
||||
type: Joi.string().equal('docsVersion').required(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue