-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Library routing in mobile (#51558)
- Loading branch information
1 parent
70745bd
commit e08f66f
Showing
5 changed files
with
92 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
/** | ||
* Returns if the params match the list page route. | ||
* | ||
* @param {Object} params The url params. | ||
* @param {string} params.path The current path. | ||
* @param {Object} params The url params. | ||
* @param {string} params.path The current path. | ||
* @param {string} [params.categoryType] The current category type. | ||
* @param {string} [params.categoryId] The current category id. | ||
* @param {boolean} isMobileViewport Is mobile viewport. | ||
* | ||
* @return {boolean} Is list page or not. | ||
*/ | ||
export default function getIsListPage( { path } ) { | ||
return path === '/wp_template/all' || path === '/library'; | ||
export default function getIsListPage( | ||
{ path, categoryType, categoryId }, | ||
isMobileViewport | ||
) { | ||
return ( | ||
path === '/wp_template/all' || | ||
( path === '/library' && | ||
// Don't treat "/library" without categoryType and categoryId as a list page | ||
// in mobile because the sidebar covers the whole page. | ||
( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) ) | ||
); | ||
} |