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

update: prep work for lang switcher versioning #484

Merged
merged 4 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/css/components/_header.css
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@
.header__language-switcher .lang_list_class:after {
content: none;
}

/* V1 lang switcher updates to keep "in line" w/ v0 mobile styles */
.header__language-switcher .hs-language-switcher__menu {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these just needed for the v1? If so could we toss these in a {% if get_asset_version('@hubspot/language_switcher') == 1 %} conditional?

display: block;
box-shadow:none!important;
background: transparent;
}
.header__language-switcher .hs-language-switcher__menu a {
font-size: 20px!important;
}
.header__language-switcher .hs-language-switcher__button {
display: none;
}
}

/* Navigation */
Expand Down
170 changes: 164 additions & 6 deletions src/templates/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,164 @@
templateType: global_partial
label: Website header
-->

{% macro add_lang_siwtcher() %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of settings to get this to look similar to v0. This is because we pretty much added a million settings to the new module. These were not manually set in code but rather pulled from the page-editor using ?devMode=true. That is how I would recommend all folks pull hubl values from modules if they want to hardcode them into a template.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% macro add_lang_siwtcher() %}
{% macro add_lang_switcher() %}

{% if get_asset_version('@hubspot/language_switcher') == 1 %}
{% module "language-switcher"
path="@hubspot/language_switcher",
label="Language switcher",
display_mode="localized"
styles={
"group_button" : {
"group_alignment" : {
"alignment" : {
"horizontal_align" : "RIGHT"
}
},
"group_background" : {
"color" : {
"color" : "#000000",
"opacity" : 0
}
},
"group_border" : {
"border" : {
"bottom" : {
"style" : "none"
},
"left" : {
"style" : "none"
},
"right" : {
"style" : "none"
},
"top" : {
"style" : "none"
}
}
},
"group_chevron" : {
"color" : {
"color" : "#516d8d",
"opacity" : 100
},
"size" : 10,
"spacing" : 10
},
"group_corner" : {
"radius" : 0
},
"group_icon" : {
"color" : {
"color" : "#516d8d",
"opacity" : 100
},
"size" : 15,
"spacing" : 10
},
"group_spacing" : {
"spacing" : {
"padding" : {
"bottom" : {
"units" : "px",
"value" : 7
},
"left" : {
"units" : "px",
"value" : 15
},
"right" : {
"units" : "px",
"value" : 15
},
"top" : {
"units" : "px",
"value" : 7
}
}
}
},
"group_text" : {
"font" : {
"color" : "#516d8d",
"size" : 18,
"size_unit" : "px"
}
}
},
"group_dropdown" : {
"group_border" : {
"border" : {
"bottom" : {
"color" : "#000000",
"opacity" : 100,
"style" : "none",
"width" : {
"units" : "px",
"value" : 1
}
},
"left" : {
"color" : "#000000",
"opacity" : 100,
"style" : "none",
"width" : {
"units" : "px",
"value" : 1
}
},
"right" : {
"color" : "#000000",
"opacity" : 100,
"style" : "none",
"width" : {
"units" : "px",
"value" : 1
}
},
"top" : {
"color" : "#000000",
"opacity" : 100,
"style" : "none",
"width" : {
"units" : "px",
"value" : 1
}
}
}
},
"group_box_shadow" : {
"add_box_shadow" : true
},
"group_hover" : {
"group_background" : {
"color" : {
"color" : "#f8fafc",
"opacity" : 100
}
}
},
"group_text" : {
"font" : {
"color" : "#516d8d",
"size" : 16,
"size_unit" : "px"
}
}
}
},
add_chevron_down=true,
icon_options="icon"
%}
{% else %}
{% module "language-switcher"
path="@hubspot/language_switcher",
label="Language switcher",
display_mode="localized"
%}
<div class="header__language-switcher--label-current"> {{ locale_name(locale) }}</div>
{% endif %}
{% endmacro %}
<header class="header">

{# The link below is used for a navigation skipper which allows users navigating the site with their keyboard to skip over the site navigation. More information on the navigation skipper can be found here: https://github.com/HubSpot/cms-theme-boilerplate/wiki/Accessibility #}
Expand Down Expand Up @@ -37,16 +195,16 @@

{# Header navigation row one #}



<div class="header__row-1">
{% if content.translated_content.values()|selectattr("published")|length or is_listing_view and group.translations %}
<div class="header__language-switcher header--element">
<div class="header__language-switcher--label">
{% module "language-switcher"
path="@hubspot/language_switcher",
label="Language switcher",
display_mode="localized"
%}
<div class="header__language-switcher--label-current"> {{ locale_name(locale) }}</div>

{{ add_lang_siwtcher() }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{ add_lang_siwtcher() }}
{{ add_lang_switcher() }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahaha thank god VS code keeps things consistent.



</div>
</div>
{% endif %}
Expand Down