Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paulospiguel/881c0605bdf65adbb78daaa01d8cbd8b to your computer and use it in GitHub Desktop.
Save paulospiguel/881c0605bdf65adbb78daaa01d8cbd8b to your computer and use it in GitHub Desktop.
React Component Snippet (dirName)
{
"New React Component": {
"scope": "typescriptreact",
"prefix": "rfc-ui-dir",
"body": [
"import React, { ComponentProps } from 'react';",
"",
"import { cn } from \"ui-kit\";",
"",
"interface ${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}Props extends ComponentProps<\"$1\"> {}",
"",
"const ${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}: React.FC<${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}Props> = ({ className, ...props }) => {",
" return (",
" <$1 className={cn(\"\", className)} {...props}>",
" $0",
" </$1>",
" );",
"};",
"",
"export default ${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/};"
],
"description": "Creates a new React component with a specified folder name"
}
}
@paulospiguel
Copy link
Author

my component snippet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment