Skip to content

Commit

Permalink
Convert sidebar to topbar (in progress, incomplete)
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-arthur committed Jan 14, 2025
1 parent ddb2643 commit f2404f0
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ defaults:
type: pages
values:
layout: single
sidebar:
topbar:
nav: "teaching"
# teaching/courses
- scope:
Expand All @@ -447,7 +447,7 @@ defaults:
layout: single
share: false
date_format: "%Y"
sidebar:
topbar:
nav: "teaching"
# teaching/student-work
- scope:
Expand All @@ -457,7 +457,7 @@ defaults:
layout: single
share: false
date_format: "%Y"
sidebar:
topbar:
nav: "teaching"


Expand Down
42 changes: 42 additions & 0 deletions _includes/topbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% if page.topbar %}
<div class="topbar">
{% for s in page.topbar %}
{% if s.image %}
<img src="{{ s.image | relative_url }}"
alt="{% if s.image_alt %}{{ s.image_alt }}{% endif %}">
{% endif %}
{% if s.title %}<h3>{{ s.title }}</h3>{% endif %}
{% if s.text %}{{ s.text | markdownify }}{% endif %}
{% if s.nav %}{% include nav_list nav=s.nav %}{% endif %}
{% endfor %}
{% if page.topbar.nav %}
{% include nav_list nav=page.topbar.nav %}
{% endif %}

</div>


<!-- convert masthead instead of sidebar! -->
<!--
<div class="topbar">
<div class="topbar__inner-wrap">
<div class="topbar__menu">
<nav id="topbar-nav" class="greedy-nav">
<ul class="visible-links">
{%- for link in site.data.navigation.main -%}
<li class="masthead__menu-item">
<a href="{{ link.url | relative_url }}"{% if link.description %} title="{{ link.description }}"{% endif %}>{{ link.title }}</a>
</li>
{%- endfor -%}
</ul>
<button class="greedy-nav__toggle hidden" type="button">
<span class="visually-hidden">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle menu" }}</span>
<div class="navicon"></div>
</button>
<ul class="hidden-links hidden"></ul>
</nav>
</div>
</div>
</div> -->

{% endif %}
1 change: 1 addition & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<body class="layout--{{ page.layout | default: layout.layout }}{% if page.classes or layout.classes %}{{ page.classes | default: layout.classes | join: ' ' | prepend: ' ' }}{% endif %}">
{% include_cached skip-links.html %}
{% include_cached masthead.html %}
{% include topbar.html %}

<div class="initial-content">
{{ content }}
Expand Down
81 changes: 81 additions & 0 deletions _sass/minimal-mistakes/_topbar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* ==========================================================================
TOPBAR
========================================================================== */

/*
Default
========================================================================== */


.topbar {
position: relative;
border-bottom: 1px solid $border-color;
-webkit-animation: $intro-transition;
animation: $intro-transition;
-webkit-animation-delay: 0.15s;
animation-delay: 0.15s;
z-index: 20;
background-color: $header-background-color;

&__inner-wrap {
@include clearfix;
margin-left: auto;
margin-right: auto;
padding: 1em;
max-width: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
font-family: $sans-serif-narrow;

@include breakpoint($x-large) {
max-width: $max-width;
}

nav {
z-index: 10;
}

a {
text-decoration: none;
}
}
}

.topbar__menu {
float: left;
margin-left: 0;
margin-right: 0;
width: 100%;
clear: both;

.site-nav {
margin-left: 0;

@include breakpoint($small) {
float: right;
}
}

ul {
margin: 0;
padding: 0;
clear: both;
list-style-type: none;
}
}

.topbar__menu-item {
display: block;
list-style-type: none;
white-space: nowrap;

&--lg {
padding-right: 2em;
font-weight: 700;
}
}

0 comments on commit f2404f0

Please sign in to comment.