Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercurio committed Apr 11, 2022
0 parents commit 28ffd4f
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore

phpunit.xml export-ignore
tests export-ignore

js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff

* text=auto eol=lf
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/vendor
composer.lock
composer.phar

.DS_Store
Thumbs.db
tests/.phpunit.result.cache
/tests/integration/tmp
.vagrant
.idea/*
.vscode
js/coverage-ts
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Sticky Sidenav

![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/ecnu-im/sticky-sidenav.svg)](https://packagist.org/packages/ecnu-im/sticky-sidenav) [![Total Downloads](https://img.shields.io/packagist/dt/ecnu-im/sticky-sidenav.svg)](https://packagist.org/packages/ecnu-im/sticky-sidenav)

A [Flarum](http://flarum.org) extension. Make the sidenav section sticky and scrollable. Also support hot-discussions widget.

## Installation

Install with composer:

```sh
composer require ecnu-im/sticky-sidenav:"*"
```

## Updating

```sh
composer update ecnu-im/sticky-sidenav:"*"
php flarum migrate
php flarum cache:clear
```

## Links

- [Packagist](https://packagist.org/packages/ecnu-im/sticky-sidenav)
- [GitHub](https://github.com/ecnu-im/sticky-sidenav)
- [Discuss](https://discuss.flarum.org/d/PUT_DISCUSS_SLUG_HERE)
50 changes: 50 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "ecnu-im/sticky-sidenav",
"description": "Make the sidenav section sticky and scrollable. Also support hot-discussions widget.",
"keywords": [
"flarum"
],
"type": "flarum-extension",
"license": "MIT",
"require": {
"flarum/core": "^1.2.0"
},
"authors": [
{
"name": "merc",
"email": "[email protected]",
"role": "Developer"
}
],
"extra": {
"flarum-extension": {
"title": "Sticky Sidenav",
"category": "",
"icon": {
"name": "",
"color": "",
"backgroundColor": ""
}
},
"flarum-cli": {
"modules": {
"admin": false,
"forum": true,
"js": false,
"jsCommon": false,
"css": true,
"locale": false,
"gitConf": true,
"githubActions": false,
"prettier": false,
"typescript": false,
"bundlewatch": false,
"backendTesting": false,
"editorConfig": false,
"styleci": false
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
22 changes: 22 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of ecnu-im/sticky-sidenav.
*
* Copyright (c) 2022 merc.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/

namespace ECNUIM\StickySidenav;

use Flarum\Extend;

return [
(new Extend\Frontend('forum'))

->css(__DIR__.'/less/forum.less'),


];
42 changes: 42 additions & 0 deletions less/forum.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@media (min-width: 992px) {
.sideNav>ul {
height: 100%;
position: sticky;
}

.sideNav>ul>.item-nav {
position: sticky;
top: 70px;
max-height: 90vh;
overflow-x: hidden;
overflow-y: hidden;
/* For iOS */
cursor: pointer;
/* For Firefox */
scrollbar-width: thin;

&:hover {
overflow-y: auto;
}
}

.App {
overflow-x: visible;
}
}

.hotDiscussions-widget {
position: sticky;
top: 70px;
max-height: 90vh;
}

::-webkit-scrollbar {
width: 5px;
background-color: #e0e0e0;
}

::-webkit-scrollbar-thumb {
background: #9e9e9e;
border-radius: 5px;
}

0 comments on commit 28ffd4f

Please sign in to comment.