Skip to content

Instantly share code, notes, and snippets.

View interactivellama's full-sized avatar

Stephen James interactivellama

View GitHub Profile
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { storiesOf, action } from '@storybook/react';
import { normalize, schema } from 'normalizr';
import IconSettings from '../../icon-settings';
import { TREE } from '../../../utilities/constants';
import sampleNodes from '../../../utilities/sample-data/tree';
const options = {
'show-me': [
{ id: 1, label: 'All Products', value: 'all-products' },
{ id: 2, label: 'All Wackamoles', value: 'all-Wackamoles' },
{ id: 3, label: 'All Products', value: 'all-products' },
{ id: 4, label: 'All Wackamoles', value: 'all-Wackamoles' },
{ id: 5, label: 'All Products', value: 'all-products' },
{ id: 6, label: 'All Wackamoles', value: 'all-Wackamoles' },
{ id: 7, label: 'All Products', value: 'all-products' },
{ id: 8, label: 'All Wackamoles', value: 'all-Wackamoles' },
@interactivellama
interactivellama / pill.jsx
Last active May 14, 2017 04:52
Design System React Pill
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
import React from 'react';
import PropTypes from 'prop-types';
import UtilityIcon from '~/components/utilities/utility-icon';
import assign from 'lodash.assign';
@interactivellama
interactivellama / react-best-practices.md
Last active July 13, 2023 07:39
Concepts and Best Practices: What we've learned about building React components for the enterprise

Concepts and Best Practices

What we've learned about building React components for the enterprise

Think of others first

  • # Consider your audience. This project is not Bootstrap, and my team has built frameworks on top of Bootstrap. The primary audience for this project is software engineers yearning to easily implement the design artifact handed to them. Yes, contributors should over-document and explain much as you need to, but you do not need to have components just work when you drop them on the page. Read on for more about limiting internal component state.

  • # Put yourself in the consuming developer mindset. "I just updated. What just broke and why?" Why does the React child component become the the DOM parent node? Write as long of a prop description comment that is needed to understand the concept. Need to sunse

import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import { FORMS_CHECKBOX } from '../../../utilities/constants';
import Checkbox from '../../../components/forms/checkbox';
import Button from '../../../components/button';
const CheckboxIndeterminate = React.createClass({
getInitialState () {
return {
@interactivellama
interactivellama / development-placeholder.js
Created April 22, 2016 02:01
React component placeholder
// DO NOT USE THIS COMPONENT IN PRODUCTION
import React from 'react';
// Removes the need for `PropTypes`.
const { PropTypes } = React;
// The component name will be used as the `DisplayName` and exported along with
// the component itself.
export const COMPONENT = 'ComponentPlaceholder';
/*
* Fuel UX Utilities Repeater Static DataSource
* https://github.com/ExactTarget/fuelux-utilities
*
* Copyright (c) 2014 ExactTarget
* Licensed under the BSD New license.
*/
// -- BEGIN UMD WRAPPER PREFACE --
@interactivellama
interactivellama / heroku-pre-build-ssh-key-gen.sh
Created April 14, 2016 20:06
Allows authentication for viewing private repos
if [ "$GIT_SSH_KEY" != "" ]; then
echo "Detected SSH key for git. Launching ssh-agent and loading key"
echo $GIT_SSH_KEY | base64 --decode > id_rsa
# launch ssh-agent, we'll use it to serve our ssh key
# and kill it towards the end of the buildpack's run
eval `ssh-agent -s`
# We're not supporting passphrases at this time. We could pull that in
# from config as well, but then we'd have to setup expect or some other
# terminal automation tool to feed it into ssh-add.
ssh-add id_rsa
// originally from http://fuelux-pages.herokuapp.com/overview/overview/?&panels=1#
function configureColumnsDropdown(disabled) {
// DOM view is not rendered until loaded is triggered
var view = $('.repeater').attr('data-currentview');
var columns = views[view].columns;
var $itemsHeader = $('.repeater-header');
var viewClass;
var activeSortBy = 'name';
@interactivellama
interactivellama / node-util.sublime-snippet
Last active March 16, 2016 18:15 — forked from chriscorwin/node-util.sublime-snippet
Snippet for NodeJS's util library that inspects all levels of a variable
<snippet>
<!-- Snippet for https://nodejs.org/api/util.html -->
<!-- Put this file in `Sublime Text 3/packages/User/ then restart. -->
<!-- Don't forget to import `const util = require('util');` -->
<content><![CDATA[
console.log(`[ $TM_FILEPATH:$TM_LINE_NUMBER ] ${1:$SELECTION}: `, util.inspect(${2:$SELECTION}, { showHidden: true, depth: null, colors: true }));$0
]]></content>
<tabTrigger>util</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log(util.inspect())</description>