Improve snippet

This commit is contained in:
Jeremy Thomas 2017-10-09 15:38:12 +01:00
parent 720ed45121
commit 70367c3b5d
22 changed files with 2121 additions and 865 deletions

View File

@ -16,10 +16,10 @@
{% if include.clipped %}bd-is-clipped{% endif %} {% if include.clipped %}bd-is-clipped{% endif %}
{% if include.size %}bd-is-{{ include.size }}{% endif %} {% if include.size %}bd-is-{{ include.size }}{% endif %}
"> ">
<div class="bd-snippet-preview"> <div class="bd-snippet-preview {% if include.paddingless %}is-paddingless{% endif %}">
{{ include.content }} {{ include.content }}
</div> </div>
<div class="bd-snippet-code {% unless include.clipped %}highlight-full{% endunless %}"> <div class="bd-snippet-code {% unless include.clipped %}highlight-full{% endunless %} {% if include.more %}bd-is-more bd-is-more-clipped{% endif %}">
{% highlight html %}{{ include.content }}{% endhighlight %} {% highlight html %}{{ include.content }}{% endhighlight %}
</div> </div>
</div> </div>

View File

@ -107,15 +107,12 @@ document.addEventListener('DOMContentLoaded', () => {
const expandEl = '<button class="button is-small bd-expand">Expand</button>'; const expandEl = '<button class="button is-small bd-expand">Expand</button>';
$el.insertAdjacentHTML('beforeend', copyEl); $el.insertAdjacentHTML('beforeend', copyEl);
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
$el.insertAdjacentHTML('beforeend', expandEl);
}
const $parent = $el.parentNode; const $parent = $el.parentNode;
if ($parent && $parent.className == 'bd-highlight-clipped') { if ($parent && $parent.classList.contains('bd-is-more')) {
const showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>'; const showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
$el.classList.add('bd-is-clipped');
$el.insertAdjacentHTML('beforeend', showEl); $el.insertAdjacentHTML('beforeend', showEl);
} else if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
$el.insertAdjacentHTML('beforeend', expandEl);
} }
itemsProcessed++; itemsProcessed++;
@ -146,11 +143,11 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
}); });
const $highlightShows = getAll('.bd-highlight-clipped .bd-show'); const $highlightShows = getAll('.highlight .bd-show');
$highlightShows.forEach($el => { $highlightShows.forEach($el => {
$el.addEventListener('click', () => { $el.addEventListener('click', () => {
$el.parentNode.classList.remove('bd-is-clipped'); $el.parentNode.parentNode.classList.remove('bd-is-more-clipped');
}); });
}); });
} }

View File

@ -33,6 +33,8 @@
margin-bottom: 1.5rem margin-bottom: 1.5rem
.bd-example .bd-example
&.bd-is-clipped
border-top-right-radius: $radius-large
& + .highlight & + .highlight
border: 1px solid $yellow border: 1px solid $yellow
border-radius: 0 0 $radius $radius border-radius: 0 0 $radius $radius
@ -40,10 +42,6 @@
margin-top: -1.5rem margin-top: -1.5rem
&:not(:last-child) &:not(:last-child)
margin-bottom: 1.5rem margin-bottom: 1.5rem
& + .bd-highlight-clipped
margin-top: -1.5rem
&:not(:last-child)
margin-bottom: 1.5rem
// Snippet // Snippet
.bd-snippet .bd-snippet
@ -62,6 +60,23 @@
.bd-snippet-code .bd-snippet-code
background-color: $pre-background background-color: $pre-background
.bd-snippet-code.bd-is-more.bd-is-more-clipped
.highlight
height: 2em
overflow: hidden
pre
overflow: hidden
.bd-show
display: flex
.bd-snippet.bd-is-horizontal
border-radius: $radius-large
border-top-left-radius: 0
.bd-snippet-code.bd-is-more.bd-is-more-clipped
.highlight
pre
padding-top: 0.325rem
.bd-snippet.bd-is-clipped .bd-snippet.bd-is-clipped
.bd-snippet-code .bd-snippet-code
overflow: auto overflow: auto
@ -69,6 +84,8 @@
+desktop +desktop
.bd-snippet.bd-is-vertical .bd-snippet.bd-is-vertical
align-items: stretch align-items: stretch
border-radius: $radius-large
border-top-left-radius: 0
display: flex display: flex
justify-content: center justify-content: center
.bd-snippet-preview, .bd-snippet-preview,
@ -79,6 +96,7 @@
.highlight, .highlight,
.highlight pre .highlight pre
align-items: stretch align-items: stretch
border-radius: 0 $radius-large $radius-large 0
display: flex display: flex
flex-direction: column flex-direction: column
.highlight, .highlight,
@ -171,36 +189,26 @@ $structure-invert: $danger-invert
box-shadow: none box-shadow: none
.bd-expand .bd-expand
right: 45px right: 45px
+tablet
pre
white-space: pre-wrap
.bd-highlight-clipped
.bd-show .bd-show
+overlay +overlay
align-items: center align-items: center
background-color: rgba(#000, 0.9) background-color: rgba($background, 0.7)
background-image: linear-gradient(rgba(#000, 0), rgba(#000, 0) 90%, rgba(#000, 1))
border: none border: none
color: $white color: rgba(#000, 0.5)
cursor: pointer cursor: pointer
display: none display: none
font-size: $size-6 font-size: $size-small
justify-content: center justify-content: center
opacity: 0.7
width: 100% width: 100%
strong strong
color: currentColor color: currentColor
font-weight: $weight-semibold font-weight: $weight-semibold
&:hover &:hover
opacity: 0.8 background-color: rgba($yellow, 0.8)
.highlight.bd-is-clipped color: rgba(#000, 0.7)
height: 4em +tablet
overflow: hidden
pre pre
overflow: hidden white-space: pre-wrap
.bd-show
display: flex
+tablet +tablet
.section:not(.is-fullwidth) > .bd-example:not(.is-fullwidth) .section:not(.is-fullwidth) > .bd-example:not(.is-fullwidth)
@ -212,6 +220,10 @@ $structure-invert: $danger-invert
.section.is-fullwidth .section.is-fullwidth
padding: 0 !important padding: 0 !important
.bd-snippet
border-left: none
border-radius: 0
border-right: none
.bd-example .bd-example
border-left: none border-left: none
border-radius: 0 border-radius: 0

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -53,6 +53,8 @@ doc-subtab: basics
</div> </div>
</div> </div>
<div class="highlight-full">
{% highlight html %}{{ columns }}{% endhighlight %} {% highlight html %}{{ columns }}{% endhighlight %}
</div> </div>
</div>
</section> </section>

View File

@ -468,7 +468,9 @@ doc-subtab: sizes
</div> </div>
</div> </div>
<div class="highlight-full">
{% highlight html %}{{ columns_narrow }}{% endhighlight %} {% highlight html %}{{ columns_narrow }}{% endhighlight %}
</div>
<div class="content"> <div class="content">
<p>As for the size modifiers, you can have narrow columns for different <strong>breakpoints</strong>:</p> <p>As for the size modifiers, you can have narrow columns for different <strong>breakpoints</strong>:</p>

View File

@ -162,8 +162,6 @@ variables:
<hr> <hr>
{% include snippet.html content=breadcrumb_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_example}}{% endhighlight %}
{% include anchor.html name="Alignment" %} {% include anchor.html name="Alignment" %}
<div class="content"> <div class="content">
@ -172,12 +170,8 @@ variables:
{% include snippet.html content=breadcrumb_centered_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_centered_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_centered_example}}{% endhighlight %}
{% include snippet.html content=breadcrumb_right_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_right_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_right_example}}{% endhighlight %}
{% include anchor.html name="Icons" %} {% include anchor.html name="Icons" %}
<div class="content"> <div class="content">
@ -186,8 +180,6 @@ variables:
{% include snippet.html content=breadcrumb_icons_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_icons_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_icons_example}}{% endhighlight %}
{% include anchor.html name="Alternative separators" %} {% include anchor.html name="Alternative separators" %}
<div class="content"> <div class="content">
@ -196,20 +188,12 @@ variables:
{% include snippet.html content=breadcrumb_arrow_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_arrow_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_arrow_example}}{% endhighlight %}
{% include snippet.html content=breadcrumb_bullet_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_bullet_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_bullet_example}}{% endhighlight %}
{% include snippet.html content=breadcrumb_dot_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_dot_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_dot_example}}{% endhighlight %}
{% include snippet.html content=breadcrumb_succeeds_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_succeeds_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_succeeds_example}}{% endhighlight %}
{% include anchor.html name="Sizes" %} {% include anchor.html name="Sizes" %}
<div class="content"> <div class="content">
@ -218,16 +202,10 @@ variables:
{% include snippet.html content=breadcrumb_small_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_small_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_small_example}}{% endhighlight %}
{% include snippet.html content=breadcrumb_medium_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_medium_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_medium_example}}{% endhighlight %}
{% include snippet.html content=breadcrumb_large_example horizontal=true clipped=true %} {% include snippet.html content=breadcrumb_large_example horizontal=true clipped=true %}
{% highlight html %}{{breadcrumb_large_example}}{% endhighlight %}
{% include variables.html %} {% include variables.html %}
</div> </div>

View File

@ -165,7 +165,9 @@ variables:
</p> </p>
</div> </div>
<div class="highlight-full">
{% highlight html %}{{ modal_card }}{% endhighlight %} {% highlight html %}{{ modal_card }}{% endhighlight %}
</div>
{% include variables.html %} {% include variables.html %}

View File

@ -767,7 +767,9 @@ document.addEventListener('DOMContentLoaded', function () {
</li> </li>
<li> <li>
a container for almost <strong>anything</strong> you want, like a <code>field</code> a container for almost <strong>anything</strong> you want, like a <code>field</code>
<div class="highlight-full">
{% highlight html %}{{ navbar_item_other_example }}{% endhighlight %} {% highlight html %}{{ navbar_item_other_example }}{% endhighlight %}
</div>
</li> </li>
</ul> </ul>
<p> <p>
@ -800,11 +802,7 @@ document.addEventListener('DOMContentLoaded', function () {
</p> </p>
</div> </div>
<div class="bd-example is-paddingless"> {% include snippet.html content=navbar_transparent_example paddingless=true horizontal=true more=true %}
{{navbar_transparent_example}}
</div>
{% highlight html %}{{navbar_transparent_example}}{% endhighlight %}
{% include anchor.html name="Dropdown menu" %} {% include anchor.html name="Dropdown menu" %}

View File

@ -205,7 +205,7 @@ variables:
</p> </p>
</div> </div>
{% include snippet.html content=pagination_example horizontal=true clipped=true %} {% include snippet.html content=pagination_example horizontal=true more=true %}
<div class="content"> <div class="content">
<p> <p>
@ -213,7 +213,7 @@ variables:
</p> </p>
</div> </div>
{% include snippet.html content=pagination_options_example horizontal=true clipped=true %} {% include snippet.html content=pagination_options_example horizontal=true more=true %}
<div class="content"> <div class="content">
<p> <p>
@ -221,9 +221,9 @@ variables:
</p> </p>
</div> </div>
{% include snippet.html content=pagination_centered_example horizontal=true clipped=true %} {% include snippet.html content=pagination_centered_example horizontal=true more=true %}
{% include snippet.html content=pagination_right_example horizontal=true clipped=true %} {% include snippet.html content=pagination_right_example horizontal=true more=true %}
{% include anchor.html name="Sizes" %} {% include anchor.html name="Sizes" %}
@ -232,11 +232,11 @@ variables:
You only need to append the <strong>modifier</strong> <code>is-small</code>, <code>is-medium</code>, or <code>is-large</code> to the <code>pagination</code> component. You only need to append the <strong>modifier</strong> <code>is-small</code>, <code>is-medium</code>, or <code>is-large</code> to the <code>pagination</code> component.
</p> </p>
{% include snippet.html content=pagination_small_example horizontal=true clipped=true %} {% include snippet.html content=pagination_small_example horizontal=true more=true %}
{% include snippet.html content=pagination_medium_example horizontal=true clipped=true %} {% include snippet.html content=pagination_medium_example horizontal=true more=true %}
{% include snippet.html content=pagination_large_example horizontal=true clipped=true %} {% include snippet.html content=pagination_large_example horizontal=true more=true %}
{% include variables.html %} {% include variables.html %}

View File

@ -384,7 +384,7 @@ variables:
{% include snippet.html content=tabs_example horizontal=true %} {% include snippet.html content=tabs_example horizontal=true %}
{% include snippet.html content=tabs_example horizontal=true clipped=true %} {% include snippet.html content=tabs_example horizontal=true more=true %}
{% include anchor.html name="Alignment" %} {% include anchor.html name="Alignment" %}
@ -394,9 +394,9 @@ variables:
</p> </p>
</div> </div>
{% include snippet.html content=tabs_centered_example horizontal=true clipped=true %} {% include snippet.html content=tabs_centered_example horizontal=true more=true %}
{% include snippet.html content=tabs_right_example horizontal=true clipped=true %} {% include snippet.html content=tabs_right_example horizontal=true more=true %}
{% include anchor.html name="Icons" %} {% include anchor.html name="Icons" %}
@ -404,20 +404,20 @@ variables:
<p>You can use any of the <a href="http://fortawesome.github.io/Font-Awesome/">Font Awesome</a> <strong>icons</strong>.</p> <p>You can use any of the <a href="http://fortawesome.github.io/Font-Awesome/">Font Awesome</a> <strong>icons</strong>.</p>
</div> </div>
{% include snippet.html content=tabs_icons_example horizontal=true clipped=true %} {% include snippet.html content=tabs_icons_example horizontal=true more=true %}
{% include snippet.html content=tabs_icons_example horizontal=true clipped=true %} {% include snippet.html content=tabs_icons_example horizontal=true more=true %}
{% include anchor.html name="Sizes" %} {% include anchor.html name="Sizes" %}
<div class="content"> <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> <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> </div>
{% include snippet.html content=tabs_small_example horizontal=true clipped=true %} {% include snippet.html content=tabs_small_example horizontal=true more=true %}
{% include snippet.html content=tabs_medium_example horizontal=true clipped=true %} {% include snippet.html content=tabs_medium_example horizontal=true more=true %}
{% include snippet.html content=tabs_large_example horizontal=true clipped=true %} {% include snippet.html content=tabs_large_example horizontal=true more=true %}
{% include anchor.html name="Styles" %} {% include anchor.html name="Styles" %}
@ -425,19 +425,19 @@ variables:
If you want a more classic style with <strong>borders</strong>, just append the <code>is-boxed</code> modifier. If you want a more classic style with <strong>borders</strong>, just append the <code>is-boxed</code> modifier.
</div> </div>
{% include snippet.html content=tabs_boxed_example horizontal=true clipped=true %} {% include snippet.html content=tabs_boxed_example horizontal=true more=true %}
<p class="content"> <p class="content">
If you want <strong>mutually exclusive</strong> tabs (like radio buttons where clicking one deselects all other ones), use the <code>is-toggle</code> modifier. If you want <strong>mutually exclusive</strong> tabs (like radio buttons where clicking one deselects all other ones), use the <code>is-toggle</code> modifier.
</p> </p>
{% include snippet.html content=tabs_toggle_example horizontal=true clipped=true %} {% include snippet.html content=tabs_toggle_example horizontal=true more=true %}
<p class="content"> <p class="content">
If you want the tabs to take up the <strong>whole width</strong> available, use <code>is-fullwidth</code>. If you want the tabs to take up the <strong>whole width</strong> available, use <code>is-fullwidth</code>.
</p> </p>
{% include snippet.html content=tabs_fullwidth_example horizontal=true clipped=true %} {% include snippet.html content=tabs_fullwidth_example horizontal=true more=true %}
{% include anchor.html name="Combining" %} {% include anchor.html name="Combining" %}
@ -445,13 +445,13 @@ variables:
<p>You can <strong>combine</strong> different modifiers. For example, you can have <strong>centered boxed</strong> tabs, or <strong>fullwidth toggle</strong> ones.</p> <p>You can <strong>combine</strong> different modifiers. For example, you can have <strong>centered boxed</strong> tabs, or <strong>fullwidth toggle</strong> ones.</p>
</div> </div>
{% include snippet.html content=tabs_centered_boxed_example horizontal=true clipped=true %} {% include snippet.html content=tabs_centered_boxed_example horizontal=true more=true %}
{% include snippet.html content=tabs_toggle_fullwidth_example horizontal=true clipped=true %} {% include snippet.html content=tabs_toggle_fullwidth_example horizontal=true more=true %}
{% include snippet.html content=tabs_centered_boxed_medium_example horizontal=true clipped=true %} {% include snippet.html content=tabs_centered_boxed_medium_example horizontal=true more=true %}
{% include snippet.html content=tabs_toggle_fullwidth_large_example horizontal=true clipped=true %} {% include snippet.html content=tabs_toggle_fullwidth_large_example horizontal=true more=true %}
{% include variables.html %} {% include variables.html %}

View File

@ -79,7 +79,7 @@ variables:
</p> </p>
</div> </div>
{% include snippet.html content=box_example %} {% include snippet.html content=box_example more=true %}
{% include variables.html %} {% include variables.html %}

View File

@ -565,14 +565,11 @@ variables:
<h4 class="subtitle">With Font Awesome icons</h4> <h4 class="subtitle">With Font Awesome icons</h4>
{% include snippet.html content=button_fa_example %} {% include snippet.html content=button_fa_example clipped=true %}
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="content"> <div class="content">
<p>
<span class="tag is-success">New!</span>
</p>
<p> <p>
If the button only contains an icon, Bulma will make sure the button remains <strong>square</strong>, no matter the size of the button <em>or</em> of the icon. If the button only contains an icon, Bulma will make sure the button remains <strong>square</strong>, no matter the size of the button <em>or</em> of the icon.
</p> </p>

View File

@ -387,11 +387,7 @@ variables:
</p> </p>
</div> </div>
<div class="bd-example"> {% include snippet.html content=table_example horizontal=true more=true %}
{{table_example}}
</div>
{% highlight html %}{{table_example}}{% endhighlight %}
{% include anchor.html name="Modifiers" %} {% include anchor.html name="Modifiers" %}

View File

@ -945,7 +945,7 @@ variables:
<p>Use the <code>is-expanded</code> modifier on the element you want to fill up the remaining space (in this case, the input):</p> <p>Use the <code>is-expanded</code> modifier on the element you want to fill up the remaining space (in this case, the input):</p>
</div> </div>
{% include snippet.html content=addons_expanded_example horizontal=true clipped=true %} {% include snippet.html content=addons_expanded_example horizontal=true more=true %}
<div class="content"> <div class="content">
<p>If you want a full width select dropdown, pair <code>control is-expanded</code> with <code>select is-fullwidth</code>.</p> <p>If you want a full width select dropdown, pair <code>control is-expanded</code> with <code>select is-fullwidth</code>.</p>
@ -1011,7 +1011,7 @@ variables:
<p>You can use <code>is-grouped</code> or <code>has-addons</code> for the child elements.</p> <p>You can use <code>is-grouped</code> or <code>has-addons</code> for the child elements.</p>
</div> </div>
{% include snippet.html content=horizontal_form_example horizontal=true clipped=true %} {% include snippet.html content=horizontal_form_example horizontal=true more=true %}
<div class="content"> <div class="content">
<p> <p>
@ -1033,7 +1033,7 @@ variables:
</ul> </ul>
</div> </div>
{% include snippet.html content=field_label_example horizontal=true clipped=true %} {% include snippet.html content=field_label_example horizontal=true more=true %}
{% capture custom_message %}Form elements can be <strong>customized</strong> using the following generic variables. Simply set one or multiple of these variables <em>before</em> importing Bulma. <a href="{{ site.url }}/documentation/overview/customize/">Learn how</a>.{% endcapture %} {% capture custom_message %}Form elements can be <strong>customized</strong> using the following generic variables. Simply set one or multiple of these variables <em>before</em> importing Bulma. <a href="{{ site.url }}/documentation/overview/customize/">Learn how</a>.{% endcapture %}

View File

@ -10,6 +10,25 @@ variables:
{% include subnav-layout.html %} {% include subnav-layout.html %}
{% capture footer_example %}
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Bulma</strong> by <a href="http://jgthms.com">Jeremy Thomas</a>. The source code is licensed
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. The website content
is licensed <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY NC SA 4.0</a>.
</p>
<p>
<a class="icon" href="https://github.com/jgthms/bulma">
<i class="fa fa-github"></i>
</a>
</p>
</div>
</div>
</footer>
{% endcapture %}
<section class="section"> <section class="section">
<div class="container"> <div class="container">
<h1 class="title">Footer</h1> <h1 class="title">Footer</h1>
@ -17,43 +36,7 @@ variables:
A simple responsive <strong>footer</strong> which can include anything: lists, headings, columns, icons, buttons, etc. A simple responsive <strong>footer</strong> which can include anything: lists, headings, columns, icons, buttons, etc.
</h2> </h2>
<div class="bd-example"> {% include snippet.html content=footer_example horizontal=true more=true %}
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Bulma</strong> by <a href="http://jgthms.com">Jeremy Thomas</a>. The source code is licensed
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. The website content
is licensed <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY NC SA 4.0</a>.
</p>
<p>
<a class="icon" href="https://github.com/jgthms/bulma">
<i class="fa fa-github"></i>
</a>
</p>
</div>
</div>
</footer>
</div>
{% highlight html %}
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
<p>
<strong>Bulma</strong> by <a href="http://jgthms.com">Jeremy Thomas</a>. The source code is licensed
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. The website content
is licensed <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY NC SA 4.0</a>.
</p>
<p>
<a class="icon" href="https://github.com/jgthms/bulma">
<i class="fa fa-github"></i>
</a>
</p>
</div>
</div>
</footer>
{% endhighlight %}
{% include variables.html layout=true %} {% include variables.html layout=true %}
</div> </div>

View File

@ -650,27 +650,7 @@ doc-subtab: hero
{% endcapture %} {% endcapture %}
<section class="section is-fullwidth"> <section class="section is-fullwidth">
<div class="bd-example"> {% include snippet.html content=heroNavbarA horizontal=true more=true %}
{{ heroNavbarA }} {% include snippet.html content=heroNavbarB horizontal=true more=true %}
</div> {% include snippet.html content=heroNavbarC horizontal=true more=true %}
<div class="bd-highlight-clipped">
{% highlight html %}{{ heroNavbarA }}{% endhighlight %}
</div>
<div class="bd-example">
{{ heroNavbarB }}
</div>
<div class="bd-highlight-clipped">
{% highlight html %}{{ heroNavbarB }}{% endhighlight %}
</div>
<div class="bd-example">
{{ heroNavbarC }}
</div>
<div class="bd-highlight-clipped">
{% highlight html %}{{ heroNavbarC }}{% endhighlight %}
</div>
</section> </section>

View File

@ -188,10 +188,7 @@ doc-subtab: level
</nav> </nav>
</div> </div>
<div class="bd-example"> {% include snippet.html content=nav_example horizontal=true more=true %}
{{nav_example}}
</div>
{% highlight html %}{{nav_example}}{% endhighlight %}
{% include anchor.html name="Centered level" %} {% include anchor.html name="Centered level" %}
@ -199,17 +196,9 @@ doc-subtab: level
If you want a <strong>centered level</strong>, you can use as many <code>level-item</code> as you want, as long as they are <strong>direct</strong> children of the <code>level</code> container. If you want a <strong>centered level</strong>, you can use as many <code>level-item</code> as you want, as long as they are <strong>direct</strong> children of the <code>level</code> container.
</div> </div>
<div class="bd-example"> {% include snippet.html content=nav_centered_example horizontal=true more=true %}
{{nav_centered_example}}
</div>
{% highlight html %}{{nav_centered_example}}{% endhighlight %} {% include snippet.html content=nav_centered_bis_example horizontal=true more=true %}
<div class="bd-example">
{{nav_centered_bis_example}}
</div>
{% highlight html %}{{nav_centered_bis_example}}{% endhighlight %}
{% include anchor.html name="Mobile level" %} {% include anchor.html name="Mobile level" %}
@ -217,11 +206,7 @@ doc-subtab: level
By default, for space concerns, the level is vertical on mobile. If you want the level to be horizontal on mobile as well, add the <code>is-mobile</code> modifier on the <code>level</code> container. By default, for space concerns, the level is vertical on mobile. If you want the level to be horizontal on mobile as well, add the <code>is-mobile</code> modifier on the <code>level</code> container.
</div> </div>
<div class="bd-example"> {% include snippet.html content=nav_mobile_example horizontal=true more=true %}
{{nav_mobile_example}}
</div>
{% highlight html %}{{nav_mobile_example}}{% endhighlight %}
</div> </div>
</section> </section>

View File

@ -203,21 +203,13 @@ doc-subtab: media-object
</article> </article>
</div> </div>
<div class="bd-example"> {% include snippet.html content=media_example horizontal=true more=true %}
{{media_example}}
</div>
{% highlight html %}{{media_example}}{% endhighlight %}
<div class="content"> <div class="content">
<p>You can include <em>any</em> other Bulma element, like inputs, textareas, icons, buttons... or even a <strong>nav bar</strong>.</p> <p>You can include <em>any</em> other Bulma element, like inputs, textareas, icons, buttons... or even a <strong>nav bar</strong>.</p>
</div> </div>
<div class="bd-example"> {% include snippet.html content=media_bis_example horizontal=true more=true %}
{{media_bis_example}}
</div>
{% highlight html %}{{media_bis_example}}{% endhighlight %}
{% include anchor.html name="Nesting" %} {% include anchor.html name="Nesting" %}
@ -225,11 +217,7 @@ doc-subtab: media-object
<p>You can nest media objects up to <strong>3 levels</strong> deep.</p> <p>You can nest media objects up to <strong>3 levels</strong> deep.</p>
</div> </div>
<div class="bd-example"> {% include snippet.html content=media_nested_example horizontal=true more=true %}
{{media_nested_example}}
</div>
{% highlight html %}{{media_nested_example}}{% endhighlight %}
</div> </div>
</section> </section>

View File

@ -7,6 +7,18 @@ doc-subtab: syntax
{% include subnav-modifiers.html %} {% include subnav-modifiers.html %}
{% capture button_example %}
<a class="button">
Button
</a>
{% endcapture %}
{% capture button_primary_example %}
<a class="button is-primary">
Button
</a>
{% endcapture %}
<section class="section"> <section class="section">
<div class="container"> <div class="container">
<h1 class="title">Modifiers syntax</h1> <h1 class="title">Modifiers syntax</h1>
@ -18,40 +30,26 @@ doc-subtab: syntax
<div class="column"> <div class="column">
<p>Let's start with a simple <strong>button</strong> that uses the <code>"button"</code> CSS class:</p> <p>Let's start with a simple <strong>button</strong> that uses the <code>"button"</code> CSS class:</p>
</div> </div>
{% capture button_example %}
<a class="button">
Button
</a>
{% endcapture %}
<div class="column"> <div class="column">
<p> <p>
{{button_example}} {{button_example}}
</p> </p>
</div> </div>
<div class="column is-half"> <div class="column is-half">
{% highlight html %} {% highlight html %}{{button_example}}{% endhighlight %}
{{button_example}}
{% endhighlight %}
</div> </div>
</div> </div>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<p>By <strong>adding</strong> the <code>"is-primary"</code> CSS class, you can modify the <strong>color</strong>:</p> <p>By <strong>adding</strong> the <code>"is-primary"</code> CSS class, you can modify the <strong>color</strong>:</p>
</div> </div>
{% capture button_primary_example %}
<a class="button is-primary">
Button
</a>
{% endcapture %}
<div class="column"> <div class="column">
<p> <p>
{{button_primary_example}} {{button_primary_example}}
</p> </p>
</div> </div>
<div class="column is-half"> <div class="column is-half">
{% highlight html %} {% highlight html %}{{button_primary_example}}{% endhighlight %}
{{button_primary_example}}
{% endhighlight %}
</div> </div>
</div> </div>
<div class="columns"> <div class="columns">
@ -85,6 +83,7 @@ doc-subtab: syntax
</p> </p>
</div> </div>
<div class="column is-half"> <div class="column is-half">
<div class="highlight-full">
{% highlight html %} {% highlight html %}
<a class="button is-primary"> <a class="button is-primary">
Button Button
@ -104,6 +103,7 @@ doc-subtab: syntax
{% endhighlight %} {% endhighlight %}
</div> </div>
</div> </div>
</div>
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="content"> <div class="content">

View File

@ -109,15 +109,12 @@ document.addEventListener('DOMContentLoaded', function () {
var expandEl = '<button class="button is-small bd-expand">Expand</button>'; var expandEl = '<button class="button is-small bd-expand">Expand</button>';
$el.insertAdjacentHTML('beforeend', copyEl); $el.insertAdjacentHTML('beforeend', copyEl);
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
$el.insertAdjacentHTML('beforeend', expandEl);
}
var $parent = $el.parentNode; var $parent = $el.parentNode;
if ($parent && $parent.className == 'bd-highlight-clipped') { if ($parent && $parent.classList.contains('bd-is-more')) {
var showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>'; var showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
$el.classList.add('bd-is-clipped');
$el.insertAdjacentHTML('beforeend', showEl); $el.insertAdjacentHTML('beforeend', showEl);
} else if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
$el.insertAdjacentHTML('beforeend', expandEl);
} }
itemsProcessed++; itemsProcessed++;
@ -148,11 +145,11 @@ document.addEventListener('DOMContentLoaded', function () {
}); });
}); });
var $highlightShows = getAll('.bd-highlight-clipped .bd-show'); var $highlightShows = getAll('.highlight .bd-show');
$highlightShows.forEach(function ($el) { $highlightShows.forEach(function ($el) {
$el.addEventListener('click', function () { $el.addEventListener('click', function () {
$el.parentNode.classList.remove('bd-is-clipped'); $el.parentNode.parentNode.classList.remove('bd-is-more-clipped');
}); });
}); });
} }