|
4 | 4 | - [Typescript basic types](https://www.typescriptlang.org/docs/handbook/basic-types.html)
|
5 | 5 | - [Typescript interfaces vs types (more similar than you think)](https://stackoverflow.com/a/52682220)
|
6 | 6 | - [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) |
8 | 8 | - [React Query overview by the creator](https://www.youtube.com/watch?v=seU46c6Jz7E)
|
9 | 9 | - [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) |
10 | 13 |
|
11 | 14 | ## Supplemental Reading
|
12 | 15 |
|
|
19 | 22 | - `npm install`
|
20 | 23 | - `npm start`
|
21 | 24 |
|
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. |
27 | 26 |
|
28 | 27 | ## Tasks
|
29 | 28 |
|
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) |
31 | 30 |
|
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. |
33 | 32 |
|
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). |
35 | 34 |
|
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). |
37 | 36 |
|
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. |
39 | 38 |
|
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. |
41 | 40 |
|
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). |
43 | 42 |
|
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