You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hooks/07_ColorPicker/Readme.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,13 @@
1
1
# 07 Colopicker
2
2
3
-
In this sample we are going to implement a color picker component, it will allow us to choose
4
-
between red / green / blue components and displaty the resulting color.
3
+
In this sample we are going to implement a color picker component, it will allow us to choose between red / green / blue components and display the resulting color.
5
4
6
-
We will start with a non optimal implementation and we will refactor it in sample 09.
5
+
We will start with a non optimal implementation and we will refactor it in sample 08.
7
6
8
7
# Steps
9
8
10
9
- We will take as starting point sample _06 Enable_, copy the content from that project and
11
-
exectue_npm install_
10
+
execute_npm install_
12
11
13
12
```bash
14
13
npm install
@@ -18,7 +17,7 @@ npm install
18
17
19
18
- We will create a components folder under _src_ (_src/components_).
20
19
21
-
- Inside that components folder we will copy all the components that we have created (_nameEdit_
20
+
- Inside that components folder we will copy all the components that we have created (_nameEdit.tsx_
22
21
and _hello.tsx_).
23
22
24
23
- We will create an _index_ file under _src/components_ and create a barrel (by doing this, later
@@ -47,7 +46,7 @@ export interface Color {
47
46
48
47
- Let's start by creating a _ColorBrowser_ component: this color will just display the
49
48
selected color (under the hood is just a div, by applying css styling we provide a width
50
-
and height to that rectanble, and a background color).
49
+
and height to that rectangle, and a background color).
51
50
52
51
_./src/components/colorBrowser.tsx_
53
52
@@ -128,7 +127,7 @@ _./src/app.tsx_
128
127
npm start
129
128
```
130
129
131
-
- We want add color picker editing capabilities, let's create a color picker component
130
+
- We want to add color picker editing capabilities, let's create a color picker component
132
131
and add a single slider for one of the color values.
Copy file name to clipboardExpand all lines: hooks/08_ColorPickerRefactor/Readme.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
# 08 Colorpicker Refactor
2
2
3
-
In this example we are going to review the colorpicker component we have created and simplify it. Right now we have three slider controls with many details that make our HTML hard to read. Let's componentize this scenario.
3
+
In this example we are going to review the colorPicker component we have created and simplify it. Right now we have three slider controls with many details that make our HTML hard to read. Let's componentize this scenario.
4
4
5
-
We take _07 Colorpicker_ as reference.
5
+
We take _07 ColorPicker_ as reference.
6
6
7
7
# Steps to reproduce this sample
8
8
9
-
- Copy the content from _07 Colorpicker_ and execute _npm install_.
9
+
- Copy the content from _07 ColorPicker_ and execute _npm install_.
10
10
11
11
```bash
12
12
npm install
@@ -37,9 +37,9 @@ _DO NOT COPY THIS_
37
37
38
38
- We will start our refactor by componentizing this piece of code,
39
39
let's append to the _colorPicker.tsx_ the following component
40
-
(another approach could be to create a new file, that's a tetchty decisition,
40
+
(another approach could be to create a new file, that's a tetchy decision,
41
41
on one hand it makes sense to keep in the same file the slider since is quite
42
-
related to the picker, on the other segregating in diferent files is another
42
+
related to the picker, on the other segregating in different files is another
0 commit comments