Skip to content

Commit

Permalink
Refactor themes and main html pages
Browse files Browse the repository at this point in the history
Update sliding-context.js
Update sliding-nav-2023.html
Create contextual.json
Update themes/*.html
Update alpha-layered-theme-menu-mr-tp.css
  • Loading branch information
David Elisma committed Feb 8, 2023
1 parent 7490fd0 commit 020567b
Show file tree
Hide file tree
Showing 21 changed files with 737 additions and 557 deletions.
30 changes: 19 additions & 11 deletions working-on/sliding-nav/alpha-layered-theme-menu-mr-tp.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@

/* JM: need button when selected to turn dark blue - this isn't working */

button.selected {
background-color: #26374a !important;
color: white !important;
.alpha .test-gcweb-menu .visible-md.visible-lg button[role=menuitem]:hover {
background-color: #f5f5f5;
}

.alpha .test-gcweb-menu .visible-md.visible-lg button[role=menuitem][aria-expanded=true]:focus,
.alpha .test-gcweb-menu .visible-md.visible-lg button[role=menuitem][aria-expanded=true]:active {
background-color: #26374a;
color: white;
}

#gc-mnu,
#gc-mnu-jobs,
#gc-mnu-cit,
#gc-mnu-travel,
Expand All @@ -42,10 +48,10 @@ button.selected {
}

/* for desktop - but it's fine if it can toggle too */
#jobs:focus + #gc-mnu-jobs,
/* #jobs:focus + #gc-mnu-jobs,
#jobs:hover + #gc-mnu-jobs {
display: block; /* DELISMA: for mobile this needs to be overriden */
}
display: block; /* DELISMA: for mobile this needs to be overriden
} */
.alpha .test-gcweb-menu .visible-md.visible-lg button[role=menuitem] {
background-color: transparent;
border: none;
Expand All @@ -57,10 +63,6 @@ button.selected {
text-transform: initial;
}

.alpha .test-gcweb-menu .visible-md.visible-lg button[role=menuitem]:hover {
background-color: #f5f5f5;
}

.alpha .test-gcweb-menu [role=menuitem] {
width: 100%;
}
Expand Down Expand Up @@ -98,6 +100,7 @@ button.selected {
}

@media (min-width: 990px) {
#gc-mnu,
#gc-mnu-jobs,
#gc-mnu-cit,
#gc-mnu-travel,
Expand Down Expand Up @@ -149,4 +152,9 @@ button.selected {
#gc-mnu-jobs {
width: 750px;
}
} */
} */

/* DEBUG CSS */
.gc-mnu * {
out_line: 1px solid limegreen;
}
240 changes: 240 additions & 0 deletions working-on/sliding-nav/contextual.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
{
"jobs": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to jobs"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact jobs"
}
]
}
},
"immigration": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to immigration"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact immigration"
}
]
}
},
"travel": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to travel"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact travel"
}
]
}
},
"business": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to business"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact business"
}
]
}
},
"benefits": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to benefits"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact benefits"
}
]
}
},
"Health": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to health"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact health"
}
]
}
},
"taxes": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to taxes"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact taxes"
}
]
}
},
"environment": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to environment"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact environment"
}
]
}
},
"defence": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to defence"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact defence"
}
]
}
},
"culture": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to culture"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact culture"
}
]
}
},
"policing": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to policing"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact policing"
}
]
}
},
"transport": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to transport"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact transport"
}
]
}
},
"world": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to world"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact world"
}
]
}
},
"money": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to money"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact money"
}
]
}
},
"science": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to science"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact science"
}
]
}
},
"indigenous": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to indigenous"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact indigenous"
}
]
}
},
"veterans": {
"auth": {
"link": "/landing/sign-government-canada-online-account",
"labelExtended": "Sign in to veterans"
},
"contextualFooter": {
"links": [
{
"url": "someUrl.html",
"text": "Contact veterans"
}
]
}
}
}
78 changes: 44 additions & 34 deletions working-on/sliding-nav/sliding-context.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
let state = {
signin: {
link: "",
labelExtended: "Sign in"
},
contextualFooter: {
links: [
{
url: "someUrl.html",
text: "Contextual link 1"
}
]
}
}

function render() {
$( "#wb-so a" ).attr( "href" );
$( "#wb-so .hidden-xs" ).text( state.signin.labelExtended );
$each( state.contextualFooter.links, function( key, value ) {
$( "#gc-contextual a" ).text( value.text );
$( "#gc-contextuùl a ").attr( value.url );
} )
}
( function( $, window, wb ) {
"use strcit";

$( "[aria-expanded='true']" ).one( "wb-contentupdated",
function( event ) {
var gcMnuTheme = event.currentTarget,
trigger = gcMnuTheme.getAttribute( "data-trigger-wet" );
var componentName = "gc-mnu",
selector = "." + componentName,
initEvent = "wb-init" + selector,
$document = wb.doc,
init = function( event ) {
var elm = wb.init( event, componentName, selector ),
$elm,
settings;
if ( elm ) {
$elm = $( elm );
settings = wb.getData( $elm, componentName );
$elm.trigger( "load", settings );
wb.ready( $elm, componentName )
}
},
render = function ( event, data ) {
var elm = event.currentTarget,
$elm = $( elm );

if ( trigger ) {
state.signin.link = $( gcMnuTheme ).data( "gcAuth" ).link;
state.signin.labelExtended = $( gcMnuTheme ).data( "gcAuth" ).labelExtended;
state.contextualFooter.links = $( gcMnuTheme ).data( "gcFooter" ).links
render();
}
})
if ( elm.getAttribute( "aria-expanded" ) === "true" ) {
return
} else {
$( "button" ).attr( "aria-expanded", false );
$elm.attr( "aria-expanded", true );
}
/* $( "#wb-so a" ).attr( "href" );
$( "#wb-so .hidden-xs" ).text( );
$each( function( key, value ) {
$( "#gc-contextual a" ).text( value.text );
$( "#gc-contextual a").attr( "href", value.url );
} ) */
};

$document.on( "click", ".gc-mnu button", function( event, data ) {
render( event, data )
});
$document.on( "timerpoke.wb" + initEvent, selector, init );
wb.add( selector );
} )( jQuery, window, wb );

/*
}
*/
Loading

0 comments on commit 020567b

Please sign in to comment.