Add new feature: Breadcrumb component (#632)

* Add breadcrumb component

* Change breadcrumb component structure

* Remove flex-wrap from breadcrumb component
This commit is contained in:
Vinicius Albano 2017-06-27 17:29:15 -03:00 committed by Jeremy Thomas
parent 6f128bd2e7
commit fe9d971c7f
5 changed files with 311 additions and 2 deletions

View File

@ -1,6 +1,9 @@
<nav class="nav has-shadow"> <nav class="nav has-shadow">
<div class="container"> <div class="container">
<div class="nav-left"> <div class="nav-left">
<a class="nav-item is-tab {% if page.doc-subtab == 'breadcrumb' %}is-active{% endif %}" href="{{ site.url }}/documentation/components/breadcrumb/">
Breadcrumb
</a>
<a class="nav-item is-tab {% if page.doc-subtab == 'card' %}is-active{% endif %}" href="{{ site.url }}/documentation/components/card/"> <a class="nav-item is-tab {% if page.doc-subtab == 'card' %}is-active{% endif %}" href="{{ site.url }}/documentation/components/card/">
Card Card
</a> </a>

View File

@ -43,7 +43,7 @@ route: documentation
<a href="{{ site.url }}/documentation/elements/box/">Elements</a> <a href="{{ site.url }}/documentation/elements/box/">Elements</a>
</li> </li>
<li {% if page.doc-tab == 'components' %}class="is-active"{% endif %}> <li {% if page.doc-tab == 'components' %}class="is-active"{% endif %}>
<a href="{{ site.url }}/documentation/components/card/">Components</a> <a href="{{ site.url }}/documentation/components/breadcrumb/">Components</a>
</li> </li>
<li {% if page.doc-tab == 'layout' %}class="is-active"{% endif %}> <li {% if page.doc-tab == 'layout' %}class="is-active"{% endif %}>
<a href="{{ site.url }}/documentation/layout/container/">Layout</a> <a href="{{ site.url }}/documentation/layout/container/">Layout</a>

View File

@ -0,0 +1,239 @@
---
layout: documentation
doc-tab: components
doc-subtab: breadcrumb
---
{% include subnav-components.html %}
<section class="section">
<div class="container">
<h1 class="title">Breadcrumb</h1>
<h2 class="subtitle">A simple breadcrumb component to improve your navigation experience</h2>
<hr>
<div class="content">
<p>The <strong>breadcrumb</strong> component only requires a <code>.breadcrumb</code> container and a <code>ul</code> list.</p>
<p>The dividers are automatically created in the content of the <code>::before</code> pseudo-element of <code>li</code> tags.</p>
<p>You can inform the current page using the <code>is-active</code> modifier in a <code>li</code> tag. It will disable the navigation of inner links.</p>
</div>
<hr>
{% capture breadcrumb_example %}
<nav class="breadcrumb">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_example}}
</div>
{% highlight html %}
{{breadcrumb_example}}
{% endhighlight %}
<hr>
<h3 class="title">Alignment</h3>
<div class="content">
<p>For alternative alignments, use the <code>is-centered</code> and <code>is-right</code> modifiers on the <code>.breadcrumb</code> container.</p>
</div>
{% capture breadcrumb_centered_example %}
<nav class="breadcrumb is-centered">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_centered_example}}
</div>
{% highlight html %}
{{breadcrumb_centered_example}}
{% endhighlight %}
{% capture breadcrumb_right_example %}
<nav class="breadcrumb is-right">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_right_example}}
</div>
{% highlight html %}
{{breadcrumb_right_example}}
{% endhighlight %}
<hr>
<h3 class="title">Icons</h3>
<div class="content">
<p>You can use any of the <a href="http://fortawesome.github.io/Font-Awesome/">Font Awesome</a> <strong>icons</strong>.</p>
</div>
{% capture breadcrumb_icons_example %}
<nav class="breadcrumb">
<ul>
<li><a><span class="icon is-small"><i class="fa fa-home"></i></span><span>Bulma</span></a></li>
<li><a><span class="icon is-small"><i class="fa fa-book"></i></span><span>Documentation</span></a></li>
<li><a><span class="icon is-small"><i class="fa fa-puzzle-piece"></i></span><span>Components</span></a></li>
<li class="is-active"><a><span class="icon is-small"><i class="fa fa-thumbs-up"></i></span><span>Breadcrumb</span></a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_icons_example}}
</div>
{% highlight html %}
{{breadcrumb_icons_example}}
{% endhighlight %}
<hr>
<h3 class="title">Sizes</h3>
<div class="content">
<p>You can choose between <strong>3 additional sizes</strong>: <code>is-small</code> <code>is-medium</code> and <code>is-large</code>.</p>
</div>
{% capture breadcrumb_small_example %}
<nav class="breadcrumb is-small">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_small_example}}
</div>
{% highlight html %}
{{breadcrumb_small_example}}
{% endhighlight %}
{% capture breadcrumb_medium_example %}
<nav class="breadcrumb is-medium">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_medium_example}}
</div>
{% highlight html %}
{{breadcrumb_medium_example}}
{% endhighlight %}
{% capture breadcrumb_large_example %}
<nav class="breadcrumb is-large">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_large_example}}
</div>
{% highlight html %}
{{breadcrumb_large_example}}
{% endhighlight %}
<hr>
<h3 class="title">Alternative separators</h3>
<div class="content">
<p>You can choose between <strong>4 additional separators</strong>: <code>has-arrow-separator</code> <code>has-bullet-separator</code> <code>has-dot-separator</code> and <code>has-succeeds-separator</code>.</p>
</div>
{% capture breadcrumb_arrow_example %}
<nav class="breadcrumb has-arrow-separator">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_arrow_example}}
</div>
{% highlight html %}
{{breadcrumb_arrow_example}}
{% endhighlight %}
{% capture breadcrumb_bullet_example %}
<nav class="breadcrumb has-bullet-separator">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_bullet_example}}
</div>
{% highlight html %}
{{breadcrumb_bullet_example}}
{% endhighlight %}
{% capture breadcrumb_dot_example %}
<nav class="breadcrumb has-dot-separator">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_dot_example}}
</div>
{% highlight html %}
{{breadcrumb_dot_example}}
{% endhighlight %}
{% capture breadcrumb_succeeds_example %}
<nav class="breadcrumb has-succeeds-separator">
<ul>
<li><a>Bulma</a></li>
<li><a>Documentation</a></li>
<li><a>Components</a></li>
<li class="is-active"><a>Breadcrumb</a></li>
</ul>
</nav>
{% endcapture %}
<div class="example">
{{breadcrumb_succeeds_example}}
</div>
{% highlight html %}
{{breadcrumb_succeeds_example}}
{% endhighlight %}
</div>
</section>

View File

@ -1,5 +1,6 @@
@charset "utf-8" @charset "utf-8"
@import "breadcrumb.sass"
@import "card.sass" @import "card.sass"
@import "level.sass" @import "level.sass"
@import "media.sass" @import "media.sass"

View File

@ -0,0 +1,66 @@
.breadcrumb
+block
+unselectable
align-items: stretch
display: flex
font-size: $size-normal
overflow: hidden
overflow-x: auto
white-space: nowrap
a
align-items: center
color: $text-light
display: flex
justify-content: center
padding: 0.5em 0.75em
&:hover
color: $link-hover
li
align-items: center
display: flex
&.is-active
a
color: $text-strong
cursor: default
pointer-events: none
& + li:before
color: $text
content: '\0002f'
ul, ol
align-items: center
display: flex
flex-grow: 1
flex-shrink: 0
justify-content: flex-start
.icon
&:first-child
margin-right: 0.5em
&:last-child
margin-left: 0.5em
// Alignment
&.is-centered
ol, ul
justify-content: center
&.is-right
ol, ul
justify-content: flex-end
// Sizes
&.is-small
font-size: $size-small
&.is-medium
font-size: $size-medium
&.is-large
font-size: $size-large
// Styles
&.has-arrow-separator
li + li:before
content: '\02192'
&.has-bullet-separator
li + li:before
content: '\02022'
&.has-dot-separator
li + li:before
content: '\000b7'
&.has-succeeds-separator
li + li:before
content: '\0227B'