Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit the visibility of the navbar-burger #1042

Closed
nbapp opened this issue Aug 8, 2017 · 18 comments · Fixed by #2109
Closed

Edit the visibility of the navbar-burger #1042

nbapp opened this issue Aug 8, 2017 · 18 comments · Fixed by #2109
Assignees

Comments

@nbapp
Copy link

nbapp commented Aug 8, 2017

Overview of the problem

This is about the Bulma CSS framework
I'm using Bulma 5.0.0

Description

I would like to show the hamburger menu only on a mobile device and from a tablet (769px and above) not. It does not seem possible to overwrite the default of a desktop.

@jgthms
Copy link
Owner

jgthms commented Aug 8, 2017

There could be a $navbar-breakpoint variable actually.

@jgthms jgthms self-assigned this Aug 8, 2017
@emielmolenaar
Copy link

There could be a $navbar-breakpoint variable actually.

This would be very awesome.

@mydnic
Copy link

mydnic commented Jan 23, 2018

I'm developing a kind of web-based app for a tablet screen and my temporary fix is to declare
$desktop: 769px;

@lukepighetti
Copy link

This is desperately needed. I am of the opinion that hamburgers belong only on phones and my plate.

@thatwill
Copy link

I implemented a $navbar-breakpoint variable in my case; I just changed the use of the touch/desktop mixins to new mixins which use the new variable. I could submit a PR if needed, but it seems pretty trivial.

@alxmagro
Copy link

What is the solution to this today?

@lukepighetti
Copy link

lukepighetti commented May 4, 2018

I punch this into every Bulma project now and it works 👍

//$gap: 32px;
$tablet:	568px;
$desktop:	896px + (2 * $gap);
//$widescreen:	1152px + (2 * $gap);
//$fullhd:	1344px + (2 * $gap);

Try portrait and landscape on mobile and tablet on https://pigeoncoin.org/test/team/

@JohnMica
Copy link

JohnMica commented May 7, 2018

in addition to the proposed variable $navbar-breakpoint i suggest adding the following code:

$navbar-breakpoint: $tablet !default

+from($navbar-breakpoint)
  .navbar-burger
    display: none
  .navbar,
  .navbar-menu,
  .navbar-start,
  .navbar-end
    align-items: stretch
    display: flex
  .navbar > .container
    display: flex
    justify-content: space-between
    padding-left: 0.75rem
    padding-right: 0.75rem

just before the +desktop inside the sass/components/navigation.sass

this should work on anything that is supposed to have a visible menu on landscape phones and up

@odarriba
Copy link

Any chance of getting this without modifying the breakpoints? @JohnMica 's solution looks pretty good 🚀

@cpmech
Copy link

cpmech commented May 28, 2018

Here you go my solution. In my <style> section (using Vue), I add:

$navbar-breakpoint: 414px;

@mixin my-touch {
  @media screen and (max-width: $navbar-breakpoint - 1px) {
    @content;
  }
}

@mixin my-desktop {
  @media screen and (min-width: $navbar-breakpoint) {
    @content;
  }
}

@import '~bulma/bulma';

Then I patch navbar.sass using the following diff file:

--- ../node_modules/bulma/sass/components/navbar.sass	1985-10-26 01:15:00.000000000 -0700
+++ /home/me/temp/navbar.sass	2018-05-28 13:09:44.461850380 -0700
@@ -75 +75 @@
-      +desktop
+      +my-desktop
@@ -220 +220 @@
-+touch
++my-touch
@@ -261 +261 @@
-+desktop
++my-desktop

The changes look like this:
diff-navbar-bulma-0 7 1

By the way, I'm using bulma 0.7.1.

Hope it helps ;-)

@webstractions
Copy link

@JohnMica solution solved part of the problems. Items that were not addressed included the 'untouch-ing' of the box-shadow for the menu, navbar-start and end, etc.

I devised a solution that allows you to 'untouch' things like the navbar, or anything else that you deem necessary.

src/assets/sass/main.sass

// Import Bulma
@import "@/assets/bulma/bulma.sass"

// Customization
$navbar-breakpoint: $tablet  // set this for your needs, defaults to $tablet

@import './utilities/_all.sass'
@import './components/_all.sass'

src/assets/sass/utilities/initial-variables.sass

$navbar-breakpoint: $tablet !default

src/assets/sass/utilities/mixins.sass

// multi-purpose mixin to 'untouchify' things like the navbar
=untouch
  @media screen and (min-width: $navbar-breakpoint) and (max-width: $desktop - 1px)
    @content

src/assets/sass/components/navbar.sass

+untouch
  .navbar
    & > .container
      align-items: stretch
      display: flex
      min-height: $navbar-height
      width: 100%
      padding-left: 0.75rem
      padding-right: 0.75rem
  .navbar-burger
    display: none
  .navbar,
  .navbar-menu,
  .navbar-item
    flex-grow: 1
    flex-shrink: 0
    align-items: stretch
    display: flex
  .navbar-item
    display: inline-flex
  .navbar-start
    justify-content: flex-start
    margin-right: auto
  .navbar-end 
    justify-content: flex-end
    margin-left: auto
  .navbar-menu
    box-shadow: unset

@xpuu
Copy link

xpuu commented Jul 10, 2018

@jgthms Is there any chance of getting this fixed in official release? Could donation help perhaps? Thanks...

@TheNeikos
Copy link

It's been a year 😸 Anything still blocking this?

@labogdan
Copy link

labogdan commented Sep 16, 2018

In navbar.sass, I changed two things and it seems to work how I want it. It keeps the menu open with no hamburger until phone sized screen.

On line 236:

+desktop .navbar, .navbar-menu, .navbar-start, .navbar-end

I changed +desktop to +mobile

However, that still had some remnants of the styling when you open the hamburger menu.

So then I changed

On line 200, right before .navbar > .container display: block

I changed +touch to +mobile.

@mlncn
Copy link
Contributor

mlncn commented Sep 18, 2018

Another person looking for an easier supported way of changing the nav-bar breakpoint!

@mlncn
Copy link
Contributor

mlncn commented Sep 23, 2018

Fix seeking reviews and ultimately merging in: #2109

EvelyneG added a commit to EvelyneG/bulma that referenced this issue Sep 28, 2018
Largeur minimale à partir de laquelle le burger prend la place des items du menus est maintenant configurable (voir fix jgthms#1042)
jgthms pushed a commit that referenced this issue Oct 2, 2018
* Add a navbar-breakpoint variable (as yet unused)

* Replace hard-coded +touch, +desktop with $navbar-breakpoint variable 

Using the fine +until and +from mixins, respectively.
@ghost
Copy link

ghost commented Jul 2, 2019

In navbar.sass, I changed two things and it seems to work how I want it. It keeps the menu open with no hamburger until phone sized screen.

On line 236:

+desktop .navbar, .navbar-menu, .navbar-start, .navbar-end

I changed +desktop to +mobile

However, that still had some remnants of the styling when you open the hamburger menu.

So then I changed

On line 200, right before .navbar > .container display: block

I changed +touch to +mobile.

Can I get the updated version of this? On line 235 - 239 for Bulma 0.7.5 is now:

+until($navbar-breakpoint)
  .navbar > .container
    display: block
  .navbar-brand,
  .navbar-tabs

@charles-allen
Copy link

charles-allen commented May 20, 2020

I think the fix misses an edge-case when the navbar is styled (it loses the style between $navbar-breakpoint and $desktop).

@jgthms - Can we reopen this (more specific) issue: #2334?

Mobile:
Navbar Mobile

Tablet:
Navbar Tablet

Desktop:
Navbar Desktop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

17 participants