Skip to content

Commit

Permalink
feat: work with new side bar
Browse files Browse the repository at this point in the history
  • Loading branch information
KawaiiZapic committed Sep 5, 2024
1 parent 3d1adb7 commit 4efb4ab
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>
</noscript>
<mdui-top-app-bar scroll-behavior="shrink" variant="large" class="matecho-app-bar__<?php echo $this->archiveType;?>" id="matecho-app-bar">
<mdui-button-icon aria-label="导航栏" id="matecho-drawer-btn">
<mdui-button-icon aria-label="导航栏" id="matecho-drawer-btn" class="md:w-56px md:mx-4px">
<mdui-icon-menu></mdui-icon-menu>
</mdui-button-icon>
<mdui-top-app-bar-title id="matecho-app-bar-title" style="display: none;">
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function initOnce() {
"#matecho-pjax-main",
"#matecho-app-bar-title__inner",
"#matecho-sidebar-list",
"#matecho-side-nav",
"meta[name=matecho-template]"
],
cacheBust: false,
Expand Down
30 changes: 30 additions & 0 deletions src/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@
/** @var \Widget\Archive $this */
?>

<mdui-navigation-rail id="matecho-side-nav" class="hidden md:block fixed" contained>
<a href="/">
<mdui-navigation-rail-item <?php Matecho::activePage($this, "index"); ?> >
<mdui-icon-home slot="icon"></mdui-icon-home>
首页
</mdui-navigation-rail-item>
</a>
<a>
<mdui-navigation-rail-item>
<mdui-icon-category slot="icon"></mdui-icon-category>
分类
</mdui-navigation-rail-item>
</a>
<?php
$this->widget('Widget_Contents_Page_List')->to($page);
/** @var \Widget\Contents\Page\Rows $page */
while ($page->next()) {
?>
<a href="<?php $page->permalink() ?>">
<mdui-navigation-rail-item <?php Matecho::activePage($this, "page", $page->cid); ?> >
<?php
$icon = Matecho::pageIcon($page);
echo "<mdui-icon-$icon slot=\"icon\"></mdui-icon-$icon>" ;
?>
<?php echo $page->title ?>
</mdui-navigation-rail-item>
</a>
<?php } ?>
</mdui-navigation-rail>

<mdui-navigation-drawer close-on-overlay-click id="matecho-drawer" modal>
<nav>
<mdui-list id="matecho-sidebar-list">
Expand Down
11 changes: 9 additions & 2 deletions src/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
width: 824px;
height: 240px;
top: 223px;
left: calc((100% - 824px) / 2);
left: calc((100% - 824px + 80px) / 2);
background-color: transparent;
box-shadow: none;

Expand All @@ -20,7 +20,14 @@
}
}

@media (width <= 840px) {
@media (width <= 937px) {
.matecho-article-card__animating {
width: calc(100% - 80px - 1rem);
left: calc(80px + 0.5rem);
}
}

@media (width <= 839px) {
.matecho-article-card__animating {
width: 100%;
top: 198px;
Expand Down
12 changes: 12 additions & 0 deletions src/style/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ body {
}
}

#matecho-side-nav {
margin-top: 64px;
height: calc(100vh - 64px);

& > a {
text-decoration: none !important;
width: 100%;
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}
}

#matecho-sidebar-list {
a:hover {
text-decoration: none;
Expand Down

0 comments on commit 4efb4ab

Please sign in to comment.