Skip to content

Commit

Permalink
EventCards whole card linking & raise 🎯
Browse files Browse the repository at this point in the history
Closes #43, closes #44
  • Loading branch information
James Canning committed Jan 25, 2017
1 parent 4662692 commit 475701f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/css/components/EventsList.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,28 @@
background: #ffffff;
margin-bottom: 0.5rem;
padding: 0.4rem;
@mixin card flat;
}

&__item {
background: #ffffff;
margin-bottom: 0.5rem;
padding: 0.4rem;
text-decoration: none;
transition: box-shadow 300ms ease;
display: block;
@mixin card flat;

&:hover {
@mixin card raised;
}

& .event_item {
box-shadow: none;
padding: 0;
margin-bottom: 0;
background: transparent;
}
}

& .msl_event_name {
Expand Down
11 changes: 11 additions & 0 deletions src/js/bits/events_card_linking.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default () => {
[...document.querySelectorAll('.EventsList .event_item')].forEach((eventItem) => {
const link = eventItem.querySelector('.msl_event_name').href;
const anchor = document.createElement('a');
anchor.href = link;
anchor.classList.add('EventsList__item');
// eslint-disable-next-line
eventItem.parentNode.insertBefore(anchor, eventItem);
anchor.appendChild(eventItem);
});
};
7 changes: 6 additions & 1 deletion src/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import NewsletterModal from './components/NewsletterModal';
import SnapchatModal from './components/SnapchatModal';
import perf from './tracking/perf';
import renderSearch from './apps/search';
import eventCardLinking from './bits/events_card_linking';

// Promise polyfil
if (!window.Promise) {
Expand Down Expand Up @@ -89,5 +90,9 @@ document.addEventListener('DOMContentLoaded', () => {
localStorage.setItem('su_cookie', '1');
}

System.import('./bits/panel').then(panel => panel.default());
eventCardLinking();

if (localStorage.getItem('su_proto') === '1') {
System.import('./bits/panel').then(panel => panel.default());
}
});

0 comments on commit 475701f

Please sign in to comment.