@gudhub/ssg-web-components-library 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/index.js +3 -0
  2. package/package.json +20 -0
  3. package/src/components/about-us-banner/about-us-banner-data.json +9 -0
  4. package/src/components/about-us-banner/about-us-banner.html +19 -0
  5. package/src/components/about-us-banner/about-us-banner.js +23 -0
  6. package/src/components/about-us-banner/about-us-banner.scss +59 -0
  7. package/src/components/about-us-banner/config.js +5 -0
  8. package/src/components/about-us-image-counter/about-us-image-counter-data.json +35 -0
  9. package/src/components/about-us-image-counter/about-us-image-counter.html +22 -0
  10. package/src/components/about-us-image-counter/about-us-image-counter.js +23 -0
  11. package/src/components/about-us-image-counter/about-us-image-counter.scss +44 -0
  12. package/src/components/about-us-image-counter/config.js +5 -0
  13. package/src/components/about-us-team-members/about-us-team-members-data.json +99 -0
  14. package/src/components/about-us-team-members/about-us-team-members.html +25 -0
  15. package/src/components/about-us-team-members/about-us-team-members.js +22 -0
  16. package/src/components/about-us-team-members/about-us-team-members.scss +71 -0
  17. package/src/components/about-us-team-members/config.js +5 -0
  18. package/src/components/animation-block/animation-block-data.json +40 -0
  19. package/src/components/animation-block/animation-block.html +37 -0
  20. package/src/components/animation-block/animation-block.js +23 -0
  21. package/src/components/animation-block/animation-block.scss +337 -0
  22. package/src/components/animation-block/config.js +5 -0
  23. package/src/components/banner-and-text/banner-and-text-data.json +24 -0
  24. package/src/components/banner-and-text/banner-and-text.html +30 -0
  25. package/src/components/banner-and-text/banner-and-text.js +25 -0
  26. package/src/components/banner-and-text/banner-and-text.scss +85 -0
  27. package/src/components/banner-and-text/config.js +5 -0
  28. package/src/components/blog/article/allArticles.json +96 -0
  29. package/src/components/blog/article/article-component.html +189 -0
  30. package/src/components/blog/article/article-component.js +340 -0
  31. package/src/components/blog/article/article-component.scss +776 -0
  32. package/src/components/blog/article/authors-object.json +125 -0
  33. package/src/components/blog/article/categories-object.json +47 -0
  34. package/src/components/blog/author-page/author-page.html +37 -0
  35. package/src/components/blog/author-page/author-page.js +113 -0
  36. package/src/components/blog/author-page/author-page.json +111 -0
  37. package/src/components/blog/author-page/author-page.scss +107 -0
  38. package/src/components/blog/authors-list/authors-list.html +40 -0
  39. package/src/components/blog/authors-list/authors-list.js +60 -0
  40. package/src/components/blog/authors-list/authors-list.json +132 -0
  41. package/src/components/blog/authors-list/authors-list.scss +171 -0
  42. package/src/components/blog/categories-list/categories-list.html +21 -0
  43. package/src/components/blog/categories-list/categories-list.js +26 -0
  44. package/src/components/blog/categories-list/categories-list.json +53 -0
  45. package/src/components/blog/categories-list/categories-list.scss +125 -0
  46. package/src/components/blog/comments/comments.html +89 -0
  47. package/src/components/blog/comments/comments.js +181 -0
  48. package/src/components/blog/comments/comments.json +130 -0
  49. package/src/components/blog/comments/comments.scss +324 -0
  50. package/src/components/blog/contents/contents.html +14 -0
  51. package/src/components/blog/contents/contents.js +63 -0
  52. package/src/components/blog/contents/contents.scss +157 -0
  53. package/src/components/blog/posts-template/articles.json +139 -0
  54. package/src/components/blog/posts-template/authors-object.json +61 -0
  55. package/src/components/blog/posts-template/categories.json +61 -0
  56. package/src/components/blog/posts-template/posts-template.html +239 -0
  57. package/src/components/blog/posts-template/posts-template.js +532 -0
  58. package/src/components/blog/posts-template/posts-template.scss +566 -0
  59. package/src/components/breadcrumbs/breadcrumbs-component.js +65 -0
  60. package/src/components/breadcrumbs/breadcrumbs.html +21 -0
  61. package/src/components/breadcrumbs/breadcrumbs.scss +118 -0
  62. package/src/components/breadcrumbs/config.js +5 -0
  63. package/src/components/button-component/button-component.html +3 -0
  64. package/src/components/button-component/button-component.js +39 -0
  65. package/src/components/button-component/button-component.readme.md +11 -0
  66. package/src/components/button-component/button-component.scss +34 -0
  67. package/src/components/button-component/config.js +5 -0
  68. package/src/components/category-banner/category-banner.html +7 -0
  69. package/src/components/category-banner/category-banner.js +44 -0
  70. package/src/components/category-banner/category-banner.scss +22 -0
  71. package/src/components/category-banner/config.js +5 -0
  72. package/src/components/contact-us-block/config.js +5 -0
  73. package/src/components/contact-us-block/contact-us-block.html +41 -0
  74. package/src/components/contact-us-block/contact-us-block.js +22 -0
  75. package/src/components/contact-us-block/contact-us-block.scss +59 -0
  76. package/src/components/cookies-popup/config.js +5 -0
  77. package/src/components/cookies-popup/cookies-popup.html +8 -0
  78. package/src/components/cookies-popup/cookies-popup.js +27 -0
  79. package/src/components/cookies-popup/cookies-popup.scss +68 -0
  80. package/src/components/counter-section/config.js +5 -0
  81. package/src/components/counter-section/counter-section-data.json +21 -0
  82. package/src/components/counter-section/counter-section.html +38 -0
  83. package/src/components/counter-section/counter-section.js +23 -0
  84. package/src/components/counter-section/counter-section.readme.md +19 -0
  85. package/src/components/counter-section/counter-section.scss +204 -0
  86. package/src/components/counter-section-with-text/config.js +5 -0
  87. package/src/components/counter-section-with-text/counter-section-with-text-data.json +21 -0
  88. package/src/components/counter-section-with-text/counter-section-with-text.html +46 -0
  89. package/src/components/counter-section-with-text/counter-section-with-text.js +23 -0
  90. package/src/components/counter-section-with-text/counter-section-with-text.readme.md +19 -0
  91. package/src/components/counter-section-with-text/counter-section-with-text.scss +164 -0
  92. package/src/components/crm-services-banner/config.js +5 -0
  93. package/src/components/crm-services-banner/crm-services-banner-data.json +20 -0
  94. package/src/components/crm-services-banner/crm-services-banner.html +28 -0
  95. package/src/components/crm-services-banner/crm-services-banner.js +25 -0
  96. package/src/components/crm-services-banner/crm-services-banner.scss +57 -0
  97. package/src/components/edit-mode/config.js +5 -0
  98. package/src/components/edit-mode/edit-mode.html +4 -0
  99. package/src/components/edit-mode/edit-mode.js +23 -0
  100. package/src/components/edit-mode/edit-mode.scss +69 -0
  101. package/src/components/faq/config.js +5 -0
  102. package/src/components/faq/faq.html +20 -0
  103. package/src/components/faq/faq.js +40 -0
  104. package/src/components/faq/faq.scss +80 -0
  105. package/src/components/footer/config.js +5 -0
  106. package/src/components/footer/footer.html +74 -0
  107. package/src/components/footer/footer.js +21 -0
  108. package/src/components/footer/footer.scss +356 -0
  109. package/src/components/footer/pages-object.json +58 -0
  110. package/src/components/fullscreen-image-and-text/config.js +5 -0
  111. package/src/components/fullscreen-image-and-text/fullscreen-image-and-text.html +42 -0
  112. package/src/components/fullscreen-image-and-text/fullscreen-image-and-text.js +29 -0
  113. package/src/components/fullscreen-image-and-text/fullscreen-image-and-text.scss +192 -0
  114. package/src/components/get-in-touch-block/config.js +5 -0
  115. package/src/components/get-in-touch-block/get-in-touch-block-data.json +4 -0
  116. package/src/components/get-in-touch-block/get-in-touch-block.html +11 -0
  117. package/src/components/get-in-touch-block/get-in-touch-block.js +22 -0
  118. package/src/components/get-in-touch-block/get-in-touch-block.scss +12 -0
  119. package/src/components/get-in-touch-form/config.js +5 -0
  120. package/src/components/get-in-touch-form/get-in-touch-form-data.json +114 -0
  121. package/src/components/get-in-touch-form/get-in-touch-form.html +35 -0
  122. package/src/components/get-in-touch-form/get-in-touch-form.js +115 -0
  123. package/src/components/get-in-touch-form/get-in-touch-form.readme.md +45 -0
  124. package/src/components/get-in-touch-form/get-in-touch-form.scss +334 -0
  125. package/src/components/get-in-touch-form/sendEmail.js +161 -0
  126. package/src/components/grid/config.js +5 -0
  127. package/src/components/grid/grid.html +51 -0
  128. package/src/components/grid/grid.js +115 -0
  129. package/src/components/grid/grid.scss +566 -0
  130. package/src/components/grid-component/config.js +5 -0
  131. package/src/components/grid-component/grid-component-data.json +115 -0
  132. package/src/components/grid-component/grid-component.html +52 -0
  133. package/src/components/grid-component/grid-component.js +40 -0
  134. package/src/components/grid-component/grid-component.readme.md +32 -0
  135. package/src/components/grid-component/grid-component.scss +199 -0
  136. package/src/components/header/config.js +5 -0
  137. package/src/components/header/header.html +60 -0
  138. package/src/components/header/header.js +55 -0
  139. package/src/components/header/header.scss +556 -0
  140. package/src/components/homepage-banner/config.js +5 -0
  141. package/src/components/homepage-banner/homepage-banner.html +1443 -0
  142. package/src/components/homepage-banner/homepage-banner.js +23 -0
  143. package/src/components/homepage-banner/homepage-banner.scss +147 -0
  144. package/src/components/image-component/config.js +5 -0
  145. package/src/components/image-component/image-component.html +25 -0
  146. package/src/components/image-component/image-component.js +107 -0
  147. package/src/components/list-text-and-media/config.js +5 -0
  148. package/src/components/list-text-and-media/list-text-and-media-data.json +70 -0
  149. package/src/components/list-text-and-media/list-text-and-media.html +38 -0
  150. package/src/components/list-text-and-media/list-text-and-media.js +22 -0
  151. package/src/components/list-text-and-media/list-text-and-media.readme.md +30 -0
  152. package/src/components/list-text-and-media/list-text-and-media.scss +156 -0
  153. package/src/components/media-and-accordion/config.js +5 -0
  154. package/src/components/media-and-accordion/media-and-accordion-data.json +84 -0
  155. package/src/components/media-and-accordion/media-and-accordion.html +37 -0
  156. package/src/components/media-and-accordion/media-and-accordion.js +55 -0
  157. package/src/components/media-and-accordion/media-and-accordion.scss +170 -0
  158. package/src/components/media-and-list-of-text/config.js +5 -0
  159. package/src/components/media-and-list-of-text/media-and-list-of-text-data.json +16 -0
  160. package/src/components/media-and-list-of-text/media-and-list-of-text.html +32 -0
  161. package/src/components/media-and-list-of-text/media-and-list-of-text.js +24 -0
  162. package/src/components/media-and-list-of-text/media-and-list-of-text.readme.md +26 -0
  163. package/src/components/media-and-list-of-text/media-and-list-of-text.scss +102 -0
  164. package/src/components/media-and-text/config.js +5 -0
  165. package/src/components/media-and-text/media-and-text-data.json +20 -0
  166. package/src/components/media-and-text/media-and-text.html +26 -0
  167. package/src/components/media-and-text/media-and-text.js +26 -0
  168. package/src/components/media-and-text/media-and-text.scss +51 -0
  169. package/src/components/meta/articles.json +95 -0
  170. package/src/components/meta/author-schema.js +71 -0
  171. package/src/components/meta/authors.json +108 -0
  172. package/src/components/meta/blog-schema.js +93 -0
  173. package/src/components/meta/canonical.js +74 -0
  174. package/src/components/meta/config.js +40 -0
  175. package/src/components/meta/meta-index.js +14 -0
  176. package/src/components/meta/meta-tag.js +168 -0
  177. package/src/components/meta/organization-schema.js +50 -0
  178. package/src/components/meta/service-schema.js +76 -0
  179. package/src/components/meta/title-tag.js +64 -0
  180. package/src/components/overflow-cards/config.js +5 -0
  181. package/src/components/overflow-cards/overflow-cards-data.json +33 -0
  182. package/src/components/overflow-cards/overflow-cards.html +33 -0
  183. package/src/components/overflow-cards/overflow-cards.js +28 -0
  184. package/src/components/overflow-cards/overflow-cards.scss +112 -0
  185. package/src/components/popup/config.js +5 -0
  186. package/src/components/popup/popup.html +10 -0
  187. package/src/components/popup/popup.js +66 -0
  188. package/src/components/popup/popup.readme.md +13 -0
  189. package/src/components/popup/popup.scss +76 -0
  190. package/src/components/prices-cards/config.js +5 -0
  191. package/src/components/prices-cards/prices-cards-data.json +90 -0
  192. package/src/components/prices-cards/prices-cards.html +35 -0
  193. package/src/components/prices-cards/prices-cards.js +23 -0
  194. package/src/components/prices-cards/prices-cards.readme.md +48 -0
  195. package/src/components/prices-cards/prices-cards.scss +206 -0
  196. package/src/components/recent-posts/author-object.json +53 -0
  197. package/src/components/recent-posts/config.js +5 -0
  198. package/src/components/recent-posts/recent-posts.html +85 -0
  199. package/src/components/recent-posts/recent-posts.js +89 -0
  200. package/src/components/recent-posts/recent-posts.json +258 -0
  201. package/src/components/recent-posts/recent-posts.scss +274 -0
  202. package/src/components/reviews-slider/config.js +5 -0
  203. package/src/components/reviews-slider/reviews-slider-data.json +30 -0
  204. package/src/components/reviews-slider/reviews-slider.html +48 -0
  205. package/src/components/reviews-slider/reviews-slider.js +86 -0
  206. package/src/components/reviews-slider/reviews-slider.scss +92 -0
  207. package/src/components/service-counter/config.js +5 -0
  208. package/src/components/service-counter/service-counter-data.json +24 -0
  209. package/src/components/service-counter/service-counter.html +19 -0
  210. package/src/components/service-counter/service-counter.js +23 -0
  211. package/src/components/service-counter/service-counter.scss +171 -0
  212. package/src/components/service-image-counter/config.js +5 -0
  213. package/src/components/service-image-counter/service-image-counter-data.json +52 -0
  214. package/src/components/service-image-counter/service-image-counter.html +30 -0
  215. package/src/components/service-image-counter/service-image-counter.js +23 -0
  216. package/src/components/service-image-counter/service-image-counter.scss +114 -0
  217. package/src/components/tabs/config.js +5 -0
  218. package/src/components/tabs/tabs-component.js +45 -0
  219. package/src/components/tabs/tabs.html +28 -0
  220. package/src/components/tabs/tabs.scss +399 -0
  221. package/src/components/text-only/config.js +5 -0
  222. package/src/components/text-only/text-only-data.json +4 -0
  223. package/src/components/text-only/text-only.html +8 -0
  224. package/src/components/text-only/text-only.js +20 -0
  225. package/src/components/text-only/text-only.scss +21 -0
  226. package/src/components/top-banner/config.js +5 -0
  227. package/src/components/top-banner/top-banner.html +22 -0
  228. package/src/components/top-banner/top-banner.js +50 -0
  229. package/src/components/top-banner/top-banner.scss +132 -0
  230. package/src/config.js +38 -0
@@ -0,0 +1,23 @@
1
+ import html from './homepage-banner.html';
2
+ import './homepage-banner.scss';
3
+
4
+ class HomepageBanner extends GHComponent {
5
+ constructor() {
6
+ super();
7
+ }
8
+
9
+ async onServerRender() {
10
+ this.ghId = this.getAttribute('data-gh-id') || null;
11
+
12
+ this.json = await super.getGhData(this.ghId);
13
+
14
+ this.list = this.json.list;
15
+
16
+ this.image = this.json.image;
17
+
18
+ super.render(html);
19
+ }
20
+
21
+ }
22
+
23
+ window.customElements.define('homepage-banner', HomepageBanner);
@@ -0,0 +1,147 @@
1
+ homepage-banner {
2
+ background-color: var(--primary-bg-color);
3
+ display: block;
4
+ .banner_list {
5
+ color: var(--subtitle-color);
6
+ margin-bottom: 30px;
7
+ }
8
+ .flex_button {
9
+ display: flex;
10
+ gap: 20px;
11
+ }
12
+ .left {
13
+ max-width: 705px;
14
+ width: calc(100% - 588px);
15
+ }
16
+ .right {
17
+ max-width: 588px;
18
+
19
+ display: block;
20
+ transform: scale(.8);
21
+ }
22
+ .btn {
23
+ white-space: nowrap;
24
+ }
25
+ }
26
+
27
+ @media screen and (max-width: 1350px) {
28
+ homepage-banner {
29
+ .left {
30
+ max-width: 705px;
31
+ width: calc(100% / 2);
32
+ }
33
+ .right {
34
+ position: relative;
35
+ left: 0;
36
+ transform: scale(0.7);
37
+ }
38
+ }
39
+ }
40
+ @media screen and (max-width: 1200px) {
41
+ homepage-banner {
42
+ .right {
43
+ position: relative;
44
+ left: 0;
45
+ transform: scale(0.6);
46
+ }
47
+ }
48
+ }
49
+ @media screen and (max-width: 1100px) {
50
+ homepage-banner {
51
+ .right {
52
+ position: relative;
53
+ left: 40px;
54
+ transform: scale(0.55);
55
+ }
56
+ }
57
+ }
58
+ @media screen and (max-width: 1024px) {
59
+ homepage-banner {
60
+ .flex-wrapper {
61
+ flex-direction: column;
62
+ }
63
+ .left, .right {
64
+ width: 100%;
65
+ max-width: 100%;
66
+ }
67
+ .right {
68
+ margin-top: 20px;
69
+ display: flex;
70
+ justify-content: center;
71
+ position: relative;
72
+ height: 360px;
73
+ }
74
+ #gwd-ad {
75
+ position: absolute;
76
+ top: -90px;
77
+ left: calc(50% - 490px);
78
+ }
79
+ }
80
+ }
81
+ @media screen and (max-width: 600px) {
82
+ homepage-banner {
83
+ .flex_button {
84
+ flex-direction: column;
85
+ .btn {
86
+ text-align: center;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ @media screen and (max-width: 560px) {
92
+ homepage-banner {
93
+ .right {
94
+ transform: scale(.5);
95
+ left: -100px;
96
+ }
97
+ #gwd-ad {
98
+ left: calc(50% - 220px);
99
+ }
100
+ }
101
+ }
102
+
103
+ @media screen and (max-width: 470px) {
104
+ homepage-banner {
105
+ .right {
106
+ transform: scale(.45);
107
+ height: 295px;
108
+ }
109
+ #gwd-ad {
110
+ top: -120px;
111
+ left: calc(50% - 200px);
112
+ }
113
+ }
114
+ }
115
+ @media screen and (max-width: 420px) {
116
+ homepage-banner {
117
+ .right {
118
+ transform: scale(.4);
119
+ height: 255px;
120
+ }
121
+ #gwd-ad {
122
+ top: -140px;
123
+ left: calc(50% - 170px);
124
+ }
125
+ }
126
+ }
127
+ @media screen and (max-width: 385px) {
128
+ homepage-banner {
129
+ .right {
130
+ transform: scale(.35);
131
+ height: 230px;
132
+ left: -90px;
133
+ }
134
+ }
135
+ }
136
+ @media screen and (max-width: 360px) {
137
+ homepage-banner {
138
+ .right {
139
+ transform: scale(.3);
140
+ height: 200px;
141
+ left: -84px;
142
+ }
143
+ #gwd-ad {
144
+ top: -150px;
145
+ }
146
+ }
147
+ }
@@ -0,0 +1,5 @@
1
+ export const imageComponent = {
2
+ tag: 'image-component',
3
+ src: '@gudhub/ssg-web-component-library/src/components/image-component/config.js',
4
+ serverOnly: false
5
+ }
@@ -0,0 +1,25 @@
1
+ <picture data-natural-width="${imageWidth}">
2
+ ${ (imageWidth < 1200) && (imageWidth > 600) ? `
3
+ <source media="(min-width: 600px)" srcset="${path}${extension}.webp" type="image/webp">
4
+ <source media="(min-width: 600px)" srcset="${path}${extension}" type="image/${extension.substring(1, extension.length)}">
5
+ ` : ''}
6
+ ${ imageWidth > 600 ? `
7
+ <source media="(max-width: 600px)" srcset="${path}-600${extension}.webp" type="image/webp">
8
+ ` : ''}
9
+ ${ imageWidth > 1200 ? `
10
+ <source media="(max-width: 1200px)" srcset="${path}-1200${extension}.webp" type="image/webp">
11
+ <source media="(min-width: 1200px)" srcset="${path}${extension}.webp" type="image/webp">
12
+ ` : ''}
13
+ ${ imageWidth > 600 ? `
14
+ <source media="(max-width: 600px)" srcset="${path}-600${extension}" type="image/${extension.substring(1, extension.length)}">
15
+ ` : ''}
16
+ ${ imageWidth > 1200 ? `
17
+ <source media="(max-width: 1200px)" srcset="${path}-1200${extension}" type="image/${extension.substring(1, extension.length)}">
18
+ <source media="(min-width: 1200px)" srcset="${path}${extension}" type="image/${extension.substring(1, extension.length)}">
19
+ ` : ''}
20
+ ${ imageWidth <= 600 ? `
21
+ <source srcset="${src}" type="image/${src.split('.')[src.split('.').length - 1]}" />
22
+ ` : ''}
23
+ <source srcset="${src}.webp" type="image/webp">
24
+ <img src="${src}" ${ title ? `title="${title}"` : '' } ${ alt ? `alt="${alt}"` : '' } ${ lazyload ? 'loading="lazy"' : '' } ${ width ? `width="${width}"` : '' } ${ height ? `height="${height}"` : '' } >
25
+ </picture>
@@ -0,0 +1,107 @@
1
+ import html from './image-component.html';
2
+
3
+ class ImageComponent extends GHComponent {
4
+ /*
5
+ * src - path to static image
6
+ * alt - alternative text
7
+ * title - title
8
+ * lazyload - if image must have loading="lazy"
9
+ * dataSrc - url to image on gudhub (for dynamic images like a thumbnail of articles)
10
+ * dataUrl - path to place where image from dataSrc will be save (for dynamic images like a thumbnail of articles)
11
+ * data-rerender - for rerendering this component on client
12
+ * width - width
13
+ * height - height
14
+ */
15
+ constructor() {
16
+ super();
17
+ }
18
+
19
+ async onServerRender() {
20
+ await this.render('server')
21
+
22
+ }
23
+ async onClientReady() {
24
+ if (this.hasAttribute('data-rerender')) {
25
+ await this.render('client')
26
+ }
27
+ }
28
+ async render (caller) {
29
+ this.src = this.getAttribute('src');
30
+ this.alt = this.getAttribute('alt');
31
+ this.title = this.getAttribute('title');
32
+ this.lazyload = this.hasAttribute('lazyload');
33
+ this.dataSrc = this.getAttribute('data-src');
34
+ this.dataUrl = this.getAttribute('data-url');
35
+
36
+ this.width = this.hasAttribute('width') ? this.getAttribute('width') : false;
37
+ this.height = this.hasAttribute('height') ? this.getAttribute('height') : false;
38
+ // Download image from gudhub (this.dataUrl ) to cache (this.dataSrc)
39
+ await new Promise(async (resolve) => {
40
+ if(this.dataSrc && this.dataUrl && !window.disableImagesRegeneration) {
41
+ await fetch(this.dataSrc + '?source=' + this.dataUrl + '&mode=ssr');
42
+ this.src = this.dataSrc;
43
+ resolve();
44
+ } else {
45
+ if(this.src) {
46
+ await fetch(this.src + '?mode=ssr');
47
+ resolve();
48
+ }
49
+ }
50
+ })
51
+
52
+ await new Promise(async (resolve) => {
53
+ // Use new Image to have ability get params like from real image, for example naturalWidth
54
+ this.image = new Image();
55
+
56
+ this.image.addEventListener('load', () => {
57
+ const srcHasParams = this.image.getAttribute('src').indexOf('?') !== -1;
58
+ let src = srcHasParams ? this.image.getAttribute('src').substring(0, image.getAttribute('src').indexOf('?')) : this.image.getAttribute('src');
59
+ if(src.indexOf('&') !== -1) {
60
+ src = src.substring(0, src.indexOf('&'))
61
+ }
62
+ this.extension = src.substring(src.lastIndexOf('.'), src.length);
63
+ this.path = src.substring(0, src.length - this.extension.length);
64
+
65
+ this.imageWidth = this.image.naturalWidth;
66
+ resolve();
67
+ });
68
+
69
+ this.image.setAttribute('src', this.src);
70
+ })
71
+ caller == 'client' ? this.clientRender() : super.render(html);
72
+ }
73
+
74
+ clientRender() {
75
+ this.innerHTML = /*html*/`
76
+ <picture data-natural-width="${this.imageWidth}">
77
+ ${ (this.imageWidth < 1200) && (this.imageWidth > 600) ? `
78
+ <source media="(min-width: 600px)" srcset="${this.path}${this.extension}.webp" type="image/webp">
79
+ <source media="(min-width: 600px)" srcset="${this.path}${this.extension}" type="image/${this.extension.substring(1, this.extension.length)}">
80
+ ` : ''}
81
+ ${ this.imageWidth > 600 ? `
82
+ <source media="(max-width: 600px)" srcset="${this.path}-600${this.extension}.webp" type="image/webp">
83
+ ` : ''}
84
+ ${ this.imageWidth > 1200 ? `
85
+ <source media="(max-width: 1200px)" srcset="${this.path}-1200${this.extension}.webp" type="image/webp">
86
+ <source media="(min-width: 1200px)" srcset="${this.path}${this.extension}.webp" type="image/webp">
87
+ ` : ''}
88
+ ${ this.imageWidth > 600 ? `
89
+ <source media="(max-width: 600px)" srcset="${this.path}-600${this.extension}" type="image/${this.extension.substring(1, this.extension.length)}">
90
+ ` : ''}
91
+ ${ this.imageWidth > 1200 ? `
92
+ <source media="(max-width: 1200px)" srcset="${this.path}-1200${this.extension}" type="image/${this.extension.substring(1, this.extension.length)}">
93
+ <source media="(min-width: 1200px)" srcset="${this.path}${this.extension}" type="image/${this.extension.substring(1, this.extension.length)}">
94
+ ` : ''}
95
+ ${ this.imageWidth <= 600 ? `
96
+ <source srcset="${this.src}" type="image/${this.src.split('.')[this.src.split('.').length - 1]}" />
97
+ ` : ''}
98
+ <source srcset="${this.src}.webp" type="image/webp">
99
+ <img src="${this.src}" ${ this.title ? `title="${this.title}"` : '' } ${ this.alt ? `alt="${this.alt}"` : '' } ${ this.lazyload ? 'loading="lazy"' : '' } ${ this.width ? `width="${this.width}"` : '' } ${ this.height ? `height="${this.height}"` : '' } >
100
+ </picture>
101
+ `;
102
+ }
103
+ }
104
+
105
+ if(!window.customElements.get('image-component')) {
106
+ window.customElements.define('image-component', ImageComponent);
107
+ }
@@ -0,0 +1,5 @@
1
+ export const listTextAndMedia = {
2
+ tag: 'list-text-and-media',
3
+ src: '@gudhub/ssg-web-component-library/src/components/list-text-and-media/list-text-and-media.js',
4
+ serverOnly: false
5
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "title": "Title",
3
+ "subtitle": "Subtitle",
4
+ "items": [
5
+ {
6
+ "title": "Item Title",
7
+ "subtitle": "Item Subtitle",
8
+ "link": "#",
9
+ "link_text": "link_text",
10
+ "image": {
11
+ "src": "/assets/images/placeholder392x324.png",
12
+ "alt": "Item Title",
13
+ "title": "Item Title"
14
+ },
15
+ "text_list": [
16
+ "Vestibulum eget pretium mi",
17
+ "In fringilla ultrices aliquet",
18
+ "Donec non metus consectetur"
19
+ ]
20
+ },
21
+ {
22
+ "title": "Item Title",
23
+ "subtitle": "Item Subtitle",
24
+ "link": "#",
25
+ "link_text": "link_text",
26
+ "image": {
27
+ "src": "/assets/images/placeholder392x324.png",
28
+ "alt": "Item Title",
29
+ "title": "Item Title"
30
+ },
31
+ "text_list": [
32
+ "Vestibulum eget pretium mi",
33
+ "In fringilla ultrices aliquet",
34
+ "Donec non metus consectetur"
35
+ ]
36
+ },
37
+ {
38
+ "title": "Item Title",
39
+ "subtitle": "Item Subtitle",
40
+ "link": "#",
41
+ "link_text": "link_text",
42
+ "image": {
43
+ "src": "/assets/images/placeholder392x324.png",
44
+ "alt": "Item Title",
45
+ "title": "Item Title"
46
+ },
47
+ "text_list": [
48
+ "Vestibulum eget pretium mi",
49
+ "In fringilla ultrices aliquet",
50
+ "Donec non metus consectetur"
51
+ ]
52
+ },
53
+ {
54
+ "title": "Item Title",
55
+ "subtitle": "Item Subtitle",
56
+ "link": "#",
57
+ "link_text": "link_text",
58
+ "image": {
59
+ "src": "/assets/images/placeholder392x324.png",
60
+ "alt": "Item Title",
61
+ "title": "Item Title"
62
+ },
63
+ "text_list": [
64
+ "Vestibulum eget pretium mi",
65
+ "In fringilla ultrices aliquet",
66
+ "Donec non metus consectetur"
67
+ ]
68
+ }
69
+ ]
70
+ }
@@ -0,0 +1,38 @@
1
+ <section class="list-text-and-media">
2
+ <div class="container">
3
+ ${json.title ? `
4
+ <h2 gh-id="${ghId}.title"> TITLE </h2>
5
+ ` : ''}
6
+ ${json.subtitle ? `
7
+ <p class="subtitle" gh-id="${ghId}.subtitle"> SUBTITLE </p>
8
+ ` : ''}
9
+ <div class="list flex-wrapper">
10
+ ${items.reduce((acc, item, index) => acc + `
11
+ <a href="${item.link}" class="list_item flex-wrapper">
12
+ <div class="text">
13
+ <div class="top">
14
+ <h3>${item.title}</h3>
15
+ <p class="subtitle">${item.subtitle}</p>
16
+ ${item.text_list && item.text_list.length > 0 ? `
17
+ <ul class="text-list">
18
+ ${item.text_list.reduce((acc, text) => acc + `
19
+ <li>${text}</li>
20
+ `, '')}
21
+ </ul>
22
+ ` : ''}
23
+ </div>
24
+ <div class="bottom">
25
+ <div class="link">
26
+ <span>${item.link_text}</span>
27
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="21" viewBox="0 0 20 21" fill="none"><circle cx="10" cy="10.6282" r="10" fill="#0A79FE"/><path d="M8.25 6.62817L12 10.3782L8.25 14.1282" stroke="white"/></svg>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ <div class="media">
32
+ <image-component lazyload src="${item.image.src}" alt="${item.image.alt}" title="${item.image.title}" width="392" height="324"></image-component>
33
+ </div>
34
+ </a>
35
+ `, '')}
36
+ </div>
37
+ </div>
38
+ </section>
@@ -0,0 +1,22 @@
1
+ import html from './list-text-and-media.html';
2
+ import './list-text-and-media.scss';
3
+ import jsonTemplate from './list-text-and-media-data.json';
4
+ class ListMediaAndText extends GHComponent {
5
+
6
+ constructor() {
7
+ super();
8
+ super.setDefaultData(jsonTemplate);
9
+ }
10
+
11
+ async onServerRender() {
12
+ this.ghId = this.getAttribute('data-gh-id') || null;
13
+
14
+ this.json = await super.getGhData(this.ghId);
15
+
16
+ this.items = this.json.items;
17
+
18
+ super.render(html);
19
+ }
20
+ }
21
+
22
+ window.customElements.define('list-text-and-media', ListMediaAndText);
@@ -0,0 +1,30 @@
1
+ # Attributes:
2
+
3
+ none
4
+
5
+ # Component data-object:
6
+ ("?" means "unnecessary")
7
+ ```json
8
+ {
9
+ "title?": "Title",
10
+ "subtitle?": "Subtitle",
11
+ "items": [
12
+ {
13
+ "title": "Item Title",
14
+ "subtitle": "Item Subtitle",
15
+ "link": "#",
16
+ "link_text": "link_text",
17
+ "image": {
18
+ "src": "/assets/images/placeholder392x324.png",
19
+ "alt": "Item Title",
20
+ "title": "Item Title"
21
+ },
22
+ "text_list": [
23
+ "Vestibulum eget pretium mi",
24
+ "In fringilla ultrices aliquet",
25
+ "Donec non metus consectetur"
26
+ ]
27
+ }
28
+ ]
29
+ }
30
+ ```
@@ -0,0 +1,156 @@
1
+ list-text-and-media {
2
+ background: var(--primary-bg-color);
3
+ .subtitle{
4
+ text-align: center;
5
+ }
6
+ .list {
7
+ flex-direction: column;
8
+ gap: 50px;
9
+ h2 {
10
+ margin-bottom: 0;
11
+ }
12
+ .subtitle {
13
+ margin-bottom: 0;
14
+ }
15
+ &_item {
16
+ gap: 20px;
17
+ color: var(--block-primary-text-color);
18
+ &:nth-child(even) {
19
+ flex-direction: row-reverse;
20
+ }
21
+ .text, .media {
22
+ border-radius: 20px;
23
+ }
24
+ .subtitle {
25
+ color: inherit;
26
+ }
27
+ .text {
28
+ display: flex;
29
+ flex-direction: column;
30
+ justify-content: space-between;
31
+ align-items: flex-start;
32
+ flex-grow: 0;
33
+ flex-shrink: 1;
34
+ gap: 20px;
35
+ width: 100%;
36
+ padding: 30px;
37
+ background-color: var(--block-primary-bg-color);
38
+ transition: background-color .3s ease;
39
+ .top {
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: 20px;
43
+ .subtitle {
44
+ text-align: left;
45
+ }
46
+ .text-list {
47
+ padding-left: 20px;
48
+ line-height: 140%;
49
+ font-size: var(--h2-subtitle-font-size);
50
+ li:not(:last-child) {
51
+ margin-bottom: 10px;
52
+ }
53
+ }
54
+ h3 {
55
+ color: var(--block-primary-h-color);
56
+ margin-bottom: 0;
57
+ }
58
+ }
59
+ .bottom {
60
+ .link {
61
+ padding: 10px 0;
62
+ font-size: var(--text-font-size);
63
+ font-weight: 700;
64
+ color: var(--block-primary-h-color);
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 10px;
68
+ transition: color .3s ease;
69
+ svg {
70
+ position: relative;
71
+ left: 0;
72
+ transition: all .2s ease;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ .media {
78
+ flex-grow: 1;
79
+ flex-shrink: 0;
80
+ overflow: hidden;
81
+ height: min-content;
82
+
83
+ img {
84
+ background-color: var(--image-bg-color);
85
+ }
86
+ }
87
+ &:hover {
88
+ .text {
89
+ background-color: var(--tertiary-bg-color);
90
+ }
91
+ .bottom .link {
92
+ color: var(--primary-color);
93
+ svg {
94
+ left: 10px;
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ @media screen and (max-width: 1025px) and (min-width: 870px) {
102
+ .list {
103
+ flex-direction: row;
104
+ flex-wrap: wrap;
105
+ gap: 20px;
106
+ .list_item {
107
+ flex-direction: column;
108
+ justify-content: space-between;
109
+ align-items: center;
110
+ background-color: var(--block-primary-bg-color);
111
+ padding: 20px;
112
+ border-radius: 20px;
113
+ max-width: calc(50% - 25px);
114
+ .text {
115
+ padding: 0;
116
+ height: 100%;
117
+ }
118
+ .media {
119
+ flex-grow: 0;
120
+ border-radius: 15px;
121
+ }
122
+ &:hover {
123
+ background-color: var(--tertiary-bg-color);
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+ @media screen and (max-width: 870px) {
130
+ .list {
131
+ max-width: 500px;
132
+ margin: auto;
133
+ align-items: center;
134
+ gap: 20px;
135
+ .list_item {
136
+ width: 100%;
137
+ flex-direction: column;
138
+ align-items: center;
139
+ background-color: var(--block-primary-bg-color);
140
+ padding: 20px;
141
+ border-radius: 20px;
142
+ .text {
143
+ padding: 0;
144
+ height: 100%;
145
+ }
146
+ .media {
147
+ flex-grow: 0;
148
+ border-radius: 15px;
149
+ }
150
+ &:hover {
151
+ background-color: var(--tertiary-bg-color);
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,5 @@
1
+ export const mediaAndAccordion = {
2
+ tag: 'media-and-accordion',
3
+ src: '@gudhub/ssg-web-component-library/src/components/media-and-accordion/media-and-accordion.js',
4
+ serverOnly: false
5
+ }