Last active
May 30, 2020 05:58
-
-
Save medatech/579b0fb3e53dfa7ef8281fb6831e2ec7 to your computer and use it in GitHub Desktop.
React Component Rich Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to override the defaults | |
[ | |
{ | |
"key": "cmd+alt+s", | |
"command": "editor.action.insertSnippet", | |
"args": { | |
"name": "Styled Component" | |
} | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Styled Component": { | |
"scope": "javascript", | |
"prefix": [ | |
"styled", | |
"styled-component" | |
], | |
"body": [ | |
"import React from \"react\"", | |
"import PropTypes from \"prop-types\"", | |
"import styled, { css } from \"styled-components\"", | |
"", | |
"${1:name}.propTypes = {", | |
"\tclassName: PropTypes.string.isRequired,", | |
"}", | |
"", | |
"function ${1:name}({ className }) {", | |
"\treturn <div className={className} />", | |
"}", | |
"", | |
"export default styled(${1:name})`", | |
"\t${props => css``}", | |
"`" | |
], | |
"description": "Creates a quick styled component" | |
}, | |
"Export Default": { | |
"scope": "javascript", | |
"prefix": [ | |
"export" | |
], | |
"body": [ | |
"export { default } from \"./${1:name}\"" | |
], | |
"description": "Create a simple default export" | |
}, | |
"xlog": { | |
"scope": "javascript", | |
"prefix": "xlog", | |
"body": [ | |
"console.log(\"${1:var}\", JSON.parse(JSON.stringify(${1:var})))" | |
], | |
"description": "logs json stuff through proxy" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @medatech. Here's my one I adapted from this to Typescript and emotion: