Skip to content

Commit

Permalink
Merge pull request #1477 from hydephp/documentation-sidebar-footer-co…
Browse files Browse the repository at this point in the history
…nfiguration-option

Update configuration option for the documentation sidebar footer to allow custom Markdown to be specified hydephp/develop@b4e6831
  • Loading branch information
github-actions committed Nov 26, 2023
1 parent eb44791 commit c03d972
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
// When using a grouped sidebar, should the groups be collapsible?
'collapsible' => true,

// Should the sidebar footer be shown?
// Should the sidebar footer be shown? You can also set this to a string
// of Markdown to show in the footer. Set to `false` to disable.
'footer' => true,
],

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<p>
<a href="{{ Hyde::relativeLink('index.html') }}">Back to home page</a>
@if(is_bool(config('docs.sidebar.footer', true)))
<a href="{{ Hyde::relativeLink('index.html') }}">Back to home page</a>
@else
{{ Hyde::markdown(config('docs.sidebar.footer')) }}
@endif
</p>
2 changes: 1 addition & 1 deletion resources/views/components/docs/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'sidebar' => \Hyde\Framework\Features\Navigation\DocumentationSidebar::create(),
])
</nav>
@if(config('docs.sidebar.footer', true))
@if(config('docs.sidebar.footer', true) !== false)
<footer id="sidebar-footer" class="h-16 p-4 w-full bottom-0 left-0 text-center leading-8">
@include('hyde::components.docs.sidebar-footer-text')
</footer>
Expand Down
11 changes: 11 additions & 0 deletions tests/Feature/SidebarViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ public function testBaseSidebarWithoutFooter()
$this->assertViewWasNotRendered(view('hyde::components.docs.sidebar-footer-text'));
}

public function testBaseSidebarWithCustomFooterText()
{
config(['docs.sidebar.footer' => 'My **Markdown** Footer Text']);

$this->renderComponent(view('hyde::components.docs.sidebar'))
->assertSeeHtml('<footer id="sidebar-footer"')
->assertSeeHtml('<p>My <strong>Markdown</strong> Footer Text</p>')
->assertDontSee('Back to home page')
->allGood();
}

public function testBaseSidebarCustomHeaderBrand()
{
config(['docs.sidebar.header' => 'My Custom Header']);
Expand Down

0 comments on commit c03d972

Please sign in to comment.