1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-28 01:10:58 +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> <script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script>
{% endblock %} {% endblock %}
{% block styles %} {% 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 %} {% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css">
{% endif %} {% endif %}

View File

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

View File

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

View File

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

View File

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