Skip to content

Commit

Permalink
Move curriculum-nav to before-header-panel to avoid positioning hacks
Browse files Browse the repository at this point in the history
Previously it was being rendered as a button on the right hand side of the header, and then `position:fixed` was used to pull it to the left. This made for some weird rendering quirks. This commit uses a plugin outlet to render it in the correct part of the HTML, which removes the need for the positioning workarounds.
  • Loading branch information
davidtaylorhq committed Apr 11, 2024
1 parent e5e6164 commit 7539991
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 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
2 changes: 1 addition & 1 deletion javascripts/discourse/api-initializers/freecodecamp.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default apiInitializer("0.8", (api) => {
? settings.curriculum_title_short
: settings.curriculum_title;

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

Expand Down

0 comments on commit 7539991

Please sign in to comment.