Skip to content

Commit

Permalink
feat: add basic support to Toolbar to allow conditionally disabling s…
Browse files Browse the repository at this point in the history
…ticky behavior
  • Loading branch information
sghoweri committed Jan 31, 2020
1 parent 5112ecc commit 76557e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
@@ -1,6 +1,7 @@
{% embed "@bolt-components-toolbar/toolbar.twig" with {
size: "xsmall",
theme: "none",
sticky: sticky ?? true,
gradientName: toolbarGradient | default(''),
title: {
tag: "h2",
Expand Down
10 changes: 7 additions & 3 deletions packages/components/bolt-toolbar/toolbar.scss
Expand Up @@ -3,14 +3,18 @@
.c-bolt-toolbar {
@include bolt-font-size(small);
position: relative;
z-index: 10;
width: 100%;
margin: 0 auto;
color: bolt-theme(secondary);
}

.c-bolt-toolbar--sticky {
position: sticky;
top: 0;
left: 0;
z-index: 10;
width: 100%;
width: 100vw;
margin: 0 -50vw;
color: bolt-theme(secondary);
}

.c-bolt-toolbar__inner {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/bolt-toolbar/toolbar.twig
Expand Up @@ -2,7 +2,7 @@
{% set toolbar_content = block("content") %}
{% set toolbar_content_after = block("content_after") %}

<div class="t-bolt-xdark c-bolt-toolbar c-bolt-toolbar--{{ gradientName | default('purple') }}">
<div class="t-bolt-xdark c-bolt-toolbar {{ sticky ? "c-bolt-toolbar--sticky" : "" }} c-bolt-toolbar--{{ gradientName | default('purple') }}">
<div class="c-bolt-toolbar__inner">
<div class="c-bolt-toolbar__items">
{% if title or toolbar_content_before or content_before %}
Expand Down

0 comments on commit 76557e5

Please sign in to comment.