Advertisement
Guest User

static-header original

a guest
Nov 18th, 2019
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.21 KB | None | 0 0
  1. {% assign s = section.settings %}
  2. {% assign links = linklists[s.menu].links %}
  3. {% assign quick_links = linklists[s.search_quick_links].links %}
  4.  
  5.  
  6. <script>
  7. window.theme.quickCartNote = "{{ settings.quick_cart_note }}";
  8.  
  9. window.theme.logoFont = {
  10. fontFamily: {{ settings.font_logo.family | json }},
  11. fontSize: "{{ settings.font_logo_size }}px",
  12. fontWeight: "{{ settings.font_logo.weight }}",
  13. fontStyle: "{{ settings.font_logo.style }}"
  14. }
  15. </script>
  16.  
  17. <section
  18. data-component="header"
  19. data-section-id="{{ section.id }}"
  20. data-section-type="header"
  21. class="bg-base w-100 z-5"
  22. data-quicklinks='
  23. [
  24. {%- for link in quick_links -%}
  25. {
  26. "title": "{{ link.title | escape }}",
  27. "url": "{{ link.url }}"
  28. }
  29. {% if forloop.last == false %},{% endif %}
  30. {%- endfor -%}
  31. ]
  32. '
  33. data-navigation='
  34. [
  35. {%- for link in links -%}
  36. {
  37. "active": "{{ link.active }}",
  38. "child_active": "{{ link.child_active }}",
  39. "current": "{{ link.current }}",
  40. "child_current": "{{ link.child_current }}",
  41. "levels": "{{ link.levels }}",
  42. "links": [
  43. {%- for child in link.links -%}
  44. {
  45. "active": "{{ child.active }}",
  46. "child_active": "{{ child.child_active }}",
  47. "current": "{{ child.current }}",
  48. "child_current": "{{ child.child_current }}",
  49. "levels": "{{ child.levels }}",
  50.  
  51. "links": [
  52. {%- for grandchild in child.links -%}
  53. {
  54. "active": "{{ grandchild.active }}",
  55. "child_active": "{{ grandchild.child_active }}",
  56. "current": "{{ grandchild.current }}",
  57. "child_current": "{{ grandchild.child_current }}",
  58. "levels": "{{ grandchild.levels }}",
  59. "object": "{{ grandchild.object }}",
  60. "title": "{{ grandchild.title | escape }}",
  61. "type": "{{ grandchild.type }}",
  62. "url": "{{ grandchild.url }}"
  63. }
  64. {% if forloop.last == false %},{% endif %}
  65. {%- endfor -%}
  66. ],
  67. "object": "{{ child.object }}",
  68. "title": "{{ child.title | escape }}",
  69. "type": "{{ child.type }}",
  70. "url": "{{ child.url }}"
  71. }
  72. {% if forloop.last == false %},{% endif %}
  73. {%- endfor -%}
  74. ],
  75. "object": "{{ link.object }}",
  76. "title": "{{ link.title | escape }}",
  77. "type": "{{ link.type }}",
  78. "url": "{{ link.url }}"
  79. }
  80.  
  81. {% if forloop.last == false %},{% endif %}
  82. {%- endfor -%}
  83. ]
  84. '
  85. >
  86. {%- if s.announcement_bar_enabled -%}
  87. <div class="announcement-bar">
  88. {%- if s.announcement_bar_link != blank -%}
  89. <a class="color-inherit" href="{{ s.announcement_bar_link }}">
  90. {{ s.announcement_bar_text | escape }}
  91. </a>
  92. {%- else -%}
  93. {{ s.announcement_bar_text | escape }}
  94. {%- endif -%}
  95. </div>
  96. {%- endif -%}
  97.  
  98. <header
  99. class="header bb b--default"
  100. data-transparent-header="{{ s.transparent_header_enabled }}"
  101. >
  102. <div class="header__content">
  103. {% comment %} React {% endcomment %}
  104. <div
  105. id="mobile-nav"
  106. {% unless s.transparent_header_enabled and template.name == 'index' %}
  107. {% if settings.color_header_icon %}
  108. style="color: {{ settings.color_header_icon }};"
  109. {% endif %}
  110. {% endunless %}
  111. ></div>
  112. <h1>
  113. <a href="/" class="header__logo-image color-inherit">
  114.  
  115. {% if template.name == 'index' and s.transparent_header_enabled and s.transparent_header_logo != blank %}
  116. {% capture image_size %}{{ s.logo_max_width }}x{% endcapture %}
  117. <img src="{{ s.transparent_header_logo | img_url: image_size }}"
  118. srcset="{{ s.transparent_header_logo | img_url: image_size }} 1x, {{ s.transparent_header_logo | img_url: image_size, scale: 2 }} 2x"
  119. alt="{{ s.transparent_header_logo.alt | default: shop.name }}">
  120.  
  121. {% else %}
  122.  
  123. {% if s.logo != blank %}
  124. {% capture image_size %}{{ s.logo_max_width }}x{% endcapture %}
  125. <img src="{{ s.logo | img_url: image_size }}"
  126. srcset="{{ s.logo | img_url: image_size }} 1x, {{ s.logo | img_url: image_size, scale: 2 }} 2x"
  127. alt="{{ s.logo.alt | default: shop.name }}">
  128.  
  129. {% else %}
  130.  
  131. <span class="header__logo-text">{{ shop.name }}</span>
  132.  
  133. {% endif %}
  134.  
  135. {% endif %}
  136. </a>
  137. </h1>
  138.  
  139. <div class="flex justify-between" data-primary-navigation="yes">
  140. <nav class="header__nav">
  141. {%
  142. include 'navmenu' with
  143. menu: s.menu,
  144. depth: 1,
  145. max_depth: 3,
  146. blocks: section.blocks,
  147. top_level: true,
  148. has_triggers: true
  149. %}
  150. </nav>
  151. <div class="no-js-menu no-js-menu--desktop">
  152. {% include 'no-js-navmenu' with menu: s.menu %}
  153. </div>
  154.  
  155. <div class="header__icon-wrapper">
  156. <ul class="header__icon-list">
  157. <li class="header__icon header__icon--search">
  158. <noscript>
  159. <a href="/search" class="color-inherit">
  160. <div class="relative" style="width: 24px;">
  161. {% include 'icon-search' %}
  162. </div>
  163. </a>
  164. </noscript>
  165. <div id="search"></div>
  166. </li>
  167. {% if shop.customer_accounts_enabled %}
  168. <li class="header__icon header__icon--account">
  169. <a href="/account" class="color-inherit">
  170. <div class="relative" style="width: 24px;">
  171. {% include 'icon-account' %}
  172. </div>
  173. </a>
  174. </li>
  175. {% endif %}
  176. <li class="header__icon header__icon--cart">
  177. <a href="/cart" class="color-inherit js-cart-drawer-toggle">
  178. <div class="quick-cart__icon" style="width: 24px;">
  179. {% include 'icon-cart' %}
  180. <div class="quick-cart__indicator js-cart-count">
  181. {{ cart.item_count }}
  182. </div>
  183. {% include 'component-quick-cart' %}
  184. </div>
  185. </a>
  186. </li>
  187. </ul>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="no-js-menu no-js-menu--mobile">
  192. {% include 'no-js-navmenu' with menu: s.menu %}
  193. </div>
  194. </header>
  195.  
  196. </section>
  197.  
  198. {% assign proper_alpha = s.transparent_header_border_opacity | divided_by: 100.00 %}
  199.  
  200. <style>
  201. .header {
  202. {% if s.transparent_header_enabled and template.name == 'index' %}
  203. {% if s.transparent_header_foreground_color != blank %}
  204. color: {{ s.transparent_header_foreground_color }};
  205. {% endif %}
  206. {% if s.transparent_header_border_color != blank %}
  207. border-color: {{ s.transparent_header_border_color | color_modify: 'alpha', proper_alpha }}
  208. {% else %}
  209. border-color: {{ settings.color_header_border | color_modify: 'alpha', proper_alpha }}
  210. {% endif %}
  211. {% else %}
  212. color: {{ settings.color_header_text }};
  213. background-color: {{ settings.color_header_bg }};
  214. border-color: {{ settings.color_header_border }};
  215. {% endif %}
  216. }
  217.  
  218. .header__logo-text {
  219. font-size: {{ settings.font_logo_size }}px;
  220. }
  221.  
  222. .header__icon-wrapper {
  223. {% if s.transparent_header_enabled and template.name == 'index' %}
  224. {% if s.transparent_header_foreground_color %}
  225. color: {{ s.transparent_header_foreground_color }};
  226. {% endif %}
  227. {% else %}
  228. {% if settings.color_header_icon %}
  229. color: {{ settings.color_header_icon }};
  230. {% endif %}
  231. {% endif %}
  232. }
  233. </style>
  234.  
  235. {% if s.logo != blank %}
  236. <style>
  237. .header__logo-image {
  238. display: block;
  239. max-width: {{ s.logo_max_width }}px;
  240. }
  241. </style>
  242. {% endif %}
  243.  
  244. {% schema %}
  245. {
  246. "name": "Header",
  247. "settings": [
  248. {
  249. "type": "header",
  250. "content": "Announcement bar"
  251. },
  252. {
  253. "type": "checkbox",
  254. "id": "announcement_bar_enabled",
  255. "label": "Show announcement",
  256. "default": true
  257. },
  258. {
  259. "type": "text",
  260. "id": "announcement_bar_text",
  261. "label": "Announcement text",
  262. "default": "Announce something here"
  263. },
  264. {
  265. "type": "url",
  266. "id": "announcement_bar_link",
  267. "label": "Announcement link",
  268. "info": "Optional"
  269. },
  270. {
  271. "type": "header",
  272. "content": "Header"
  273. },
  274. {
  275. "type": "image_picker",
  276. "id": "logo",
  277. "label": "Logo image"
  278. },
  279. {
  280. "type": "range",
  281. "id": "logo_max_width",
  282. "min": 50,
  283. "max": 350,
  284. "step": 10,
  285. "unit": "px",
  286. "label": "Custom logo width",
  287. "default": 250
  288. },
  289. {
  290. "type": "link_list",
  291. "id": "menu",
  292. "label": "Main menu",
  293. "default": "main-menu"
  294. },
  295. {
  296. "type": "header",
  297. "content": "Transparent header"
  298. },
  299. {
  300. "type": "checkbox",
  301. "id": "transparent_header_enabled",
  302. "label": "Transparent header",
  303. "info": "The transparent header works when the first section is a Slideshow or Video section.",
  304. "default": false
  305. },
  306. {
  307. "type": "color",
  308. "id": "transparent_header_foreground_color",
  309. "label": "Text color",
  310. "info": "Only applicable if transparent header is enabled.",
  311. "default": "#ffffff"
  312. },
  313. {
  314. "type": "color",
  315. "id": "transparent_header_border_color",
  316. "label": "Border color",
  317. "info": "Only applicable if transparent header is enabled.",
  318. "default": "#ffffff"
  319. },
  320. {
  321. "type": "range",
  322. "id": "transparent_header_border_opacity",
  323. "min": 0,
  324. "max": 100,
  325. "step": 10,
  326. "unit": "%",
  327. "label": "Border opacity",
  328. "default": 50
  329. },
  330. {
  331. "type": "image_picker",
  332. "id": "transparent_header_logo",
  333. "label": "Transparent logo image"
  334. },
  335. {
  336. "type": "header",
  337. "content": "Search"
  338. },
  339. {
  340. "type": "link_list",
  341. "id": "search_quick_links",
  342. "label": "Search bar quick links",
  343. "info": "Choose a link list from your navigation settings to display in the search suggestions dropdown."
  344. }
  345. ],
  346. "blocks": [
  347. {
  348. "type": "mega_nav",
  349. "name": "Mega nav",
  350. "settings": [
  351. {
  352. "type": "text",
  353. "id": "dropdown_parent_link",
  354. "label": "Dropdown parent link",
  355. "info": "Name the link in the main menu that you'd like the Mega nav to appear from."
  356. },
  357. {
  358. "type": "image_picker",
  359. "id": "mega_nav_featured_image",
  360. "label": "Mega nav featured image"
  361. },
  362. {
  363. "type": "text",
  364. "id": "featured_image_heading",
  365. "label": "Featured image heading"
  366. },
  367. {
  368. "type": "text",
  369. "id": "featured_image_link_text",
  370. "label": "Featured image link text"
  371. },
  372. {
  373. "type": "url",
  374. "id": "featured_image_link",
  375. "label": "Featured image link"
  376. }
  377. ]
  378. }
  379. ]
  380. }
  381. {% endschema %}
  382.  
  383.  
  384. {% if template.name == 'index' %}
  385. <script type="application/ld+json">
  386. {
  387. "@context": "http://schema.org",
  388. "@type": "WebSite",
  389. "name": "{{ shop.name }}",
  390. "potentialAction": {
  391. "@type": "SearchAction",
  392. "target": "{{ shop.url }}/search?q={search_term_string}",
  393. "query-input": "required name=search_term_string"
  394. },
  395. "url": "{{ shop.url }}{{ page.url }}"
  396. }
  397. </script>
  398. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement