Skip to content

Commit

Permalink
Added lang-switcher component
Browse files Browse the repository at this point in the history
Added body footer include
  • Loading branch information
cetinajero committed May 17, 2018
1 parent ad83c19 commit 3d18d5b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
40 changes: 40 additions & 0 deletions _includes/body/footer/buttons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% if site.original -%}
{% assign classes = "col-sm-1 col-md-1" %}
{% else -%}
{% assign classes = "col-sm-6 col-md-6" %}
{% endif -%}

<div class="col-xs-12 {{ classes }}">
<a href="#" class="up">
<span class="glyphicon glyphicon-arrow-up"></span>
</a>

<a href="javascript:switchLang()" class="lang-switcher">
<span class="flag-icon flag-icon-squared" id="lang-switcher"></span>
</a>

<script type="text/javascript">
if (!window.location.href.includes('grupopv')) {
document.querySelector('.lang-switcher').classList.add('hide');
}

currentLang = document.getElementsByTagName("html")[0].getAttribute("lang");

if (currentLang == 'en') {
document.querySelector('#lang-switcher').classList.add('flag-icon-mx');
} else {
document.querySelector('#lang-switcher').classList.add('flag-icon-us');
}

function switchLang(){
if (currentLang == 'en') {
url = window.location.href.replace('localhost:4000','grupopv.mx').replace('grupopv.us','grupopv.mx');
window.location.href = url;
} else {
url = window.location.href.replace('localhost:4000','grupopv.us').replace('grupopv.mx','grupopv.us');
window.location.href = url;
}
}
</script>

</div>
16 changes: 16 additions & 0 deletions _sass/components/lang-switchers/_toogle-lang.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#footer {

a.lang-switcher {
margin-top: 30px;
display: block;
float: right;

span {
width: 40px;
height: 40px;
border-radius: 10%;
}

}

}
1 change: 1 addition & 0 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $icon-color-menu: {{ site.css.menu.icons }};
@import "common/common";

@import "components/breadcrumbs/bootstrap";
@import "components/lang-switchers/toogle-lang";
@import "components/navbars/vg_progressive";
@import "components/product-cards/3d-space";
@import "components/sidenavs/material";

1 comment on commit 3d18d5b

@cetinajero
Copy link
Owner Author

Choose a reason for hiding this comment

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

Other option with dropdown: https://codepen.io/brapastor/pen/BWyomB

Please sign in to comment.