Skip to content

Commit 62319bb

Browse files
committed
feat: add more snippets, updated names, update GitPod
1 parent f17f08f commit 62319bb

File tree

6 files changed

+87
-51
lines changed

6 files changed

+87
-51
lines changed

.gitpod.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# This configuration file was automatically generated by Gitpod.
2-
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3-
# and commit this file to your remote git repository to share the goodness with others.
4-
51
tasks:
62
- init: yarn install
73

4+
github:
5+
prebuilds:
6+
master: true
7+
branches: true
8+
pullRequests: true
9+
pullRequestsFromForks: true
10+
addCheck: true
11+
addComment: false
12+
addBadge: true

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,93 +18,93 @@ NextJS and React Snippets with TypeScript support as well!🚀
1818

1919
```jsx
2020
const Component = () => {
21-
return <div></div>
22-
}
23-
export default Component
21+
return <div></div>;
22+
};
23+
export default Component;
2424
```
2525

2626
### TypeScript
2727

2828
2. `rafect` (React Functional Component with Types)
2929

3030
```tsx
31-
import { FC } from 'react'
31+
import { FC } from "react";
3232
interface Props {}
3333
const Component: FC<Props> = () => {
34-
return <div></div>
35-
}
36-
export default Component
34+
return <div></div>;
35+
};
36+
export default Component;
3737
```
3838

3939
## NextJS
4040

4141
### JavaScript
4242

43-
1. `nextssr` (Get Server Side Props Next.js)
43+
1. `nssr` (Get Server Side Props Next.js)
4444

4545
```jsx
4646
export const getServerSideProps = async (context) => {
4747
return {
4848
props: {},
49-
}
50-
}
49+
};
50+
};
5151
```
5252

53-
2. `nextssg` (Get Static Props Next.js)
53+
2. `nssg` (Get Static Props Next.js)
5454

5555
```jsx
5656
export const getStaticProps = async (context) => {
5757
return {
5858
props: {},
59-
}
60-
}
59+
};
60+
};
6161
```
6262

6363
### TypeScript
6464

65-
1. `nextssrt` (Get Server Side Props Next.js)
65+
1. `nssrt` (Get Server Side Props Next.js)
6666

6767
```tsx
6868
export const getServerSideProps: GetServerSideProps = async (context) => {
69-
return { props: {} }
70-
}
69+
return { props: {} };
70+
};
7171
```
7272

73-
2. `nextssgt` (Get Static Props Next.js)
73+
2. `nssgt` (Get Static Props Next.js)
7474

7575
```tsx
7676
export const getStaticProps: getStaticProps = async (context) => {
77-
return { props: {} }
78-
}
77+
return { props: {} };
78+
};
7979
```
8080

81-
3. `nextgip` (Get Initial Props in Next.js)
81+
3. `ngip` (Get Initial Props in Next.js)
8282

8383
```tsx
8484
Page.getInitialProps = async (context) => {
85-
return { props: {} }
86-
}
85+
return { props: {} };
86+
};
8787
```
8888

89-
3) `taytay` (NextPage component with NextPage type)
89+
3) `npaget` (NextPage component with NextPage type)
9090

9191
```tsx
92-
import type { NextPage } from 'next'
92+
import type { NextPage } from "next";
9393
const Page: NextPage = () => {
94-
return <></>
95-
}
96-
export default Page
94+
return <></>;
95+
};
96+
export default Page;
9797
```
9898

99-
4) `nextct` (Next JS Component with NextComponentType and Props)
99+
4) `nct` (Next JS Component with NextComponentType and Props)
100100

101101
```tsx
102-
import type { NextComponentType, NextPageContext } from 'next'
102+
import type { NextComponentType, NextPageContext } from "next";
103103
interface Props {}
104104
const Component: NextComponentType<NextPageContext, {}, Props> = (
105-
props: Props,
105+
props: Props
106106
) => {
107-
return <div></div>
108-
}
109-
export default Component
107+
return <div></div>;
108+
};
109+
export default Component;
110110
```

snippets/next-javascript.code-snippets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"ssr": {
3-
"prefix": "nextssr",
3+
"prefix": "nssr",
44
"body": [
55
"export const getServerSideProps = async context => {",
66
" return {",
@@ -12,7 +12,7 @@
1212
"description": "Get Server Side Props Next.js"
1313
},
1414
"ssg": {
15-
"prefix": "nextssg",
15+
"prefix": "nssg",
1616
"body": [
1717
"export const getStaticProps = async context => {",
1818
" return {",
@@ -23,4 +23,4 @@
2323
],
2424
"description": "Get Static Props Next.js"
2525
}
26-
}
26+
}

snippets/next-typescript.code-snippets

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"ssrt": {
3-
"prefix": "nextssrt",
2+
"nssrt": {
3+
"prefix": "nssrt",
44
"body": [
55
"export const getServerSideProps: GetServerSideProps = async context => {",
66
" return {",
@@ -11,8 +11,8 @@
1111
],
1212
"description": "Get Server Side Props Next.js"
1313
},
14-
"ssgt": {
15-
"prefix": "nextssgt",
14+
"nssgt": {
15+
"prefix": "nssgt",
1616
"body": [
1717
"export const getStaticProps: getStaticProps = async context => {",
1818
" return {",
@@ -23,8 +23,8 @@
2323
],
2424
"description": "Get Static Props Next.js"
2525
},
26-
"taytay": {
27-
"prefix": "taytay",
26+
"npaget": {
27+
"prefix": "npaget",
2828
"body": [
2929
"import type { NextPage } from \"next\";",
3030
"",
@@ -39,8 +39,8 @@
3939
],
4040
"description": "NextPage component with NextPage type"
4141
},
42-
"nextgip": {
43-
"prefix": "nextgip",
42+
"ngip": {
43+
"prefix": "ngip",
4444
"body": [
4545
"${1:${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}}.getInitialProps = async context => {",
4646
" return {",
@@ -52,7 +52,7 @@
5252
"description": "Get Initial Props in Next.js"
5353
},
5454
"nct": {
55-
"prefix": "nextct",
55+
"prefix": "nct",
5656
"body": [
5757
"import type { NextComponentType, NextPageContext } from \"next\";",
5858
"interface Props {}",

snippets/react-javascript.code-snippets

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
{
2+
"rfce": {
3+
"prefix": "rfce",
4+
"body": [
5+
"import React from 'react'",
6+
"",
7+
"function ${1:${TM_FILENAME_BASE}}() {",
8+
" return (",
9+
" <div></div>",
10+
" )",
11+
"}",
12+
"",
13+
"export default ${1:${TM_FILENAME_BASE}}"
14+
],
15+
"description": ""
16+
},
217
"rafce": {
318
"prefix": "rafce",
419
"body": [
@@ -11,4 +26,4 @@
1126
],
1227
"description": "React Functional Component"
1328
}
14-
}
29+
}

snippets/react-typescript.code-snippets

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
{
2+
"rfcet": {
3+
"prefix": "rfcet",
4+
"body": [
5+
"import React from \"react\";",
6+
"",
7+
"interface Props {}",
8+
"",
9+
"function ${1:${TM_FILENAME_BASE}}({}: Props) {",
10+
" return <div></div>;",
11+
"}",
12+
"",
13+
"export default ${1:${TM_FILENAME_BASE}};",
14+
""
15+
],
16+
"description": ""
17+
},
218
"rafcet": {
319
"prefix": "rafcet",
420
"body": [
@@ -13,4 +29,4 @@
1329
],
1430
"description": "React Functional Component with Types"
1531
}
16-
}
32+
}

0 commit comments

Comments
 (0)