Skip to content

Commit 889f21b

Browse files
committed
Update to relevant technologies
1 parent afc78f2 commit 889f21b

20 files changed

+20874
-39152
lines changed

Diff for: .eslintignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
node_modules
2-
solutions.ts
1+
node_modules/*
2+
static/*
3+
dist/*

Diff for: .eslintrc.json

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,58 @@
11
{
22
"env": {
33
"browser": true,
4-
"es2021": true
4+
"es2021": true,
5+
"node": true,
6+
"jest": true
57
},
68
"extends": [
79
"eslint:recommended",
810
"plugin:react/recommended",
9-
"plugin:@typescript-eslint/recommended"
11+
"plugin:@typescript-eslint/recommended",
12+
"prettier"
1013
],
1114
"parser": "@typescript-eslint/parser",
1215
"parserOptions": {
1316
"ecmaFeatures": {
1417
"jsx": true
1518
},
16-
"ecmaVersion": "latest",
19+
"ecmaVersion": 12,
1720
"sourceType": "module"
1821
},
1922
"plugins": [
2023
"react",
21-
"@typescript-eslint"
24+
"react-hooks",
25+
"@typescript-eslint",
26+
"prettier"
2227
],
28+
"settings": {
29+
"import/resolver": {
30+
"typescript": {}
31+
},
32+
"react": {
33+
"version": "detect"
34+
}
35+
},
2336
"rules": {
24-
"react/display-name": "off",
25-
"indent": [
37+
"react/jsx-curly-brace-presence": [
2638
"error",
27-
2
39+
{
40+
"props": "never",
41+
"children": "never"
42+
}
2843
],
29-
"linebreak-style": [
44+
"arrow-body-style": [
3045
"error",
31-
"unix"
46+
"as-needed"
3247
],
48+
"react/react-in-jsx-scope": "off",
49+
"camelcase": "off",
50+
"spaced-comment": "error",
3351
"quotes": [
34-
"error",
35-
"double"
52+
"warn",
53+
"single"
3654
],
37-
"semi": [
38-
"error",
39-
"always"
40-
],
41-
"react/jsx-uses-react": "off",
42-
"react/react-in-jsx-scope": "off",
43-
"prefer-arrow-callback": "error",
44-
"arrow-body-style": "error"
45-
},
46-
"settings": {
47-
"react": {
48-
"version": "detect"
49-
}
55+
"no-duplicate-imports": "error",
56+
"react/display-name": "off"
5057
}
5158
}

Diff for: .prettierrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"tabWidth": 2,
4+
"printWidth": 100,
5+
"singleQuote": true,
6+
"trailingComma": "all",
7+
"jsxSingleQuote": true,
8+
"bracketSpacing": true
9+
}

Diff for: .vscode/extensions.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"recommendations": [
3-
"ijs.emotionsnippets",
43
"dbaeumer.vscode-eslint",
54
"ms-vscode.vscode-typescript-next",
65
"esbenp.prettier-vscode",

Diff for: README.md

+13-14
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
- [Typescript basic types](https://www.typescriptlang.org/docs/handbook/basic-types.html)
55
- [Typescript interfaces vs types (more similar than you think)](https://stackoverflow.com/a/52682220)
66
- [TypeScript Generics](https://www.freecodecamp.org/news/make-typescript-easy-using-basic-ts-generics/)
7-
- [Introduction Documentation to emotion](https://emotion.sh/docs/introduction)
7+
- [Introduction Documentation to react-jss](https://cssinjs.org/react-jss#basic)
88
- [React Query overview by the creator](https://www.youtube.com/watch?v=seU46c6Jz7E)
99
- [React Query and Typescript](https://tkdodo.eu/blog/react-query-and-type-script)
10+
- [Example of using js ternary operators (these are everywhere in our app, get familiar)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator)
11+
- Examples of js object destructuring: [destructure](https://wesbos.com/destructuring-objects), [rename](https://wesbos.com/destructuring-renaming), [default values](https://wesbos.com/destructuring-default-values)
12+
- [Example of js array destructuring (this can be seen often with component props)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)
1013

1114
## Supplemental Reading
1215

@@ -19,26 +22,22 @@
1922
- `npm install`
2023
- `npm start`
2124

22-
- DO spend some time reading the above documentation, the required information to complete the tasks below are contained within.
23-
24-
A note on this repos' setup:
25-
26-
> I am not yet 100% convinced of the chosen libraries for this demo (emotion and react-query); thus, it is my hope to get your honest feedback from using them.
25+
- <b>DO</b> spend some time reading the above documentation, the required information to complete the tasks below are contained within.
2726

2827
## Tasks
2928

30-
1. Fix the <i>color</i> variable within the Customer interface found [here](/src/api/CustomerApi.ts#L7) by creating a "Color" type, that only allows the 4 choosable colors. You will have to follow the type around to fix associated components found: [here](src/pages/Landing/index.tsx#L87) and [here](src/components/ColoredTd.tsx#L5)
29+
1. Fix the <i>color</i> variable within the Customer interface found [here](/src/api/CustomerApi.ts#L7) by creating a "Color" type, that only allows the 4 choosable colors. You will have to follow the type around to fix associated components found: [here](src/pages/Landing/index.tsx#L98) and [here](src/components/ColoredTd.tsx#L4)
3130

32-
2. Using Typescript generics (inherited types), fix the "any" types found within the "callApi" function found [here](src/api/apiUtilities.ts#L5). Our goal is to always see the outputted types from our [Super real API calls](src/api/CustomerApi.ts#L32)
31+
2. Using `"react-jss"` and `"createUseStyles"` create a new `SnazzyButton` component (reference [ColoredTd](src/components/ColoredTd.tsx)), this new component will use the Patternfly Button component as a base and have a single additional prop called `isSnazzy`. When the button `isSnazzy`, apply the css string literal styling found [here](src/components/helpers.ts#L1). Replace the Submit Button component found [here](src/pages/Landing/index.tsx#L120), ensuring the new `SnazzyButton` has it's isSnazzy prop applied.
3332

34-
3. Using `"@emotion/styled"` create a new `MagicalButton` component (reference [ColoredTd](src/components/ColoredTd.tsx)), this new component will have a single additional prop called `isMagical`. When the button `isMagical`, apply the css string literal styling found [here](src/components/helpers.ts#L1). Replace the Submit Button component found [here](src/pages/Landing/index.tsx#L105), ensuring the new isMagical prop is applied.
33+
3. Using React Query and our [Super real API calls](src/api/CustomerApi.ts#L38), complete the functionality of the [Add New Customer Modal](src/pages/Landing/index.tsx#L65), if you're feeling confident, impliment the "optimistic update" functionality mentioned in the [React Query overview by the creator](https://www.youtube.com/watch?v=seU46c6Jz7E).
3534

36-
## Stretch
35+
4. Make the [Add New Customer Modal](src/pages/Landing/index.tsx#L65) it's own component, importing it into the main [table page](src/pages/Landing/index.tsx).
3736

38-
- Using React Query and our [Super real API calls](src/api/CustomerApi.ts#L38), finish the functionality of the [Add New Customer Modal](src/pages/Landing/index.tsx#L65)
37+
5. Using React Query and our [Super real API calls](src/api/CustomerApi.ts#L38), add a menu kebab to each item in the table with the "Delete" action. Use [this design](https://www.patternfly.org/v4/components/table#composable-actions) as a reference to help you.
3938

40-
- For an added stretch create a delete button for each item in the table.
39+
6. Using the existing darkmode context variable and [useAppContext hook](src/context/index.tsx#L21), fix the nightmode issues found within the table and the modal, feel free to use a `ternary operator` where needed.
4140

42-
- Using the `Global Styles` from emotion and [useAppContext hook](src/context/index.tsx#L21), fix the nightmode issues found across the app.
41+
7. Add a second parameter to the `callApi` function within the [GetCustomers api call](src/api/CustomerApi.ts#L33) so that it reads: `callAPI(customersGetter, 0.7)`. This will create intermittent errors on that endpoint. Handle those errors with the options parameter of useQuery found [here](src/pages/Landing/index.tsx#L41).
4342

44-
- Add a second parameter to the `callApi` function within the [GetCustomers api call](src/api/CustomerApi.ts#L33) so that it reads: `callAPI(customersGetter, 0.7)`. This will create intermittent errors on that endpoint. Handle those errors with the options parameter of useQuery found [here](src/pages/Landing/index.tsx#L41).
43+
8. (HARD) Using Typescript generics (inherited types), fix the "any" types found within the "callApi" function found [here](src/api/apiUtilities.ts#L4). Our goal is to always see the outputted types from our [Super real API calls](src/api/CustomerApi.ts#L32)

0 commit comments

Comments
 (0)