Skip to content

Commit

Permalink
Added v5 changes back in
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertPeek committed Aug 13, 2021
1 parent 9228576 commit ab0361f
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 92 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ The attributes listed below are used in *components.json* to configure **Hotgrid
Hotgrid automatically switches to 2 columns in small and medium device mode for the best user experience.

----------------------------
**Version number:** 3.1.0
**Framework versions:** 4+
**Version number:** 4.0.0
**Framework versions:** 5+
**Author / maintainer:**
**Accessibility support:** WAI AA
**RTL support:** yes
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "adapt-hotgrid-audio",
"version": "3.1.0",
"framework": ">=4",
"version": "4.0.0",
"framework": ">=5",
"homepage": "https://github.com/deltanet/adapt-hotgrid-audio",
"displayName": "Hotgrid Audio",
"component": "hotgrid-audio",
Expand Down
21 changes: 10 additions & 11 deletions js/hotgridPopupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ define([
className: 'hotgrid-audio-popup',

events: {
'click .hotgrid-close-button': 'closePopup',
'click .hotgrid-popup-controls': 'onControlClick'
'click .js-hotgrid-close-btn': 'closePopup',
'click .js-hotgrid-popup-controls': 'onControlClick'
},

initialize: function() {
Expand Down Expand Up @@ -37,17 +37,16 @@ define([
var shouldEnableNext = index < itemCount - 1 && canCycleThroughPagination;
var $controls = this.$('.hotgrid-popup-controls');

this.$('hotgrid-popup-nav')
.toggleClass('first', !shouldEnableBack)
.toggleClass('last', !shouldEnableNext);
this.$('hotgrid-popup-nav').filter('.back').toggleClass('is-disabled', shouldEnableBack);
this.$('hotgrid-popup-nav').filter('.next').toggleClass('is-disabled', shouldEnableNext);

$controls.filter('.back').a11y_cntrl_enabled(shouldEnableBack);
$controls.filter('.next').a11y_cntrl_enabled(shouldEnableNext);
},

handleTabs: function() {
this.$('.hotgrid-item:not(.active) *').a11y_on(false);
this.$('.hotgrid-item.active *').a11y_on(true);
this.$('.hotgrid-item:not(.is-active) *').a11y_on(false);
this.$('.hotgrid-item.is-active *').a11y_on(true);
},

onItemsActiveChange: function(item, _isActive) {
Expand All @@ -59,14 +58,14 @@ define([
},

applyItemClasses: function(index) {
this.$('.hotgrid-item[data-index="' + index + '"]').addClass('active').removeAttr('aria-hidden');
this.$('.hotgrid-item[data-index="' + index + '"]').addClass('is-active').removeAttr('aria-hidden');
this.$('.hotgrid-item[data-index="' + index + '"] .notify-popup-title').attr("id", "notify-heading");
this.$('.hotgrid-item:not([data-index="' + index + '"])').removeClass('active').attr('aria-hidden', 'true');
this.$('.hotgrid-item:not([data-index="' + index + '"])').removeClass('is-active').attr('aria-hidden', 'true');
this.$('.hotgrid-item:not([data-index="' + index + '"]) .notify-popup-title').removeAttr("id");
},

handleFocus: function(index) {
this.$('.hotgrid-popup-inner .active').a11y_focus();
this.$('.hotgrid-popup-inner .is-active').a11y_focus();
this.applyNavigationClasses(index);
},

Expand All @@ -75,7 +74,7 @@ define([

this.$('.hotgrid-item')
.filter('[data-index="' + item.get('_index') + '"]')
.addClass('visited');
.addClass('is-visited');
},

render: function() {
Expand Down
8 changes: 4 additions & 4 deletions js/hotgridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ define([

postRender: function() {
this.setUpColumns();
this.$('.hotgrid-widget').imageready(this.setReadyStatus.bind(this));
this.$('.hotgrid__widget').imageready(this.setReadyStatus.bind(this));
},

resizeControl: function() {
Expand All @@ -86,7 +86,7 @@ define([
},

onItemsActiveChange: function(model, _isActive) {
this.getItemElement(model).toggleClass('active', _isActive);
this.getItemElement(model).toggleClass('is-active', _isActive);
},

getItemElement: function(model) {
Expand All @@ -104,7 +104,7 @@ define([
ariaLabel.innerHTML += ' ' + visitedLabel;
});

$item.addClass('visited');
$item.addClass('is-visited');
},

onItemClicked: function(event) {
Expand All @@ -128,7 +128,7 @@ define([
model: this.model
});

Adapt.trigger('notify:popup', {
Adapt.notify.popup({
_view: this.popupView,
_isCancellable: true,
_showCloseButton: false,
Expand Down
88 changes: 37 additions & 51 deletions less/hotgrid-audio.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.hotgrid-audio-component {
.hotgrid-audio {

.hotgrid-widget {
.hotgrid__widget {
// Font size set to 0 so there's no gap between items
font-size: 0;
position: relative;
Expand All @@ -11,7 +11,7 @@
display: flex;
flex-flow: wrap;
justify-content: center;
padding-top: @component-padding / 2;
padding-top: @item-title-margin / 2;
}

.hotgrid-grid-listitem {
Expand All @@ -23,6 +23,9 @@
text-align: center;
vertical-align: top;
width: 100%;
background-color: transparent;

.button-text;

&.hotgrid-item-states-css {
.hotgrid-item-image {
Expand All @@ -35,9 +38,9 @@
}
}

&.visited {
&.is-visited {
.hotgrid-item-image {
border: 3px solid @item-color-visited;
border: 3px solid @visited;
}
}
}
Expand All @@ -62,7 +65,7 @@
}
}

&.visited {
&.is-visited {
img.hotgrid-item-image-default {
display: none !important;
}
Expand Down Expand Up @@ -92,31 +95,31 @@
.hotgrid-item-title {
text-align: center;
color: @font-color;
font-size: @body-text-font-size;
padding: @component-padding/2;
font-weight: @font-weight-bold;
padding: @item-title-margin/2;
}

&.item-titles {
.hotgrid-grid-item {
.hotgrid-item-title {
color: @item-text-color;
color: @item-color-inverted;
background-color: @item-color;
font-weight: @font-weight-bold;
}

.no-touch & {
&:hover {
.hotgrid-item-title {
color: @item-text-color-hover;
color: @item-color-inverted-hover;
background-color: @item-color-hover;
}
}
}

&.visited {
&.is-visited {
.hotgrid-item-title {
color: @item-text-color-visited;
background-color: @item-color-visited;
color: @visited-inverted;
background-color: @visited;
}
}
}
Expand All @@ -125,44 +128,32 @@

.hotgrid-audio-popup {

.hotgrid-item:not(.active) {
.hotgrid-item:not(.is-active) {
display: none;
}

.notify-popup-title {
text-align: center;
padding-right: 0 !important;
}

.notify-popup-buttons {
margin-top: 0 !important;
}

.hotgrid-popup-body {
padding-bottom: @notify-padding-bottom;
font-size: @body-text-font-size;
padding-bottom: @notify-padding-ver;

float: left;
text-align: left;
.dir-rtl & {
float: right;
text-align: right;
}

width: 60%;
overflow: hidden;

@media (max-width: @device-width-medium) {
width: 100%;
padding-bottom: (@notify-padding-bottom / 3);
}

&.fullwidth {
&.is-fullwidth {
width: 100%;
}
}

.hotgrid-popup-graphic {
float: right;
padding-bottom: @button-padding-bottom;
width: 38%;
margin-left: 2%;

Expand All @@ -184,42 +175,37 @@
margin-right: auto;
}

&.fullwidth {
&.is-fullwidth {
width: 100%;
margin-left: 0px;
}

&.hidden {
&.is-hidden {
display: none;
}
}

.hotgrid-popup-nav {
margin-top: @button-margin-top;
position: relative;
margin-top: @btn-margin;
clear: both;
}

.hotgrid-popup-controls {
display: block;
width: (@icon-size*2);
height: (@icon-size*2);
position: absolute;
text-decoration: none;
background-color: @notify-button-color;

.icon {
margin: (@icon-size/2);
color: @notify-button-text-color;
}
position: absolute;
border-radius: @btn-border-radius;

.no-touch &:hover {
background-color: @notify-button-color-hover;
.icon {
color: @notify-button-text-color-hover;
}
}
padding: @btn-padding / 2;
background-color: @notify-icon;
color: @notify-icon-inverted;

.no-touch &:hover {
background-color: @notify-icon-hover;
color: @notify-icon-inverted-hover;
.transition(background-color @duration ease-in, color @duration ease-in;);
}

&.disabled {
&.is-disabled {
visibility: hidden;
}
}
Expand Down
9 changes: 5 additions & 4 deletions templates/hotgrid-audio.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="component-inner hotgrid-inner">
<div class="component__inner hotgrid__inner">
{{> component this}}
<div class="component-widget hotgrid-widget">
<div class="component__widget hotgrid__widget">
<div role="list" class="hotgrid-grid">
<div class="hotgrid-grid-inner clearfix">
<div class="hotgrid-grid-inner u-clearfix">
{{#each _items}}
<div role="listitem" class="hotgrid-grid-listitem">
<button class="base hotgrid-grid-item hotgrid-item-states-{{#all _graphic.srcHover _graphic.srcVisited}}image{{else}}css{{/all}}{{#if _isVisited}} visited{{/if}}" data-index="{{@index}}">
<button class="hotgrid-grid-item hotgrid-item-states-{{#all _graphic.srcHover _graphic.srcVisited}}image{{else}}css{{/all}}{{#if _isVisited}} is-visited{{/if}}" data-index="{{@index}}">

<span class="aria-label">
{{#if _graphic.title}}{{_graphic.title}}{{else}}{{../_globals._accessibility._ariaLabels.item}} {{numbers @index}}{{/if}}.{{#if _graphic.alt}} {{_graphic.alt}}.{{/if}}
Expand All @@ -25,6 +25,7 @@
</div>
{{/if}}
</div>

</button>
</div>
{{/each}}
Expand Down
Loading

0 comments on commit ab0361f

Please sign in to comment.