Skip to content

Instantly share code, notes, and snippets.

@tkh44
tkh44 / index.js
Created August 25, 2017 19:25
Getting react-leaflet working with SSR (next.js)
import React from 'react'
export default class extends React.Component {
constructor () {
super()
this.state = { components: undefined }
this.markers = new WeakMap()
}
componentDidMount () {
import React from 'react';
import { findDOMNode } from 'react-dom';
import PropTypes from 'prop-types';
import listen from 'simple-listen';
import { getTop } from 'fbjs/lib/Scroll';
export default class SidebarAdManager extends React.Component {
constructor (props) {
super(props);
this.state = { stickyAd: {} };
@tkh44
tkh44 / place.js
Created August 22, 2017 22:10
animating a modal with data-driven-motion
import React from 'react'
import styled from 'emotion/react'
import { Motion } from 'data-driven-motion'
import theme from '../../lib/theme'
import Place from '../place'
const Backdrop = styled.div`
position: fixed;
left: 0;
import '../lib/hydrate'
import React from 'react'
import Box from '../components/box'
import Input from '../components/input'
import Card from '../components/card'
import LeafletMap from '../components/map'
import theme from '../lib/theme'
import images from '../lib/images'
import data from '../boulder.json'
@tkh44
tkh44 / base.js
Last active August 16, 2022 16:28
emotion with styled-system.
import React from 'react'
import styled from 'emotion/react'
import { omit } from 'emotion/lib/utils'
import { space, width, fontSize, color, responsiveStyle } from 'styled-system'
import { baseCss } from './ui'
const defaultExcludedProps = [
'm',
'mt',
@tkh44
tkh44 / results.md
Created June 15, 2017 15:17
css-in-js benchmark results 6/15/17
@tkh44
tkh44 / babel.js
Created June 11, 2017 21:56
how emotion works with glam
// original code
styled.h1`color:${myColor};`
// Step 1
// emotion creates a function call from
// the tagged template literal
styled('h1', css`color:${myColor};`)
// Step 2
// glam converts the tagged template literal to a
@tkh44
tkh44 / babel.js
Created June 11, 2017 21:53
steps emotion takes to work
// original code
styled.h1`color:${myColor};`
// Step 1
// emotion creates a function call from
// tagged template expression
styled('h1', css`color:${myColor};`)
// Step 2
// glam converts the tagged template expression to a
### Keybase proof
I hereby claim:
* I am tkh44 on github.
* I am tkh44 (https://keybase.io/tkh44) on keybase.
* I have a public key ASA_ma7oCXf48V7fiCcoL9YDUaJd5k_Ivzw1tpu9ERkeiAo
To claim this, I am signing this object:
// eslint-disable-next-line no-unused-vars
import React from 'react'
import { render } from 'react-dom'
import crate from '../../src'
const pp = obj => JSON.stringify(obj, null, 2)
function Stateless (props) {
return (