Skip to content

Instantly share code, notes, and snippets.

View davidpett's full-sized avatar
👨‍🏫
full-time contract at Marriott

David Pett davidpett

👨‍🏫
full-time contract at Marriott
View GitHub Profile
import * as React from 'react';
import { forwardRef } from 'react';
export interface IButton extends React.ButtonHTMLAttributes<HTMLButtonElement> {
size?: 'small' | 'medium' | 'large';
}
const ButtonBase = forwardRef<HTMLButtonElement, IButton>(
({ className, size = 'medium', type = 'button', ...rest }, forwardedRef) => {
const isBase = !Boolean(className);
@davidpett
davidpett / machine.js
Created February 4, 2020 16:08
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@davidpett
davidpett / machine.js
Last active October 30, 2019 18:11
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@davidpett
davidpett / machine.js
Last active October 28, 2019 19:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import { View } from 'react-primitives'
import React, { Component } from 'react'
import Children from 'react-children-utilities'
import { DragItem, DropArea } from '../drag-drop'
export default class DragDrop extends Component {
render() {
const { activeDropArea, items, isDragging, position } = this.state
const children = Children.deepMap(this.props.children, (child, index) => {
if (child.type === DragItem) {
@davidpett
davidpett / controllers.application.js
Last active August 30, 2017 22:09
component helper
import Ember from 'ember';
export default Ember.Controller.extend({
items: ['x-foo', 'x-bar', 'x-baz']
});
import Module from './module';
export default Module.extend({
});
@davidpett
davidpett / _angle.scss
Created March 16, 2017 20:36
a way to do angles in pseudo selectors
@mixin angle($pseudo, $flip: false, $angle: 2deg) {
// Possible values for $pseudo are: before, after, both
@if $pseudo == 'before' or $pseudo == 'after' or $pseudo == 'both' {
position: relative;
z-index: 1;
$selector: if($pseudo == 'both', '&:before,&:after', '&:#{$pseudo}');
#{$selector} {
background: inherit;
content: '';
@davidpett
davidpett / app.css
Created January 21, 2017 21:22
using tachyons in ember.js
@import './tachyons/tachyons'; // tachyons source
@import './_custom'; // any custom css
@import './_vars'; // put last because that is how CSS vars work...
/*
in _vars.css you can override tachyons vars
:root {
--navy: #001624;
@davidpett
davidpett / controllers.application.js
Created January 19, 2017 15:18
Swiper Custom Next/Previous Buttons
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});