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 the breadcrumbs component #1122

Merged
merged 111 commits into from
Feb 26, 2023
Merged

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Feb 26, 2023

Abstract

Cherry picks and refactors #1120 into master.

Usage

The component can be rendered using the following Blade snippet:

<x-hyde::breadcrumbs />

The breadcrumb data will automatically be generated from the current page.

Notable changes

  • Breaking: Move the getBreadcrumbs method from the Route model to view component
  • Breaking: Pluralizes the class and view name so it's breadcrumbs instead of breadcrumb
  • Updates the registered view key to match the anonymous one (so the component class is always used)
  • Refactors to construct the breadcumbs variable in the component class instead of the view
  • Refactors the view to use accessible semantic HTML, see W3C resources
  • Formats the paths to relative links so they can be properly resolved
  • Add support for both .html references and pretty URLs
  • Adds tests

@codecov
Copy link

codecov bot commented Feb 26, 2023

Codecov Report

Merging #1122 (9c11d21) into master (4b62ebb) will not change coverage.
The diff coverage is 100.00%.

@@              Coverage Diff              @@
##              master     #1122     +/-   ##
=============================================
  Coverage     100.00%   100.00%             
- Complexity      1322      2658   +1336     
=============================================
  Files            155       312    +157     
  Lines           3474      6986   +3512     
=============================================
+ Hits            3474      6986   +3512     
Impacted Files Coverage Δ
...k/src/Foundation/Providers/ViewServiceProvider.php 100.00% <100.00%> (ø)
...ramework/Views/Components/BreadcrumbsComponent.php 100.00% <100.00%> (ø)
...rk/src/Console/Commands/PackageDiscoverCommand.php 100.00% <0.00%> (ø)
develop/packages/framework/src/Facades/Meta.php 100.00% <0.00%> (ø)
...rc/Framework/Factories/Concerns/CoreDataObject.php 100.00% <0.00%> (ø)
...ckages/framework/src/Foundation/Facades/Routes.php 100.00% <0.00%> (ø)
...ork/src/Foundation/Concerns/ForwardsHyperlinks.php 100.00% <0.00%> (ø)
develop/packages/framework/src/helpers.php 100.00% <0.00%> (ø)
...ork/src/Console/Commands/PublishConfigsCommand.php 100.00% <0.00%> (ø)
...src/Framework/Actions/CreatesNewPageSourceFile.php 100.00% <0.00%> (ø)
... and 148 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

caendesilva and others added 27 commits February 26, 2023 15:49
Makes so the view is resolved using same syntax as the anonymous view, instead of via x-breadcrumb
@caendesilva caendesilva force-pushed the refactor-breadcrumb-component branch from eaa9fec to c6fa7c2 Compare February 26, 2023 20:59
@caendesilva caendesilva merged commit 7c93155 into master Feb 26, 2023
@caendesilva caendesilva deleted the refactor-breadcrumb-component branch February 26, 2023 21:11
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.

3 participants