Skip to content

Instantly share code, notes, and snippets.

@mqklin
Last active August 21, 2018 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mqklin/42f363cf81cb0e30b8a9239ef5cab838 to your computer and use it in GitHub Desktop.
Save mqklin/42f363cf81cb0e30b8a9239ef5cab838 to your computer and use it in GitHub Desktop.
'.source.js':
'sdiv':
'prefix': 'sdiv'
'body': """
const $1 = styled.div`
$0
`;
"""
'imp':
'prefix': 'imp'
'body': 'import $1 from \'$0\';'
'imppt':
'prefix': 'imppt'
'body': 'import {$1} from \'prop-types\';$0'
'import {onlyUpdateForKeys} from \'recompose\';':
'prefix': 'imprec'
'body': 'import {onlyUpdateForKeys} from \'recompose\';$0'
'spt':
'prefix': 'spt'
'body': """
static propTypes = forbidExtraProps({$1});$0
"""
'impforb':
'prefix': 'impforb'
'body': 'import {forbidExtraProps} from \'airbnb-prop-types\';'
'tps':
'prefix': 'tps'
'body': 'const {$0} = this.props;'
'React div w/ styleName':
'prefix': 'div'
'body': '<div styleName="$1">$0</div>'
'React span w/ className':
'prefix': 'span'
'body': '<span>$0</span>'
'React component constructor':
'prefix': 'con'
'body': """
constructor(props) {
super(props);
this.state = {$1};$0
}
"""
'gets':
'prefix': 'gets'
'body': '`${getSize({max: $1, min: $2})}px`$0'
'React this.setState({})':
'prefix': 'tse'
'body': 'this.setState(() => ({$1}));$0'
'React const {} = this':
'prefix': 'cp'
'body': 'const { ${1:props, }${2:state} } = this;$0'
'React const {} = this.state':
'prefix': 'cse'
'body': 'const {$1} = this.state;$0'
'React const {} = this.props':
'prefix': 'cps'
'body': 'const {$1} = this.props;$0'
'comp':
'prefix': 'comp'
'body': """
import React from 'react';
import styled from 'styled-components';
import {forbidExtraProps} from 'airbnb-prop-types';
const Wr = styled.div`
`;
export default class $1 extends Component {
static propTypes = forbidExtraProps({$2});
render() {
return (
<Wr>
$0
</Wr>
);
}
}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment