Skip to content

Instantly share code, notes, and snippets.

View mariohernandez's full-sized avatar
✌️

Mario Hernandez mariohernandez

✌️
View GitHub Profile
@mariohernandez
mariohernandez / .gitkeep
Last active March 24, 2024 19:55
Storybook demo files
We couldn’t find that file to show.
@mariohernandez
mariohernandez / story
Created March 21, 2024 17:43
Storybook Story Scafolding
import parse from 'html-react-parser';
// Imports decorators for background colors.
import { SantaBarbaraSandBg, VeniceCanalBg } from '../../../../.storybook/decorators';
import callout from './callout.twig';
import data from './callout.yml';
const settings = {
title: 'Components/Callout',
@mariohernandez
mariohernandez / attributes
Created March 21, 2024 17:11
Component wrapper with modifier and attributes
<article class="card{{ modifier ? ' ' ~ modifier }}{{- attributes ? ' ' ~ attributes.class -}}"
{{- attributes ? attributes|without(class) -}}>
@mariohernandez
mariohernandez / sdc
Created February 19, 2024 21:13
JSON Notation for SDC
# Everything in this file is optional. Still, the file needs to exist. Adding
# metadata here will improve the DX when using components.
# Note: currently in Drupal 10.1, the schema will fail to validate if
# props section is not present. This may change in a future release.
# This is so your IDE knows about the syntax for fixes and autocomplete.
$schema: https://git.drupalcode.org/project/sdc/-/raw/1.x/src/metadata.schema.json
# The human readable name.
.card {
width: 300px;
background: #fff;
transition: box-shadow 0.3s ease-in-out;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
}
/* Add box shadow to entire card on hover */
.card:hover {
box-shadow: 0 1px 35px 0 rgba(0, 0, 0, 0.3);
.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 {
{{ 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 %}
{
"items": [
{
"title": "Home",
"url": "#",
"in_active_trail": false
},
{
"title": "About Us",
"url": "#",
@mariohernandez
mariohernandez / .ddev-docker-compose-patternlab.yaml
Last active June 19, 2020 18:23
patternlab docker-compose*.yaml
# docker-compose.patternlab.com to pass port 3000 inside the container
# to https://<something>.ddev.site:3001
version: '3.6'
services:
web:
ports:
# Expose port 3000 for the patternlab app
- "3001"
environment:
# Override the web container's standard HTTP_EXPOSE and HTTPS_EXPOSE