From 3d6283d77e07638961f48f8a43f7db7f550b3289 Mon Sep 17 00:00:00 2001 From: amirreza-ashrafi-dev Date: Wed, 12 Apr 2023 14:01:15 +0430 Subject: [PATCH 1/3] iframe allowFullScreena is a wrong property and changed to allowFullScreen, Link component which wrapped around iframe removed because it doesn't affect and it causing error --- src/components/Header.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/Header.js b/src/components/Header.js index 80b69ad..281d37e 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -16,16 +16,14 @@ const header = () => {
- - - +
From 16021e7d80240e00de91ffb6d6f78c55c454eaab Mon Sep 17 00:00:00 2001 From: amirreza-ashrafi-dev Date: Wed, 12 Apr 2023 14:31:46 +0430 Subject: [PATCH 2/3] return statement issue inside renderdetail method from Detail component fixed --- src/components/CountryDetails/Detail.js | 132 ++++++++++++------------ 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/src/components/CountryDetails/Detail.js b/src/components/CountryDetails/Detail.js index eba980a..170f4fd 100644 --- a/src/components/CountryDetails/Detail.js +++ b/src/components/CountryDetails/Detail.js @@ -14,6 +14,7 @@ class Detail extends React.Component { const { id } = this.props.match.params; axios.get(`https://restcountries.com/v2/name/${id}`).then((response) => { + console.log(response); if (id.toLowerCase() === "india") { response.data[1].population = 1380879389; this.setState({ details: response.data[1] }); @@ -54,73 +55,74 @@ class Detail extends React.Component { renderDetail = () => { const { details } = this.state; + return <> + {!details ? ( + + ) : ( +
+ {details.region} +

{this.props.match.params.id}

+
+

Population

+

{details.population.toLocaleString()}

+
+
+

Capital

+

{details.capital}

+
+
+

Call Code

+

{details.callingCodes}

+
+
+

Region

+

{details.region}

+
+
+

Native

+

{details.demonym}

+
+
+

Languages

+

+ {details.languages + .map((language) => `${language.nativeName}`) + .join(", ")} +

+
+
+

Currencies

+

+ {details.currencies + .map((currency) => `${currency.name} (${currency.code})`) + .join(", ")} +

+
+
+

Time Zone(s)

+

{details.timezones.join(", ")}

+
- !details ? ( - - ) : ( -
- {details.region} -

{this.props.match.params.id}

-
-

Population

-

{details.population.toLocaleString()}

-
-
-

Capital

-

{details.capital}

-
-
-

Call Code

-

{details.callingCodes}

-
-
-

Region

-

{details.region}

-
-
-

Native

-

{details.demonym}

-
-
-

Languages

-

- {details.languages - .map((language) => `${language.nativeName}`) - .join(", ")} -

-
-
-

Currencies

-

- {details.currencies - .map((currency) => `${currency.name} (${currency.code})`) - .join(", ")} -

-
-
-

Time Zone(s)

-

{details.timezones.join(", ")}

-
+ - - - - BACK - -
- ); + + BACK + +
+ )} + }; render() { From e1aec00a8fe0ff55c93c4f08f7ff6b04882daacc Mon Sep 17 00:00:00 2001 From: amirreza-ashrafi-dev Date: Wed, 12 Apr 2023 14:33:09 +0430 Subject: [PATCH 3/3] remove console.log --- src/components/CountryDetails/Detail.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/CountryDetails/Detail.js b/src/components/CountryDetails/Detail.js index 170f4fd..49ed38f 100644 --- a/src/components/CountryDetails/Detail.js +++ b/src/components/CountryDetails/Detail.js @@ -14,7 +14,6 @@ class Detail extends React.Component { const { id } = this.props.match.params; axios.get(`https://restcountries.com/v2/name/${id}`).then((response) => { - console.log(response); if (id.toLowerCase() === "india") { response.data[1].population = 1380879389; this.setState({ details: response.data[1] });