Instantly share code, notes, and snippets.
✌️
Sr. Front-end Engineer
-
UCLA Health - David Geffen School of Medicine
- Los Angeles, CA
- http://mariohernandez.io
- @imariohernandez
- _mariorhernandez
mariohernandez
/ menu-good-markup.html
Created
June 3, 2019 15:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav class="main-menu"> | |
<ul class="main-menu__list"> | |
<li class="main-menu__item main-menu__item--level-0"> | |
<a href="/" class="main-menu__link">About Us</a> | |
</li> | |
<li class="main-menu__item main-menu__item--level-0"> | |
<a href="#" class="main-menu__link">Our Services</a> | |
<ul class="main-menu__submenu"> | |
<li class="main-menu__item main-menu__item--level-1"> | |
<a href="#" class="main-menu__link">Training</a> |
mariohernandez
/ menu-plain.html
Created
June 3, 2019 14:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li> | |
<a href="#">Top level link</a> | |
</li> | |
<li> | |
<a href="#">Top level link</a> | |
<ul> | |
<li> | |
<a href="#">First submenu link</a> | |
<ul> |
mariohernandez
/ menu-macro.html.twig
Created
June 3, 2019 14:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% import _self as menus %} | |
{{ menus.main_menu(items, attributes, 0) }} | |
{% macro main_menu(items, attributes, menu_level) %} | |
{% import _self as menus %} | |
{% if items %} | |
{% if menu_level == 0 %} | |
<ul{{ attributes }}> | |
{% else %} |
mariohernandez
/ main-menu.scss
Last active
January 13, 2021 19:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.navigation__menu { | |
background-color: #fff; | |
list-style-type: none; | |
margin: 0; | |
padding: 0; | |
position: relative; | |
z-index: 20; | |
// Align top level list items in a row using flexbox. | |
&.navigation--level-1 { |
mariohernandez
/ _main-menu-macro.twig
Last active
June 3, 2019 14:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# | |
/** | |
* @file | |
* Theme override to display a menu. | |
* | |
* Available variables: | |
* - menu_name: The machine name of the menu. | |
* - items: A nested list of menu items. Each menu item contains: | |
* - attributes: HTML attributes for the menu item. | |
* - below: The menu item child items. |
mariohernandez
/ main-menu.yml
Last active
March 16, 2020 23:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items: | |
- title: 'Home' | |
url: '#' | |
menu_level: 0 | |
- title: 'About Us' | |
url: '#' | |
menu_level: 0 | |
below: | |
- title: 'Our Team' | |
url: '#' |
mariohernandez
/ main-menu-include.twig
Created
February 11, 2019 03:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% | |
set classes = [ | |
'block', | |
'block-' ~ configuration.provider|clean_class, | |
'block-' ~ plugin_id|clean_class, | |
] | |
%} | |
{% set attributes = attributes.addClass(classes) %} | |
{% embed '@sixflags_theme/main-menu/main-menu.twig' with { | |
attributes: attributes, |
mariohernandez
/ main-menu.twig
Last active
January 13, 2021 18:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ attach_library('your-namespace-here/navigation') }} | |
{% import _self as menus %} | |
{{ menus.menu_links(items, attributes, 0) }} | |
{% macro menu_links(items, attributes, menu_level) %} | |
{% import _self as menus %} | |
{% if items %} | |
{% if menu_level == 0 %} |
mariohernandez
/ menu.html.twig
Created
February 11, 2019 02:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% import _self as menus %} | |
{{ menus.menu_links(items, attributes, 0) }} | |
{% macro menu_links(items, attributes, menu_level) %} | |
{% import _self as menus %} | |
{% if items %} | |
{% if menu_level == 0 %} | |
<ul{{ attributes }}> | |
{% else %} |
mariohernandez
/ twig-debug-mode-output.html
Created
February 11, 2019 02:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- THEME DEBUG --> | |
<!-- THEME HOOK: 'menu__main' --> | |
<!-- FILE NAME SUGGESTIONS: | |
* menu--main.html.twig | |
x menu.html.twig | |
--> | |
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/navigation/menu.html.twig' --> |