Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor documentation sidebar to use routes #286

Merged
merged 38 commits into from
Jul 29, 2022

Conversation

caendesilva
Copy link
Member

This PR refactors how the documentation sidebar is generated. The main class responsible for generating it is now extending the base navigation menu, and the sidebar items are now NavItems. This makes it more maintainable as overlapping code is reduced. It also means we properly utilize routes for the sidebar.

@@ -23,7 +23,7 @@ public function __construct()

public static function create(?RouteContract $currentRoute = null): static
{
return (new self())->setCurrentRoute($currentRoute ?? Hyde::currentRoute())->generate()->filter()->sort();
return (new static())->setCurrentRoute($currentRoute ?? Hyde::currentRoute())->generate()->filter()->sort();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix unsafe usage of new static

@codecov
Copy link

codecov bot commented Jul 29, 2022

Codecov Report

Merging #286 (bcf659d) into master (c97bdb9) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##              master      #286   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
+ Complexity       818       801   -17     
===========================================
  Files            100        97    -3     
  Lines           2052      2006   -46     
===========================================
- Hits            2052      2006   -46     
Impacted Files Coverage Δ
...s/framework/src/Models/Pages/DocumentationPage.php 100.00% <ø> (ø)
...ages/framework/src/Models/DocumentationSidebar.php 100.00% <100.00%> (ø)
packages/framework/src/Models/NavItem.php 100.00% <100.00%> (ø)
packages/framework/src/Models/NavigationMenu.php 100.00% <100.00%> (ø)
...ork/src/Models/Parsers/DocumentationPageParser.php 100.00% <100.00%> (ø)
packages/framework/src/Models/Route.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c97bdb9...bcf659d. Read the comment docs.

@caendesilva caendesilva changed the title Refactor documentation sidebar to routes Refactor documentation sidebar to use routes Jul 29, 2022
@caendesilva caendesilva marked this pull request as ready for review July 29, 2022 16:06
@caendesilva caendesilva merged commit f3d35ea into master Jul 29, 2022
@caendesilva caendesilva deleted the refactor-documentation-sidebar branch July 29, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants