Conversation
| } | ||
| %> | ||
| <a href="<%= it.url %>" role="button" | ||
| <<%= it.tag %> <%= href %> role="button" |
src/_includes/header/header.ejs
Outdated
|
|
||
| <header class=" D-f Jc-sb Ai-c P2u;2u md_P1u;3u Bgc-$core800 -Blr4 Bcf-$blr Ps-f H-$headerH | ||
| W100p C-$headerC Zi20"> | ||
| <header class=" D-f Jc-sb Ai-c P2u;2u md_P1u;3u Bgc-$core800 -Blr4 Bcf-$blr Ps-f H-$headerH W100p C-$headerC Zi20"> |
There was a problem hiding this comment.
| <header class=" D-f Jc-sb Ai-c P2u;2u md_P1u;3u Bgc-$core800 -Blr4 Bcf-$blr Ps-f H-$headerH W100p C-$headerC Zi20"> | |
| <header class=" D-f Jc-sb Ai-c P2u;2u md_P1u;3u Bgc-$core800 -Blr4 Bcf Ps-f H-$headerH W100p C-$headerC Zi20"> |
src/art-api/boom-emoji.html
Outdated
There was a problem hiding this comment.
Эти файлы должен eleventy генерировать во время сборки...
There was a problem hiding this comment.
Зачем отдельный каталог? И название надо другое: типа art-panel
| @@ -0,0 +1,53 @@ | |||
| const hightlightClasses = "Bd1;s;$brand Bxsd1;1;10;2;$brand Zi19" | |||
There was a problem hiding this comment.
| const hightlightClasses = "Bd1;s;$brand Bxsd1;1;10;2;$brand Zi19" | |
| const hightlightСss = "Bd1;s;$brand Bxsd1;1;10;2;$brand Zi19" |
| connectedCallback() { | ||
| this.highlightTargetArt() | ||
| const artId = this.getAttribute('id'); | ||
| console.log(artId); |
src/arts.ejs
Outdated
| variant: "light" | ||
| }) %> | ||
| </div> | ||
| <div id="<%= art.artId %>-link-button" class="<%= artsPageCSS.button %>" > |
There was a problem hiding this comment.
Чтобы компонент мог обращаться к этой кнопке без привязки к тегу.
There was a problem hiding this comment.
Чтобы обращаться к ней, не привязываясь к имени тега.
There was a problem hiding this comment.
Но есть же классы для этих целей)
| button.addEventListener('click', this.copyArtLink(artId)) | ||
| } | ||
|
|
||
| copyArtLink = (artId) => { |
There was a problem hiding this comment.
Почему здесь id берется из замыкания, а не просто кладется в свойство класса?
|
|
||
| copyArtLink = (artId) => { | ||
| return function() { | ||
| const span = this.querySelector('span') |
There was a problem hiding this comment.
Не надо завязываться на названия элементов
| const span = this.querySelector('span') | ||
| let link = window.location.href | ||
| const idPosition = link.indexOf('#') | ||
| if (idPosition > 0) { |
There was a problem hiding this comment.
Это можно сильно проще написать, без if
| let link = window.location.href | ||
| const idPosition = link.indexOf('#') | ||
| if (idPosition > 0) { | ||
| link.replace( |
There was a problem hiding this comment.
replace не меняет исходную строку
| link += `#${artId}` | ||
| } | ||
| navigator.clipboard.writeText(link) | ||
| span.innerText = 'Copied!' |
There was a problem hiding this comment.
| span.innerText = 'Copied!' | |
| span.textContent = 'Copied!' |
| } | ||
| } | ||
|
|
||
| highlightTargetArt(){ |
There was a problem hiding this comment.
Посмотри инфу про псевдокласс :target
09b9422 to
52f084b
Compare
src/assets/script/art-panel.js
Outdated
|
|
||
| highlightTargetArt() { | ||
| hightlightCss.split(' ').forEach(c => { | ||
| this.classList.add(c) |
There was a problem hiding this comment.
В classList можно несколько элементов добавлять и удалять
src/assets/script/art-panel.js
Outdated
| connectedCallback() { | ||
| this.highlightTargetArt(); | ||
| const button = this.querySelector(`#${this.artId}-link-button`); | ||
| button.addEventListener('click', () => this.copyArtLink(button)) |
There was a problem hiding this comment.
Зачем здесь передается эта кнопка, если ее так же можно в поле компонента положить?
src/art.ejs
Outdated
| @@ -0,0 +1,8 @@ | |||
| --- | |||
| pagination: | |||
There was a problem hiding this comment.
Причем здесь пагинация? Надо сделать каталог с артами, где они будут лежать, и откуда берутся в галерею. При сборке он будет переименовываться в art-api и там они уже будут собранные для выкачивания
| <% } else { %> | ||
| <div class="<%= css.contentContainer%>"> | ||
| <span class="<%= css.span %>"> | ||
| <span class="<%= css.span %>" data-name="button-text"> |
There was a problem hiding this comment.
Зачем атрибут, если можно использовать class?
src/assets/script/art-panel.js
Outdated
| export class ArtPanel extends HTMLElement { | ||
| constructor() { | ||
| super(); | ||
| this.artId = this.getAttribute('id') |
There was a problem hiding this comment.
Можно просто использовать this.id
.eleventy.js
Outdated
| export default async function(config){ | ||
| config.addPlugin(ejsPlugin,{ | ||
| _with: false, | ||
| localsName: 'it' |
There was a problem hiding this comment.
Что-то не так с форматированием
src/assets/script/art-panel.js
Outdated
| } | ||
|
|
||
| highlightTargetArt() { | ||
| this.classList.add('Bxsd1;1;10;2;$brand_t', 'Bd1;s;$brand_t', 'Zi19_t') |
There was a problem hiding this comment.
Зачем убирать эти утилиты из переменной, если можно просто ее деструктуризацию использовать?
src/assets/script/art-panel.js
Outdated
| connectedCallback() { | ||
| this.highlightTargetArt(); | ||
| this.button = this.querySelector(`#${this.id}-link-button`); | ||
| this.button = this.querySelector(`.${this.id}-link-button`); |
There was a problem hiding this comment.
А зачем здесь вообще к классу id прицеплять?
src/assets/script/art-panel.js
Outdated
| @@ -1,3 +1,5 @@ | |||
| const hightlightCss = "Bd1;s;$brand_t Bxsd1;1;10;2;$brand_t Zi19_t" | |||
There was a problem hiding this comment.
Если это используется только как массив, то может и сразу сделать массивом?
src/assets/script/art-panel.js
Outdated
| @@ -6,7 +8,7 @@ export class ArtPanel extends HTMLElement { | |||
|
|
|||
| connectedCallback() { | |||
| this.highlightTargetArt(); | |||
There was a problem hiding this comment.
И вот что подумал. Наверное лучше без target утилиты оставить и просто в js проверять, есть ли id в hash и только тогда это вызывать. А то когда артов станет сильно больше, то много лишних операций в dom будет
src/arts.ejs
Outdated
| <div class="<%= artsPageCSS.card%> md_W50p"> | ||
| <div class="<%= artsPageCSS.artWrapper%> <%= art.bgColor %> "> | ||
| <%- include(`./_includes/components/arts/${art.artId}.ejs`) %> | ||
| <art-panel class="D Ps -Ctx W100p H20gg -Ts @:hv_Tsd-$longTs md_W50p" id="<%= art.artId %>"> |
There was a problem hiding this comment.
Зачем @:hv_Tsd-$longTs используй дефолтное
src/arts.ejs
Outdated
| const artsPageCSS = { | ||
| card:"W100p H20gg Tsd-$shortTs @:hv_Tsd-$longTs", | ||
| artWrapper:"-Sz100p Ov-h Plcc-c Plci-c D-f", | ||
| button: "W12gg lg_W9gg Mxw50u xl_Mxw55u H7u" |
There was a problem hiding this comment.
Уже не раз говорил: нельзя ограничивать элементы с текстом по высоте
src/index.ejs
Outdated
| icon: "right-triangle" | ||
| }) %> | ||
| <div class="D-f Fld-r W100p Flw-w Jc-c Gap3u M3u;0 P0;5u Mnh7u"> | ||
| <div class="W70p Mxw50u xl_Mxw55u As-str"> |
There was a problem hiding this comment.
Зачем в нескольких местах надо добавлять этот div?
src/arts/exploding-head.ejs
Outdated
| artLayer: "W100p Apcr1 Bdrd100p Ps-a" | ||
| } | ||
| %> | ||
| <div class="Ctnt-s Pt5u H100p Apcr1 Ctnn-canva Plci-c;c Plcc-c D-f M-a -ExplodingOrangeA#ee980d -ExplodingOrangeB#f8c829 -ExplodingBrownA#662800 -ExplodingBrownB#6f2810 -ExplodingBrownC#9c2a00 -ExplodingBrownD#934800 -ExplodingBrownE#9b3c18 -ExplodingBrownF#a24b0b -ExplodingBrownG#f7ae48 -ExplodingBrownH#d2a55a -ExplodingBrownI#efd3ac"> |
There was a problem hiding this comment.
Pt5u на главной из-за этого арт уменьшился - не надо так
No description provided.