Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Commit

Permalink
Add Sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
yousinix committed Oct 23, 2019
1 parent bb8feec commit 8f95788
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 8 deletions.
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Site settings
title : Tazkrtak
description : An admin web view to manage Tazkrtak apps.
title : تذكرتك
description : متابعة برامج تذكرتك عن طريق متصفح الإنترنت
url : "https://tazkrtak-admin.web.app"

# Build settings
Expand Down
8 changes: 8 additions & 0 deletions _data/sidebar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- title: الرئيسية
path: #

- title: المستخدمون
path: #

- title: الموظفون
path: #
5 changes: 3 additions & 2 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{{ site.description }}">

<link rel="shortcut icon" href="{{ '/assets/favicon.ico' | relative_url }}" type="image/x-icon">
<link rel="shortcut icon" href="/assets/favicon.ico">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

<link rel="stylesheet" href="/assets/css/style.css">

</head>
9 changes: 9 additions & 0 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<nav class="navbar navbar-expand navbar-dark bg-success">

<a id="sidebar-toggle" href="#sidebar-toggle" class="navbar-brand">
<span class="navbar-toggler-icon"></span>
</a>

<a class="navbar-brand" href="/">{{ site.title }}</a>

</nav>
1 change: 1 addition & 0 deletions _includes/scripts.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="/assets/js/sidebar.js"></script>
7 changes: 7 additions & 0 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="sidebar">
<ul class="sidebar-nav">
{% for item in site.data.sidebar %}
<li><a class="text-decoration-none" href="{{ item.path }}">{{ item.title }}</a></li>
{% endfor %}
</ul>
</div>
11 changes: 8 additions & 3 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

{% include head.html %}

<body class="bg-dark">
<body>

<div class="container text-white text-center p-5 my-5">
{{ content }}
{% include navbar.html %}

<div id="wrapper">
{% include sidebar.html %}
<div class="container-fluid py-3 px-5">
{{ content }}
</div>
</div>

{% include scripts.html %}
Expand Down
5 changes: 5 additions & 0 deletions _sass/_global.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body {
direction: rtl;
text-align: right;
font-family: "Cairo", sans-serif;
}
4 changes: 4 additions & 0 deletions _sass/_main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import url('https://fonts.googleapis.com/css?family=Cairo&display=swap');

@import "global",
"sidebar";
51 changes: 51 additions & 0 deletions _sass/_sidebar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
body {
overflow-x: hidden;
}

#wrapper {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;

.sidebar {
position: fixed;
right: 250px;
width: 0;
height: 100%;
margin-right: -250px;
overflow-y: auto;
background: #000;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}

&.toggled {
margin-right: 250px;
.sidebar {
width: 250px;
}
}
}

.sidebar-nav {
position: absolute;
top: 16px;
width: 250px;
padding: 0;
list-style: none;
li {
text-indent: 20px;
line-height: 56px;
a {
display: block;
color: #999;
&:hover {
color: #fff;
background: rgba(255, 255, 255, 0.2);
}
}
}
}
3 changes: 3 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
---
@import "main";
6 changes: 6 additions & 0 deletions assets/js/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$(function() {
$("#sidebar-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
});
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
layout: default
---
<h1 class="display-1 font-weight-bold">{{ site.title }}</h1>
<p class="text-monospace">initial version</h1>
<p class="text-monospace">{{ site.description }}</h1>

0 comments on commit 8f95788

Please sign in to comment.