Created
June 23, 2023 14:52
-
-
Save paulospiguel/881c0605bdf65adbb78daaa01d8cbd8b to your computer and use it in GitHub Desktop.
React Component Snippet (dirName)
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
{ | |
"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" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my component snippet