Skip to content

Commit 1e7e6a2

Browse files
committed
upldate logo setting on mobile
1 parent 175d4b5 commit 1e7e6a2

File tree

3 files changed

+48
-72
lines changed

3 files changed

+48
-72
lines changed

assets/scss/_custom.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,31 @@ body.has-notice {
928928
}
929929
}
930930

931+
// Logo responsive styles
932+
.logo {
933+
a {
934+
display: block;
935+
}
936+
937+
.desktop-logo {
938+
display: block;
939+
}
940+
941+
.mobile-logo {
942+
display: none;
943+
}
944+
945+
@media (max-width: 390px) {
946+
.desktop-logo {
947+
display: none;
948+
}
949+
950+
.mobile-logo {
951+
display: block;
952+
}
953+
}
954+
}
955+
931956
@keyframes fadeIn {
932957
from {
933958
opacity: 0;

config/_default/params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ plugins:
1313
- link: plugins/youmax/youmax.js
1414
- link: plugins/bootstrap-select/js/bootstrap-select.min.js
1515
logo: images/logo.png
16-
logo_width: 200px
16+
mobileLogo: images/logo-big.png
1717
themeVariant: quizdown
1818
description: The InnerSource Commons is a growing community of practitioners with the goal of creating and sharing knowledge about InnerSource.
1919
author: InnerSource Commons

layouts/partials/header.html

Lines changed: 22 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
<div class="logo">
2020
<a href='{{ if eq .Site.Language.Lang "en" }}{{ site.BaseURL }}{{ else }}{{ site.BaseURL }}{{ .Site.Language.Lang }}{{end}}'
2121
title="{{ site.Title }}" style="border-bottom: 0px solid #e0e0e0;">
22-
<img width="{{ site.Params.logo_width}}" src="{{ site.Params.logo | absURL }}" alt="{{ site.Title }}">
22+
<img src="{{ site.Params.logo | absURL }}" alt="{{ site.Title }}" class="desktop-logo">
23+
<img src="{{ site.Params.mobileLogo | default site.Params.logo | absURL }}" alt="{{ site.Title }}" class="mobile-logo">
2324
</a>
2425
</div>
2526

@@ -209,76 +210,6 @@ <h4>{{ .title }}</h4>
209210
</div>
210211
</header>
211212

212-
<style>
213-
@keyframes spin {
214-
from { transform: rotate(0deg); }
215-
to { transform: rotate(360deg); }
216-
}
217-
218-
@keyframes pulse {
219-
0% { transform: scale(1); }
220-
50% { transform: scale(1.5); }
221-
100% { transform: scale(1); }
222-
}
223-
224-
.slack-icon-pulse {
225-
display: inline-block;
226-
animation: pulse 1.5s infinite ease-in-out;
227-
vertical-align: middle;
228-
}
229-
230-
.btn-outline-primary {
231-
box-shadow: none !important;
232-
}
233-
234-
.btn-outline-primary:hover,
235-
.btn-outline-primary:active,
236-
.btn-outline-primary:focus {
237-
box-shadow: none !important;
238-
outline: none !important;
239-
border: 0 !important;
240-
}
241-
242-
.btn-outline-primary:hover .slack-icon-pulse {
243-
animation: pulse 0.8s infinite ease-in-out;
244-
}
245-
246-
.language-selector {
247-
display: inline-block;
248-
margin-right: 10px;
249-
}
250-
251-
.language-selector select {
252-
padding: 6px 12px;
253-
border: 1px solid #ddd;
254-
border-radius: 4px;
255-
background-color: white;
256-
cursor: pointer;
257-
min-width: 100px;
258-
width: 100px;
259-
}
260-
261-
.header-cta {
262-
display: flex;
263-
align-items: center;
264-
}
265-
266-
.header-cta .search-wrapper {
267-
flex-grow: 1;
268-
}
269-
270-
.header-cta .search-wrapper input {
271-
width: 100%;
272-
min-width: 200px;
273-
}
274-
275-
.header-cta .search-wrapper input:focus {
276-
border-color: #0aa8a7;
277-
box-shadow: 0 0 0 0.2rem rgba(0, 160, 160, 0.25);
278-
outline: none;
279-
}
280-
</style>
281-
282213
<script>
283214
document.addEventListener('DOMContentLoaded', function () {
284215
const hamburger = document.querySelector('.hamburger');
@@ -325,6 +256,26 @@ <h4>{{ .title }}</h4>
325256
menu.classList.toggle('is-active');
326257
});
327258

259+
// Logo switching function for resize events
260+
const checkLogoDisplay = function() {
261+
const desktopLogo = document.querySelector('.desktop-logo');
262+
const mobileLogo = document.querySelector('.mobile-logo');
263+
264+
if (window.innerWidth <= 390) {
265+
if (desktopLogo) desktopLogo.style.display = 'none';
266+
if (mobileLogo) mobileLogo.style.display = 'block';
267+
} else {
268+
if (desktopLogo) desktopLogo.style.display = 'block';
269+
if (mobileLogo) mobileLogo.style.display = 'none';
270+
}
271+
};
272+
273+
// Initial check
274+
checkLogoDisplay();
275+
276+
// Check on resize
277+
window.addEventListener('resize', checkLogoDisplay);
278+
328279
if (isMobile) {
329280
subMenuParents.forEach(item => {
330281
item.addEventListener('click', function (e) {

0 commit comments

Comments
 (0)