Skip to content

Instantly share code, notes, and snippets.

@squarism
Last active November 20, 2022 19:10
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 squarism/ed8524fdf010533033099dd120813469 to your computer and use it in GitHub Desktop.
Save squarism/ed8524fdf010533033099dd120813469 to your computer and use it in GitHub Desktop.
React Snippets
{
// for next, remix and solid index routes that uses the directory name for the component name
"export default function": {
"prefix": "edf",
"body": [
"export default function ${TM_DIRECTORY/^.+\\/(.*)$/${1:/pascalcase}/}() {",
"\treturn(",
"\t\t${0}",
"\t)",
"}"
],
"description": "Export default function component"
},
"mantine component": {
"prefix": "mc",
"body": [
"import { createStyles } from \"@mantine/core\";",
"",
"const useStyles = createStyles(theme => ({",
"\t${2:css}: {",
"\t\t// backgroundColor: theme.colors.gray[2],",
"\t}",
"}));",
"",
"interface ${1}Props {",
"\tname: string;",
"}",
"",
"export const ${1:ComponentName} = ({name}: $1Props) => {",
"\tconst { classes } = useStyles();",
"",
"\treturn (",
"\t\t<div className={classes.${2}}>",
"\t\t\t${0}",
"\t\t</div>",
"\t)",
"}",
],
"description": "Mantine component"
}
}
@squarism
Copy link
Author

JSON comments work fine in vscode

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