Skip to content

Commit

Permalink
Update header implementation for upcoming Discourse changes (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq authored Apr 12, 2024
1 parent 31cb6a1 commit 9d4b853
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 60 deletions.
8 changes: 2 additions & 6 deletions common/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ p.footer-donation {
padding: 5px 10px;
}

@include at-least(screen-sm-min){
@include at-least(screen-sm-min) {
.trending-guides-row {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -443,12 +443,8 @@ body.no-ember {
}

a.curriculum-nav {
z-index: 1000;
color: white;
position: fixed;
padding: 0 10px;
left: 15px;
margin-top: -19px;
height: $--global-nav-height;
display: flex;
align-items: center;
Expand Down Expand Up @@ -827,7 +823,7 @@ div.select-kit-header {
margin-top: calc(-1rem - #{$--global-nav-height} * 2);
}

@include at-least(screen-md-min) {
@include at-least(screen-md-min) {
.anchor {
padding-top: calc(#{$--global-nav-height} + 1rem);
margin-top: calc(-1rem - #{$--global-nav-height});
Expand Down
54 changes: 0 additions & 54 deletions common/header.html

This file was deleted.

27 changes: 27 additions & 0 deletions javascripts/discourse/api-initializers/freecodecamp.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer("0.8", (api) => {
const siteSettings = api.container.lookup("service:site-settings");
const rawLabel = api.container.lookup("service:site").mobileView
? settings.curriculum_title_short
: settings.curriculum_title;

api.renderInOutlet("before-header-panel", <template>
<a class="curriculum-nav" href={{settings.curriculum_src}}>{{rawLabel}}</a>
</template>);

api.renderInOutlet("above-site-header", <template>
<nav class="site-nav nav-padding">
<div class="site-nav-logo">
<a href="/">
<img
id="site-logo"
class="logo-big"
src={{siteSettings.site_logo_url}}
alt={{settings.title}}
/>
</a>
</div>
</nav>
</template>);
});

0 comments on commit 9d4b853

Please sign in to comment.