Skip to content

Instantly share code, notes, and snippets.

View raffaele-abramini's full-sized avatar
⛰️

Raffaele Abramini raffaele-abramini

⛰️
View GitHub Profile
@raffaele-abramini
raffaele-abramini / mainNav.js
Last active October 16, 2017 14:19
testing example #2 - main
export default class MainNav {
static selectors = {
main: '[data-js-main-nav]',
trigger: '[data-main-nav-trigger]',
content: '[data-main-nav-content]'
};
static classes = {
isHidden: 'is-hidden',
};
@raffaele-abramini
raffaele-abramini / mainNav.spec.js
Last active October 16, 2017 14:20
testing example #2 - spec
import MainNav from './mainNav';
describe('With HTML elements missing', ()=> {
test('It\'s initialised without errors', ()=>{
// When the DOM doesn't contain the main element, we want this component to stop the construction
// to avoid errors.
document.body.innerHTML = '';
new MainNav();
});
@raffaele-abramini
raffaele-abramini / angular4.eventEmitter.1.ts
Last active November 18, 2017 09:11
Angular 4 - Event emitter - 1
// Import EventEmitter and Output
import {Component, EventEmitter, Output} from '@angular/core';
@Component({
selector: 'app-my-component',
templateUrl: './my-component.component.html',
})
export class MyComponent {
// Define the new output as an EventEmitter.
// We are also defining some data to be pass to the event listeners (someData)
@raffaele-abramini
raffaele-abramini / angular4.eventEmitter.2.html
Created November 18, 2017 09:13
Angular 4 - Event emitter - 2
<div>
<app-my-component
(myEvent)="myParentMethod($event)">
</app-my-component>
</div>
@raffaele-abramini
raffaele-abramini / angular4.domElementRef.1.html
Created November 18, 2017 09:34
Angular 4 - DOM element ref - 1
<div>
<input
name="myInput"
id="myInput"
#myInput>
<button
type="button"
(onClick)="doSomething(myInput)">
Label
</button>
@raffaele-abramini
raffaele-abramini / angular4.domElementRef.2.ts
Created November 18, 2017 09:36
Angular 4 - DOM element ref - 2
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-my-component',
templateUrl: './my-component.component.html',
styleUrls: ['./my-component.component.css']
})
export class MyComponentComponent implements OnInit {
constructor() { }
@raffaele-abramini
raffaele-abramini / angular4.domElementRef.3.ts
Created November 18, 2017 09:46
Angular 4 - DOM element ref - 3
// Import ElementRef and ViewChild
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
@Component({
selector: 'app-my-component',
templateUrl: './my-component.component.html',
styleUrls: ['./my-component.component.css']
})
export class MyComponentComponent implements OnInit {
// Get the DOM element using the ref name from the template and define
@raffaele-abramini
raffaele-abramini / MultipleCheckboxGroupsFilter.jsx
Last active March 23, 2020 15:08
Add a Multiple Checkbox Groups filter
import * as React from 'react'
import * as Flex from '@twilio/flex-ui'
const Title = Flex.styled('h2')`
color: ${p => p.theme.calculated.textColor};
padding: ${p => p.first ? '0' : '12px'} 16px 8px;
font-weight: bold;
`
const MultipleCheckboxGroups = ({ handleChange, currentValue, fieldName, options }) => {
@raffaele-abramini
raffaele-abramini / raffa-bluet.xml
Created November 11, 2019 16:05
Webstorm custom MUI theme
<mtTheme>
<id>raffa-bluet</id>
<editorColorsScheme>Raffa bluet</editorColorsScheme>
<dark>true</dark>
<name>Raffa bluet</name>
<colors>
<color id="background" value="13232aff"/>
<color id="foreground" value="b0bec5ff"/>
<color id="text" value="607d8bff"/>
<color id="highlight" value="425b67ff"/>
Coverage