diff --git a/css/style.css b/css/style.css index 87d3f53..3836cbc 100644 --- a/css/style.css +++ b/css/style.css @@ -1,3 +1,6 @@ +body{ + font-family: 'Poppins', sans-serif; +} .card{ margin-bottom: 15px; transition: all 0.2s ease-in-out; @@ -9,7 +12,7 @@ transform: scale(1.03); } .card img{ - width: 80%; + width: 65%; margin: 0 auto; margin-top: 5px; } @@ -25,4 +28,12 @@ .show-more{ display: none; margin: 20px 0; +} +.details{ + margin-top: 15px; +} + +.features span{ + font-weight: bold; + font-size: 20px; } \ No newline at end of file diff --git a/images/Firefox Installer.exe b/images/Firefox Installer.exe deleted file mode 100644 index e757d10..0000000 Binary files a/images/Firefox Installer.exe and /dev/null differ diff --git a/index.html b/index.html index eb31f1c..bc6781b 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,10 @@ - Document + Mobile Hut + + + @@ -23,9 +26,19 @@ -
- +
+
+
+ +
+
+ +
+

Details

+ +
+

Sorry we don't find anything with your search😒

@@ -37,7 +50,7 @@

Sorry we don't find anything with your search😒

-
+
diff --git a/js/script.js b/js/script.js index 8442381..708a35b 100644 --- a/js/script.js +++ b/js/script.js @@ -34,26 +34,73 @@ const displayPhone = (data) => { for (let item of firstData) { const div = document.createElement('div'); div.classList.add('col-12'); - div.classList.add('col-md-3'); + div.classList.add('col-md-4'); div.classList.add('d-flex'); div.classList.add('justify-content-center'); div.classList.add('text-center'); div.innerHTML = ` -
+
${item.brand} mobile image
${item.brand}

${item.phone_name}

- +
` cards.appendChild(div) } - + if (allData.length > 20) { + const showMore = document.getElementById('show-more'); + showMore.style.display = 'block' + div = document.createElement('div'); + div.classList.add('col-12'); + div.innerHTML = ``; + showMore.appendChild(div); + } toggleNotFound('none'); toggleLoading('none'); } +} + +const loadDetail = (id) => { + const url = `https://openapi.programming-hero.com/api/phone/${id}` + fetch(url) + .then(res => res.json()) + .then(data => specDetails(data.data)) +} +// phone spec detail section +const specDetails = (data) => { + console.log(data.brand); + const featureSection = document.getElementById('feature'); + const div = document.createElement('div'); + featureSection.textContent = ''; + div.classList.add('feature') + div.innerHTML = ` +

Details

+
+
+
+

Brand name: ${data.brand}

+

model: ${data.name}

+
+
+ +
+
+

Features

+

Chipset: chipset information

+

Storsge: Storage

+

Display Size: Display

+

Memory: memory

+

Sensors: sensors

+

Others: others

+

Release Date: release date

+
+
+ ` + featureSection.appendChild(div); + } \ No newline at end of file