From 561a32a311b4aa4d493d80132db09219d1efa906 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 3 Jun 2026 20:32:41 +0300 Subject: [PATCH] add task solution --- .github/workflows/test.yml-template | 29 +++++++++++++++++++++++++++++ README.md | 2 +- src/scripts/main.js | 19 ++++++++++++++++++- src/styles/main.scss | 23 +++++++++++++---------- 4 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/test.yml-template diff --git a/.github/workflows/test.yml-template b/.github/workflows/test.yml-template new file mode 100644 index 000000000..44ac4e963 --- /dev/null +++ b/.github/workflows/test.yml-template @@ -0,0 +1,29 @@ +name: Test + +on: + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm start & sleep 5 && npm test + - name: Upload tests report(cypress mochaawesome merged HTML report) + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: report + path: reports diff --git a/README.md b/README.md index a4241d05f..3a2a64cfa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ 1. Replace `` with your Github username in the link - - [DEMO LINK](https://.github.io/js_task_generate_table_DOM/) + - [DEMO LINK](https://OlgaDnepr.github.io/js_task_generate_table_DOM/) 2. Follow [this instructions](https://mate-academy.github.io/layout_task-guideline/) - Run `npm run test` command to test your code; - Run `npm run test:only -- -n` to run fast test ignoring linter; diff --git a/src/scripts/main.js b/src/scripts/main.js index 7d4a5db04..cdc5a59e4 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -357,4 +357,21 @@ const people = [ // eslint-disable-next-line no-console console.log(people); // you can remove it -// write your code here +const table = document.querySelector('.dashboard'); + +people.forEach(function (person) { + const age = person.died - person.born; + const century = Math.ceil(person.died / 100); + const gender = person.sex === 'm' ? 'Male' : 'Female'; + const row = document.createElement('tr'); + + row.innerHTML = ` + ${person.name} + ${gender} + ${person.born} + ${person.died} + ${age} + ${century} + `; + table.appendChild(row); +}); diff --git a/src/styles/main.scss b/src/styles/main.scss index 86e5d60d1..0f246e6b1 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -1,14 +1,17 @@ body { - background-image: linear-gradient(45deg, #e25644, #7e7cf9); - background-attachment: fixed; display: flex; - justify-content: center; align-items: center; + justify-content: center; + + box-sizing: border-box; min-height: 100vh; + margin: 0; padding: 100px; + font-family: Roboto, sans-serif; - margin: 0; - box-sizing: border-box; + + background-image: linear-gradient(45deg, #e25644, #7e7cf9); + background-attachment: fixed; } table { @@ -18,8 +21,8 @@ table { } tr { - background: #fff; color: #808080; + background: #fff; } tr:nth-child(2n + 1) { @@ -27,14 +30,14 @@ tr:nth-child(2n + 1) { } table tr:first-child { - background: #e25644; color: #fff; + background: #e25644; } td, th { - text-align: left; padding: 18px; + text-align: left; } table tr:last-child td:first-child { @@ -54,7 +57,7 @@ table tr:first-child th:last-child { } tr:not(:first-child):hover { - background: #f5f5f5; - color: #585858; cursor: pointer; + color: #585858; + background: #f5f5f5; }