Skip to content

Commit

Permalink
#40 - Randomize logos
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianbinau committed Oct 18, 2023
1 parent f47b5d1 commit b76ef67
Show file tree
Hide file tree
Showing 7 changed files with 15,524 additions and 1 deletion.
2,584 changes: 2,584 additions & 0 deletions public/images/special/logo_blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,584 changes: 2,584 additions & 0 deletions public/images/special/logo_clay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,584 changes: 2,584 additions & 0 deletions public/images/special/logo_lime.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,584 changes: 2,584 additions & 0 deletions public/images/special/logo_sick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,584 changes: 2,584 additions & 0 deletions public/images/special/logo_slate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,584 changes: 2,584 additions & 0 deletions public/images/special/logo_spots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion src/layouts/NavBarSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ const user = Astro.locals.user as User;
const userInitials = getInitialsByName(user.name);
const userColor = getUserColorByInitials(userInitials);
// Randomize logo
let logo = 'logo_name.svg';
const specials = [
'special/logo_blue.svg',
'special/logo_clay.svg',
'special/logo_lime.svg',
'special/logo_sick.svg',
'special/logo_slate.svg',
'special/logo_spots.svg',
];
if (Math.random() >= 0.5) {
const special = specials[Math.floor(Math.random() * specials.length)];
if (special) {
logo = special;
}
}
---

<nav
Expand Down Expand Up @@ -47,7 +66,7 @@ const userColor = getUserColorByInitials(userInitials);
>
</button>
<a href="/" class="md:mr-18 ml-2 flex">
<img src={asset('images/logo_name.svg')} class="mr-3 h-5" alt="Logo" />
<img src={asset(`images/${logo}`)} class="mr-3 h-5" alt="Logo" />
</a>
</div>

Expand Down

0 comments on commit b76ef67

Please sign in to comment.