1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +01:00

Added support for configurable icon as logo

This commit is contained in:
squidfunk 2017-09-01 15:22:50 +07:00 committed by Martin Donath
parent a1a18404e3
commit 2537e39c75
8 changed files with 51 additions and 39 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script>
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-eaef0aa2fc.css">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-b6a6d08807.css">
{% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css">
{% endif %}

View File

@ -2,14 +2,17 @@
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
{% if config.extra.logo %}
<a href="{{ config.site_url | default(nav.homepage.url, true) }}" title="{{ config.site_name }}" class="md-logo md-header-nav__button">
<img src="{{ base_url }}/{{ config.extra.logo }}" width="24" height="24">
</a>
{% else %}
<a href="{{ config.site_url | default(nav.homepage.url, true) }}" title="{{ config.site_name }}" class="md-icon md-icon--home md-header-nav__button">
</a>
{% endif %}
<a href="{{ config.site_url | default(nav.homepage.url, true) }}" title="{{ config.site_name }}" class="md-header-nav__button md-logo">
{% if config.extra.logo %}
{% if config.extra.logo.icon %}
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}" width="24" height="24">
{% endif %}
{% else %}
<i class="md-icon md-icon--home"></i>
{% endif %}
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label>

View File

@ -1,12 +1,16 @@
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="drawer">
{% if config.extra.logo %}
<i class="md-logo md-nav__button">
<img src="{{ base_url }}/{{ config.extra.logo }}">
</i>
{% else %}
<i class="md-icon md-icon--home md-nav__button"></i>
{% endif %}
<div class="md-nav__button md-logo">
{% if config.extra.logo %}
{% if config.extra.logo.icon %}
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}">
{% endif %}
{% else %}
<i class="md-icon md-icon--home"></i>
{% endif %}
</div>
{{ config.site_name }}
</label>
{% if config.repo_url %}

View File

@ -78,8 +78,8 @@
opacity: 0.7;
}
// Set correct display on image
&.md-logo img {
// Set correct display on image or icon
&.md-logo * {
display: block;
}

View File

@ -29,19 +29,20 @@
<!-- Link to home -->
<div class="md-flex__cell md-flex__cell--shrink">
{% if config.extra.logo %}
<a href="{{ config.site_url | default(nav.homepage.url, true) }}"
title="{{ config.site_name }}"
class="md-logo md-header-nav__button">
<img src="{{ base_url }}/{{ config.extra.logo }}"
width="24" height="24" />
</a>
{% else %}
<a href="{{ config.site_url | default(nav.homepage.url, true) }}"
title="{{ config.site_name }}"
class="md-icon md-icon--home md-header-nav__button">
</a>
{% endif %}
<a href="{{ config.site_url | default(nav.homepage.url, true) }}"
title="{{ config.site_name }}"
class="md-header-nav__button md-logo">
{% if config.extra.logo %}
{% if config.extra.logo.icon %}
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}"
width="24" height="24" />
{% endif %}
{% else %}
<i class="md-icon md-icon--home"></i>
{% endif %}
</a>
</div>
<!-- Button to toggle drawer -->

View File

@ -25,13 +25,17 @@
<!-- Site title -->
<label class="md-nav__title md-nav__title--site" for="drawer">
{% if config.extra.logo %}
<i class="md-logo md-nav__button">
<img src="{{ base_url }}/{{ config.extra.logo }}" />
</i>
{% else %}
<i class="md-icon md-icon--home md-nav__button"></i>
{% endif %}
<div class="md-nav__button md-logo">
{% if config.extra.logo %}
{% if config.extra.logo.icon %}
<i class="md-icon">{{ config.extra.logo.icon }}</i>
{% else %}
<img src="{{ base_url }}/{{ config.extra.logo }}" />
{% endif %}
{% else %}
<i class="md-icon md-icon--home"></i>
{% endif %}
</div>
{{ config.site_name }}
</label>