From 4c7ace70f8298174143e56084b18a0050aea3dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Arreaza?= <112995166+Andres-Arreaza@users.noreply.github.com> Date: Tue, 17 Sep 2024 00:56:49 +0000 Subject: [PATCH 1/2] actualizacion 1-AA --- .learn/resets/01-hello-world/app.jsx | 12 +++++++++++ .learn/resets/01.1-hello-jsx/app.jsx | 12 +++++++++++ .../01.2-rendering-from-objects/app.jsx | 13 ++++++++++++ .learn/resets/01.3-building-a-layout/app.jsx | 20 +++++++++++++++++++ .../01.4-building-html-from-arrays/app.jsx | 9 +++++++++ .learn/resets/02-maping-array-to-li/app.jsx | 13 ++++++++++++ .../02.1-maping-array-objects-to-li/app.jsx | 13 ++++++++++++ exercises/01-hello-world/app.jsx | 10 ++++++---- exercises/01.1-hello-jsx/app.jsx | 6 +++++- exercises/01.2-rendering-from-objects/app.jsx | 6 +++++- exercises/01.3-building-a-layout/app.jsx | 11 +++++++++- .../01.4-building-html-from-arrays/app.jsx | 18 ++++++++++++++++- exercises/02-maping-array-to-li/app.jsx | 2 +- .../02.1-maping-array-objects-to-li/app.jsx | 2 +- 14 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 .learn/resets/01-hello-world/app.jsx create mode 100644 .learn/resets/01.1-hello-jsx/app.jsx create mode 100644 .learn/resets/01.2-rendering-from-objects/app.jsx create mode 100644 .learn/resets/01.3-building-a-layout/app.jsx create mode 100644 .learn/resets/01.4-building-html-from-arrays/app.jsx create mode 100644 .learn/resets/02-maping-array-to-li/app.jsx create mode 100644 .learn/resets/02.1-maping-array-objects-to-li/app.jsx diff --git a/.learn/resets/01-hello-world/app.jsx b/.learn/resets/01-hello-world/app.jsx new file mode 100644 index 00000000..556bb60d --- /dev/null +++ b/.learn/resets/01-hello-world/app.jsx @@ -0,0 +1,12 @@ +import React from "react"; // Main React.js library + +import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM + +// WHAT: This variable contains the html to render +let output = James is 12 years old; + +// WHERE: A DOM element that will contain the entire react generated html +const myDiv = document.querySelector("#myDiv"); + + //what //where +ReactDOM.render(output, myDiv); diff --git a/.learn/resets/01.1-hello-jsx/app.jsx b/.learn/resets/01.1-hello-jsx/app.jsx new file mode 100644 index 00000000..dc9c3ecf --- /dev/null +++ b/.learn/resets/01.1-hello-jsx/app.jsx @@ -0,0 +1,12 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +// If we have a variable +let age = "12"; +let name = "John"; + +// We can use it in our html like this +let output = James is {age} years old; + +// Use react-dom to render it +ReactDOM.render(output, document.querySelector("#myDiv")); diff --git a/.learn/resets/01.2-rendering-from-objects/app.jsx b/.learn/resets/01.2-rendering-from-objects/app.jsx new file mode 100644 index 00000000..466a244b --- /dev/null +++ b/.learn/resets/01.2-rendering-from-objects/app.jsx @@ -0,0 +1,13 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +const customer = { + first_name: "Bob", + last_name: "Dylan" +}; + +// Your code inside these
tags +const output =
; + +// what where +ReactDOM.render(output, document.querySelector("#myDiv")); diff --git a/.learn/resets/01.3-building-a-layout/app.jsx b/.learn/resets/01.3-building-a-layout/app.jsx new file mode 100644 index 00000000..3d27faa1 --- /dev/null +++ b/.learn/resets/01.3-building-a-layout/app.jsx @@ -0,0 +1,20 @@ +import React from "react"; // Main React.js library +import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM + +const data = { + image: "../../.learn/assets/Dylan.png?raw=true", + cardTitle: "Bob Dylan", + cardDescription: + "Bob Dylan (born Robert Allen Zimmerman, May 24, 1941) is an American singer-songwriter, author, and artist who has been an influential figure in popular music and culture for more than five decades.", + button: { + url: "https://en.wikipedia.org/wiki/Bob_Dylan", + label: "Go to wikipedia", + }, +}; + +// Modify the 'content' variable below to display the desired bootstrap card +let content = ( + +); + +ReactDOM.render(content, document.querySelector("#myDiv")); diff --git a/.learn/resets/01.4-building-html-from-arrays/app.jsx b/.learn/resets/01.4-building-html-from-arrays/app.jsx new file mode 100644 index 00000000..044bde7d --- /dev/null +++ b/.learn/resets/01.4-building-html-from-arrays/app.jsx @@ -0,0 +1,9 @@ +import React from "react"; // Main React.js library +import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM + +// Only update the value of this array +const navlinkItems = []; + +const content = ; + +ReactDOM.render(content, document.querySelector("#myDiv")); diff --git a/.learn/resets/02-maping-array-to-li/app.jsx b/.learn/resets/02-maping-array-to-li/app.jsx new file mode 100644 index 00000000..d2efa909 --- /dev/null +++ b/.learn/resets/02-maping-array-to-li/app.jsx @@ -0,0 +1,13 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +const animals = ["Horse", "Turtle", "Elephant", "Monkey"]; + +/** + * Change the content inside the map function + **/ +const animalsInHTML = animals.map((singleAnimal, index) => { + return
  • hello
  • ; +}); + +ReactDOM.render(, document.querySelector("#myDiv")); diff --git a/.learn/resets/02.1-maping-array-objects-to-li/app.jsx b/.learn/resets/02.1-maping-array-objects-to-li/app.jsx new file mode 100644 index 00000000..87006bcb --- /dev/null +++ b/.learn/resets/02.1-maping-array-objects-to-li/app.jsx @@ -0,0 +1,13 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +const animals = [{ label: "Horse" }, { label: "Turtle" }, { label: "Elephant" }, { label: "Monkey" }]; + +/** + * Change the content of the map function + **/ +const animalsInHTML = animals.map((singleAnimal, index) => { + return
  • hello
  • ; +}); + +ReactDOM.render(, document.querySelector("#myDiv")); diff --git a/exercises/01-hello-world/app.jsx b/exercises/01-hello-world/app.jsx index 556bb60d..82839c90 100644 --- a/exercises/01-hello-world/app.jsx +++ b/exercises/01-hello-world/app.jsx @@ -3,10 +3,12 @@ import React from "react"; // Main React.js library import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM // WHAT: This variable contains the html to render -let output = James is 12 years old; +let ouput = ( + + James is 12 years old + +); -// WHERE: A DOM element that will contain the entire react generated html const myDiv = document.querySelector("#myDiv"); - //what //where -ReactDOM.render(output, myDiv); +ReactDOM.render(ouput, myDiv); diff --git a/exercises/01.1-hello-jsx/app.jsx b/exercises/01.1-hello-jsx/app.jsx index dc9c3ecf..86158c47 100644 --- a/exercises/01.1-hello-jsx/app.jsx +++ b/exercises/01.1-hello-jsx/app.jsx @@ -6,7 +6,11 @@ let age = "12"; let name = "John"; // We can use it in our html like this -let output = James is {age} years old; +let output = ( + + {name} is {age} years old + +); // Use react-dom to render it ReactDOM.render(output, document.querySelector("#myDiv")); diff --git a/exercises/01.2-rendering-from-objects/app.jsx b/exercises/01.2-rendering-from-objects/app.jsx index 466a244b..9a0dea45 100644 --- a/exercises/01.2-rendering-from-objects/app.jsx +++ b/exercises/01.2-rendering-from-objects/app.jsx @@ -7,7 +7,11 @@ const customer = { }; // Your code inside these
    tags -const output =
    ; +const output = +
    +

    My name is {customer.first_name}

    +

    My last name is {customer.last_name}

    +
    ; // what where ReactDOM.render(output, document.querySelector("#myDiv")); diff --git a/exercises/01.3-building-a-layout/app.jsx b/exercises/01.3-building-a-layout/app.jsx index 3d27faa1..78475cc4 100644 --- a/exercises/01.3-building-a-layout/app.jsx +++ b/exercises/01.3-building-a-layout/app.jsx @@ -14,7 +14,16 @@ const data = { // Modify the 'content' variable below to display the desired bootstrap card let content = ( - +
    + Card image cap +
    +
    {data.cardTitle}
    +

    {data.cardDescription}

    + + {data.button.label} + +
    +
    ); ReactDOM.render(content, document.querySelector("#myDiv")); diff --git a/exercises/01.4-building-html-from-arrays/app.jsx b/exercises/01.4-building-html-from-arrays/app.jsx index 044bde7d..e61c6c9a 100644 --- a/exercises/01.4-building-html-from-arrays/app.jsx +++ b/exercises/01.4-building-html-from-arrays/app.jsx @@ -2,7 +2,23 @@ import React from "react"; // Main React.js library import ReactDOM from "react-dom"; // We use ReactDOM to render into the DOM // Only update the value of this array -const navlinkItems = []; +const navlinkItems = [ +
  • + + Link to google.com + +
  • , +
  • + + Link to facebook.com + +
  • , +
  • + + Link to amazon.com + +
  • , +]; const content = ; diff --git a/exercises/02-maping-array-to-li/app.jsx b/exercises/02-maping-array-to-li/app.jsx index d2efa909..2447bede 100644 --- a/exercises/02-maping-array-to-li/app.jsx +++ b/exercises/02-maping-array-to-li/app.jsx @@ -7,7 +7,7 @@ const animals = ["Horse", "Turtle", "Elephant", "Monkey"]; * Change the content inside the map function **/ const animalsInHTML = animals.map((singleAnimal, index) => { - return
  • hello
  • ; + return
  • {singleAnimal}
  • ; }); ReactDOM.render(, document.querySelector("#myDiv")); diff --git a/exercises/02.1-maping-array-objects-to-li/app.jsx b/exercises/02.1-maping-array-objects-to-li/app.jsx index 87006bcb..97f1e3b8 100644 --- a/exercises/02.1-maping-array-objects-to-li/app.jsx +++ b/exercises/02.1-maping-array-objects-to-li/app.jsx @@ -7,7 +7,7 @@ const animals = [{ label: "Horse" }, { label: "Turtle" }, { label: "Elephant" }, * Change the content of the map function **/ const animalsInHTML = animals.map((singleAnimal, index) => { - return
  • hello
  • ; + return
  • {singleAnimal.label}
  • ; }); ReactDOM.render(, document.querySelector("#myDiv")); From dcece4229dec295912d22b604deeaed688df5eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Arreaza?= <112995166+Andres-Arreaza@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:58:41 +0000 Subject: [PATCH 2/2] Finalizacion 1 de la practica de react-AA --- .../app.jsx | 16 ++++++++ .../resets/03-render-with-functions/app.jsx | 11 ++++++ .../resets/03.1-your-first-component/app.jsx | 9 +++++ .learn/resets/03.2-a-real-component/app.jsx | 7 ++++ .../resets/03.3-component-properties/app.jsx | 26 +++++++++++++ .learn/resets/03.4-hero-component/app.jsx | 23 +++++++++++ .learn/resets/03.5-alert-component/app.jsx | 13 +++++++ .../resets/04-conditional-rendering/app.jsx | 27 +++++++++++++ .../resets/04.1-conditional-rendering/app.jsx | 22 +++++++++++ .../resets/04.2-conditional-rendering/app.jsx | 34 ++++++++++++++++ .learn/resets/05-adding-styles/app.jsx | 24 ++++++++++++ .learn/resets/05.1-second-styles/app.jsx | 31 +++++++++++++++ .learn/resets/06-listening-to-events/app.jsx | 13 +++++++ exercises/01-hello-world/app.jsx | 14 ++++--- exercises/01.1-hello-jsx/app.jsx | 6 +-- exercises/01.2-rendering-from-objects/app.jsx | 16 ++++---- exercises/01.3-building-a-layout/app.jsx | 2 +- exercises/02-maping-array-to-li/app.jsx | 5 ++- .../02.1-maping-array-objects-to-li/app.jsx | 12 +++--- .../app.jsx | 10 ++++- exercises/03-render-with-functions/app.jsx | 14 +++---- exercises/03.1-your-first-component/app.jsx | 2 +- exercises/03.2-a-real-component/app.jsx | 16 +++++++- exercises/03.3-component-properties/app.jsx | 33 +++++++++++----- exercises/03.4-hero-component/app.jsx | 39 ++++++++++++------- exercises/03.5-alert-component/app.jsx | 18 +++++---- exercises/04-conditional-rendering/app.jsx | 19 +++++---- exercises/04.1-conditional-rendering/app.jsx | 31 ++++++++++----- exercises/04.2-conditional-rendering/app.jsx | 9 +++-- exercises/05-adding-styles/app.jsx | 8 ++-- exercises/05.1-second-styles/app.jsx | 11 ++++-- exercises/06-listening-to-events/app.jsx | 6 ++- 32 files changed, 430 insertions(+), 97 deletions(-) create mode 100644 .learn/resets/02.2-maping-array-of-objects-to-li/app.jsx create mode 100644 .learn/resets/03-render-with-functions/app.jsx create mode 100644 .learn/resets/03.1-your-first-component/app.jsx create mode 100644 .learn/resets/03.2-a-real-component/app.jsx create mode 100644 .learn/resets/03.3-component-properties/app.jsx create mode 100644 .learn/resets/03.4-hero-component/app.jsx create mode 100644 .learn/resets/03.5-alert-component/app.jsx create mode 100644 .learn/resets/04-conditional-rendering/app.jsx create mode 100644 .learn/resets/04.1-conditional-rendering/app.jsx create mode 100644 .learn/resets/04.2-conditional-rendering/app.jsx create mode 100644 .learn/resets/05-adding-styles/app.jsx create mode 100644 .learn/resets/05.1-second-styles/app.jsx create mode 100644 .learn/resets/06-listening-to-events/app.jsx diff --git a/.learn/resets/02.2-maping-array-of-objects-to-li/app.jsx b/.learn/resets/02.2-maping-array-of-objects-to-li/app.jsx new file mode 100644 index 00000000..a933d112 --- /dev/null +++ b/.learn/resets/02.2-maping-array-of-objects-to-li/app.jsx @@ -0,0 +1,16 @@ +import React from "react"; +import ReactDOM from "react-dom"; + +const planets = ["Mars", "Venus", "Jupiter", "Earth", "Saturn", "Neptune"]; + +/** + * 1) Create the mapping function and use it to generate a new array of + * planets in html called planetsInHTML + */ + + + +// 2) Add the array planetsInHTML inside the innerHTML of this
    ); -ReactDOM.render(content, document.querySelector("#myDiv")); +ReactDOM.render(content, document.querySelector('#myDiv')); diff --git a/exercises/02-maping-array-to-li/app.jsx b/exercises/02-maping-array-to-li/app.jsx index 2447bede..eda4c980 100644 --- a/exercises/02-maping-array-to-li/app.jsx +++ b/exercises/02-maping-array-to-li/app.jsx @@ -5,9 +5,12 @@ const animals = ["Horse", "Turtle", "Elephant", "Monkey"]; /** * Change the content inside the map function + * animalsInHTML + * singleAnimal **/ + const animalsInHTML = animals.map((singleAnimal, index) => { return
  • {singleAnimal}
  • ; }); -ReactDOM.render(, document.querySelector("#myDiv")); +ReactDOM.render(
      {animalsInHTML}
    , document.querySelector("#myDiv")); diff --git a/exercises/02.1-maping-array-objects-to-li/app.jsx b/exercises/02.1-maping-array-objects-to-li/app.jsx index 97f1e3b8..2aec8c26 100644 --- a/exercises/02.1-maping-array-objects-to-li/app.jsx +++ b/exercises/02.1-maping-array-objects-to-li/app.jsx @@ -1,11 +1,11 @@ -import React from "react"; -import ReactDOM from "react-dom"; +//importamos las librerias de react. +import React from "react"; /*Genera interfaces de usuarios*/ +import ReactDOM from "react-dom"; /*Muestra los comonentes por pantalla*/ -const animals = [{ label: "Horse" }, { label: "Turtle" }, { label: "Elephant" }, { label: "Monkey" }]; +/*Horse, Turtle, Elephant, Monkey*/ -/** - * Change the content of the map function - **/ +//Creamos un arreglo de objetos que contengan los nombres de los animales. +const animals = [{ label: "Horse" }, { label: "Turtle" }, { label: "Elephant" }, { label: "Monkey" }]; const animalsInHTML = animals.map((singleAnimal, index) => { return
  • {singleAnimal.label}
  • ; }); diff --git a/exercises/02.2-maping-array-of-objects-to-li/app.jsx b/exercises/02.2-maping-array-of-objects-to-li/app.jsx index a933d112..872b1166 100644 --- a/exercises/02.2-maping-array-of-objects-to-li/app.jsx +++ b/exercises/02.2-maping-array-of-objects-to-li/app.jsx @@ -8,9 +8,15 @@ const planets = ["Mars", "Venus", "Jupiter", "Earth", "Saturn", "Neptune"]; * planets in html called planetsInHTML */ - +const planetsInHTML = planets.map((singlePlanet, index) => { + return ( +
  • + {singlePlanet} +
  • + ); +}); // 2) Add the array planetsInHTML inside the innerHTML of this