Skip to content

Commit 42c5b4a

Browse files
committed
Updated nav for Bootstrap 5.
1 parent 04ca4b2 commit 42c5b4a

File tree

1 file changed

+50
-24
lines changed

1 file changed

+50
-24
lines changed

src/DocsViewer.php

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Mistralys\MarkdownViewer;
1212

13-
use AppUtils\OutputBuffering;use AppUtils\OutputBuffering_Exception;
13+
use AppUtils\OutputBuffering;use AppUtils\OutputBuffering_Exception;use function AppLocalize\pt;
1414

1515
/**
1616
* Renders the documentation viewer UI, using the
@@ -96,7 +96,9 @@ public function getActiveFile() : DocFile
9696

9797
public function display() : void
9898
{
99-
$parser = new DocParser($this->getActiveFile());
99+
$activeFile = $this->getActiveFile();
100+
$activeFileID = $activeFile->getID();
101+
$parser = new DocParser($activeFile);
100102

101103
?><!doctype html>
102104
<html lang="en">
@@ -107,29 +109,53 @@ public function display() : void
107109
<title><?php echo $this->title ?></title>
108110
</head>
109111
<body>
110-
<nav class="navbar navbar-dark bg-dark fixed-top">
111-
<div class="navbar-content">
112-
<a class="navbar-brand" href="#"><?php echo $this->title ?></a>
113-
<ul class="navbar-nav mr-auto">
114-
<li class="nav-item dropdown">
115-
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" data-bs-toggle="dropdown" role="button">
116-
<?php echo $this->menuLabel ?>
117-
</a>
118-
<div class="dropdown-menu" aria-labelledby="navbarDropdown" style="position: absolute">
119-
<?php
120-
$files = $this->docs->getFiles();
121-
122-
foreach ($files as $file) {
123-
?>
124-
<a class="dropdown-item" href="?doc=<?php echo $file->getID() ?>">
125-
<?php echo $file->getTitle() ?>
126-
</a>
112+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
113+
<div class="container-fluid">
114+
<a class="navbar-brand" href="?"><?php echo $this->title ?></a>
115+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav" aria-controls="mainNav" aria-expanded="false" aria-label="<?php pt('Toggle navigation') ?>">
116+
<span class="navbar-toggler-icon"></span>
117+
</button>
118+
<div class="collapse navbar-collapse" id="mainNav">
119+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
120+
<li class="nav-item">
121+
<a class="nav-link active" aria-current="page" href="#">
122+
<?php echo $activeFile->getTitle() ?>
123+
</a>
124+
</li>
125+
<li class="nav-item dropdown">
126+
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
127+
<?php echo $this->menuLabel ?>
128+
</a>
129+
<ul class="dropdown-menu files-dropdown">
127130
<?php
128-
}
129-
?>
130-
</div>
131-
</li>
132-
</ul>
131+
$files = $this->docs->getFiles();
132+
133+
foreach ($files as $file)
134+
{
135+
?>
136+
<li>
137+
<a class="dropdown-item <?php if($file->getID() === $activeFileID) { echo 'disabled'; } ?>" href="?doc=<?php echo $file->getID() ?>">
138+
<?php echo $file->getTitle() ?>
139+
</a>
140+
</li>
141+
<?php
142+
}
143+
144+
for($i=0; $i < 30; $i++)
145+
{
146+
?>
147+
<li>
148+
<a class="dropdown-item" href="#">
149+
<?php echo $i ?>
150+
</a>
151+
</li>
152+
<?php
153+
}
154+
?>
155+
</ul>
156+
</li>
157+
</ul>
158+
</div>
133159
</div>
134160
</nav>
135161
<div id="scaffold">

0 commit comments

Comments
 (0)