Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task js dom #313

Merged
Prev Previous commit
fix: change bcg for one element,
change in createDetailsList() method to reduce()
  • Loading branch information
DmitryHniezdilov committed Sep 13, 2022
commit 0cd0af32dc2235398146ce047ee7ec52cc70fe91
38 changes: 15 additions & 23 deletions submissions/DmitryHniezdilov/task-js-dom/css/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $colorBtnHov: rgba(227, 90, 37, 0.5);
background: $colorSelection;
}

.wrapper {
.body {
min-height: 100vh;
overflow: hidden;
display: flex;
Expand All @@ -38,37 +38,29 @@ $colorBtnHov: rgba(227, 90, 37, 0.5);

background: radial-gradient(circle at top, $bcgWhite, transparent 50%),
linear-gradient(to bottom, $bcgBlueFill 0%, transparent 70%),
linear-gradient(to top, transparent, rgba($bcgWhite, 0.3) 70%), $bcgBlue;
linear-gradient(to top, transparent, rgba($bcgWhite, 0.3) 70%),
url("../img/bcg-mountain.webp"), $bcgBlue;
animation: bg 30s infinite;
background-size: cover;
background-position: center bottom;
background-repeat: no-repeat;
}

&__bcg-box {
position: absolute;
right: 0;
bottom: -20px;
left: 0;
height: 65%;
user-select: none;
background-image: url("../img/bcg-mountain.webp");
background-size: cover;
background-repeat: no-repeat;
}

&__inner {
max-height: 100vh;
position: relative;
overflow-y: auto;
scrollbar-gutter: stable;
}
.wrapper {
max-height: 100vh;
position: relative;
overflow-y: auto;
scrollbar-gutter: stable;

&__inner::-webkit-scrollbar {
&::-webkit-scrollbar {
width: 4px;
}

&__inner::-webkit-scrollbar-track {
&::-webkit-scrollbar-track {
box-shadow: transparent;
}

&__inner::-webkit-scrollbar-thumb {
&::-webkit-scrollbar-thumb {
background-color: $bcgBlue;
border-radius: 2px;
}
Expand Down
39 changes: 17 additions & 22 deletions submissions/DmitryHniezdilov/task-js-dom/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,24 @@
<link rel="icon" type="image/x-icon" href="./img/logo-mountain.svg" />
</head>

<body>
<body class="body">
<div class="wrapper">
<figure class="wrapper__bcg-box">
<img class="wrapper__bcg-img" src="./img/bcg-mountain.webp" alt="" />
</figure>
<div class="wrapper__inner">
<div class="header">
<button class="header__logo js-elem-logo" type="button">
<img
src="./img/logo-mountain.svg"
alt="logo img center"
class="header__logo-img"
/>
</button>
</div>
<div class="inner">
<aside class="inner__aside">
<nav class="menu paper js-elem-menu"></nav>
</aside>
<main class="inner__main">
<article class="content paper js-elem-content"></article>
</main>
</div>
<div class="header">
<a class="header__logo js-elem-logo" href="/">
<img
src="./img/logo-mountain.svg"
alt="logo img center"
class="header__logo-img"
/>
</a>
</div>
<div class="inner">
<aside class="inner__aside">
<nav class="menu paper js-elem-menu"></nav>
</aside>
<main class="inner__main">
<article class="content paper js-elem-content"></article>
</main>
</div>
</div>

Expand Down
18 changes: 9 additions & 9 deletions submissions/DmitryHniezdilov/task-js-dom/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ const changeMinToHm = (minutes) => {
};

const createСontentMarkup = (item = defaultContentItem) => {
const details = item["details"];

const createDetailsList = () => {
let detailsItems = "";
Object.keys(item["details"]).forEach((key) => {
let detailsItems = Object.keys(details).reduce((acc, key) => {
const value =
key === "Runtime"
? changeMinToHm(item["details"][key])
: item["details"][key];
key === "Runtime" ? changeMinToHm(details[key]) : details[key];

detailsItems += `
return (acc += `
<div class="content__info-item">
<dt class="content__info-text content__info-text--title">${key}: </dt>
<dd class="content__info-text">${value}</dd>
</div>
`;
});
`);
}, "");

return '<dl class="content__info-list">' + detailsItems + "</dl>";
};

Expand All @@ -59,7 +59,7 @@ const createСontentMarkup = (item = defaultContentItem) => {
</div>
<div class="content__info-wrap">
<p class="content__info-text content__info-text--plot">${item["Plot"]}</p>
${item["details"] ? createDetailsList() : ""}
${details ? createDetailsList() : ""}
</div>
`;

Expand Down