-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
236 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
// Configuration options must be added and amended for all json files where required | ||
// Configuration options must be added and amended for all JSON files where required | ||
|
||
// config.json - to disable globally | ||
"_homeButton": { | ||
"_isEnabled": false | ||
} | ||
// config.json - Used to disable globally | ||
"_homeButton": { | ||
"_isEnabled": false | ||
} | ||
|
||
// course.json | ||
"_homeButton": { | ||
"_isEnabled": true, | ||
"_hideHomeButton": false, | ||
"_comment": "Amend co-00 to match the ID of the start / landing page", | ||
"_redirectToId": "co-00", | ||
"alt": "Introduction" | ||
// course.json - Use for global settings and navigation order | ||
"_extensions": { | ||
"_homeButton": { | ||
"_navOrder": -1, | ||
"_showLabel": true, | ||
"navLabel": "Home", | ||
"_navTooltip": { | ||
"_isEnabled": false, | ||
"text": "Home" | ||
} | ||
} | ||
} | ||
|
||
// contentObjects.json | ||
"_homeButton": { | ||
"_isEnabled": true, | ||
"_hideHomeButton": false, | ||
"_hideBackButton": true, | ||
"_redirectToId": "", | ||
"alt": "Home" | ||
} | ||
// course.json or contentObjects - Use to configure at the menu or content object level | ||
"_homeButton": { | ||
"_isEnabled": true, | ||
"_hideHomeButton": false, | ||
"_comment": "Amend _redirectToId to match the ID of the start / landing page", | ||
"_redirectToId": "", | ||
"_comment": "Option to override navigation button label and tooltip", | ||
"navLabel": "Introduction", | ||
"_navTooltip": { | ||
"_isEnabled": true, | ||
"text": "Introduction" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Adapt from 'core/js/adapt'; | ||
import NavigationButtonView from 'core/js/views/NavigationButtonView'; | ||
import tooltips from 'core/js/tooltips'; | ||
|
||
class HomeNavigationButtonView extends NavigationButtonView { | ||
|
||
attributes() { | ||
return { | ||
...super.attributes(), | ||
'data-tooltip-id': this.model.get('_id') | ||
}; | ||
} | ||
|
||
initialize(options) { | ||
super.initialize(options); | ||
this.setupEventListeners(); | ||
this.render(); | ||
tooltips.register({ | ||
_id: this.model.get('_id'), | ||
...this.model.get('_navTooltip') || {} | ||
}); | ||
} | ||
|
||
setupEventListeners() { | ||
this.listenTo(Adapt, { | ||
remove: this.remove | ||
}); | ||
} | ||
|
||
static get template() { | ||
return 'HomeNavigationButton.jsx'; | ||
} | ||
|
||
} | ||
|
||
export default HomeNavigationButtonView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
.nav { | ||
// replicate navigation back button float | ||
&__homebutton-btn { | ||
.u-float-left; | ||
} | ||
|
||
// hide home button class | ||
.hide-nav-home-btn &__homebutton-btn { | ||
.nav__homebutton-btn { | ||
// Hide home button class | ||
.hide-nav-home-btn & { | ||
.u-display-none; | ||
} | ||
|
||
// Change the home button icon to use the back arrow on the menu | ||
.location-menu &__homebutton-btn .icon { | ||
.location-menu & .icon { | ||
.icon-controls-small-left; | ||
} | ||
|
||
.location-page &__homebutton-btn .icon { | ||
.location-page & .icon { | ||
.icon-home; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import { classes, compile } from 'core/js/reactHelpers'; | ||
|
||
export default function HomeNavigationButton(props) { | ||
const { | ||
text, | ||
_iconClasses | ||
} = props; | ||
return ( | ||
<> | ||
<span | ||
className={classes([ | ||
'icon', | ||
_iconClasses | ||
])} | ||
aria-hidden="true" | ||
/> | ||
<span | ||
className="nav__btn-label" | ||
aria-hidden="true" | ||
dangerouslySetInnerHTML={{ __html: compile(text, props) }} | ||
/> | ||
</> | ||
); | ||
} |