Skip to content

Commit bec260d

Browse files
toddmottoNiels den Dekker
authored and
Niels den Dekker
committed
Add conf/meetup filtering (#11)
* Yarn * Remove conferences * Add filter HTML * Initial styles * Filter functionality * Pull string constants out * Update filter styles * Change hero img + reduce size * Refactor * Add SVGO link * Update conference boxes * Add bullets
1 parent 038350a commit bec260d

File tree

14 files changed

+126
-151
lines changed

14 files changed

+126
-151
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Use the guide below to add your own event to the correct month inside the above
3737
// Date of Event
3838
"date": "06-07",
3939
// Your event logo (for best results use SVG)
40+
// Please compress SVG before your PR:
41+
// https://jakearchibald.github.io/svgomg/
4042
"logo": "ngbe.svg",
4143
// The type of event, "conference" or "meetup"
4244
"type": "conference",

_data/conferences.json

-10
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,5 @@
3838
"name": "ngPoland",
3939
"href": "http://ng-poland.pl/",
4040
"img": "ngpoland.svg"
41-
},
42-
{
43-
"name": "ngHighCountry",
44-
"href": "http://www.highcountryangular.com/",
45-
"img": "nghighcountry.svg"
46-
},
47-
{
48-
"name": "ngHouston",
49-
"href": "https://www.meetup.com/ngHouston/",
50-
"img": "nghouston.svg"
5141
}
5242
]

_includes/calendar.html

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
<h3 class="ac-year-title">{{ include.year }}</h3>
55
</div>
66
<div class="ac-conf">
7+
<div class="ac-conf-filters">
8+
<p>Show:</p>
9+
<a href="#all" class="active">All</a> <span>&bull;</span>
10+
<a href="#conference">Conferences</a> <span>&bull;</span>
11+
<a href="#meetup">Meetups</a>
12+
</div>
713
{% for conf in assets %}
814
{% if conf[1].size > 0 %}
915
<div class="ac-conf-box">
1016
<h2 class="ac-conf-title">{{ conf[0] }}</h2>
11-
<div class="grid-2">
17+
<div class="grid-2-special">
1218
{% for item in conf[1] %}
1319
{% assign month = conf[0] %}
1420
{% assign year = include.year %}

_includes/generic/conference.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@
483483
{% assign country = "Zimbabwe" %}
484484
{% endcase %}
485485

486-
<div class="ac-box toggle-modal"{% if item.metadata.type == 'conference' or item.metadata.type == 'meetup' %}data-event-type="{{ item.metadata.type }}"{% endif %}>
486+
<div class="ac-box toggle-modal active"{% if item.metadata.type == 'conference' or item.metadata.type == 'meetup' %}data-event-type="{{ item.metadata.type }}"{% endif %}>
487487
<h3 class="ac-box-title">
488488
{{ item.metadata.title }}
489489
<span>{% if item.metadata.type == 'conference' or item.metadata.type == 'meetup' %}{{ item.metadata.type }}{% endif %}</span>

_scripts/app.js

+48-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,53 @@
8888

8989
const members = $$('.ac-conf');
9090

91-
function initMembers(thing) {
92-
const items = $$('.toggle-modal', thing);
93-
const modals = $$('.modal', thing);
91+
function bindFilters(item) {
92+
const filter = item.querySelector('.ac-conf-filters');
93+
const VISIBILITY = 'data-visibility';
94+
const EVENT_TYPE = 'data-event-type';
95+
96+
filter.addEventListener(
97+
'click',
98+
function(event) {
99+
event.preventDefault();
100+
const { target } = event;
101+
102+
if (target.nodeName.toLowerCase() !== 'a') {
103+
return;
104+
}
105+
106+
const value = target.getAttribute('href').substring(1);
107+
const buttons = $$('a', target.parentNode);
108+
const confs = $$(`[${EVENT_TYPE}]`, item);
109+
110+
buttons.map(button => apollo.removeClass(button, 'active'));
111+
apollo.addClass(target, 'active');
112+
113+
switch (value) {
114+
case 'all': {
115+
confs.map(conf => apollo.addClass(conf, 'active'));
116+
break;
117+
}
118+
case 'conference':
119+
case 'meetup': {
120+
confs.map(conf => {
121+
if (conf.getAttribute(`${EVENT_TYPE}`) === value) {
122+
apollo.addClass(conf, 'active');
123+
} else {
124+
apollo.removeClass(conf, 'active');
125+
}
126+
});
127+
break;
128+
}
129+
}
130+
},
131+
false
132+
);
133+
}
134+
135+
function initMembers(item) {
136+
const items = $$('.toggle-modal', item);
137+
const modals = $$('.modal', item);
94138
const overlay = document.querySelector('.overlay');
95139
const main = document.querySelector('.main');
96140

@@ -150,5 +194,6 @@
150194

151195
if (members) {
152196
members.map(initMembers);
197+
members.map(bindFilters);
153198
}
154199
})(window, document);

assets/css/app.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/source/base/_grid.scss

+15
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@
4646
}
4747
}
4848

49+
// Two columns
50+
.grid-2-special,
51+
%grid-2-special {
52+
@extend %grid-base;
53+
justify-content: space-between;
54+
55+
& > * {
56+
flex: 0 1 48.5%;
57+
58+
@media only screen and (max-width: 760px) {
59+
flex: 0 0 100%;
60+
}
61+
}
62+
}
63+
4964
// Three columns
5065
.grid-3,
5166
%grid-3 {

assets/css/source/components/_brands.scss

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
text-align: center;
2121
line-height: 70px;
2222

23+
&:nth-child(n + 8) {
24+
display: none;
25+
height: 0;
26+
line-height: 0;
27+
}
28+
2329
@media only screen and (max-width: 560px) {
2430
line-height: 90px;
2531
}

assets/css/source/components/_dates.scss

+28-31
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,30 @@
1616
}
1717

1818
.ac-conf {
19+
&-filters {
20+
margin: 20px 0;
21+
font-size: 14px;
22+
span {
23+
margin: 0 4px;
24+
color: $night-50;
25+
}
26+
p {
27+
display: inline-block;
28+
margin-right: 4px;
29+
}
30+
a {
31+
color: $night-50;
32+
padding: 0 4px;
33+
34+
&:hover {
35+
color: $night-80;
36+
}
37+
38+
&.active {
39+
color: $green;
40+
}
41+
}
42+
}
1943
&-box {
2044
border-top: 1px solid $night-10;
2145
padding: 30px 0 0;
@@ -33,10 +57,12 @@
3357
font-size: 14px;
3458
color: $green;
3559
line-height: 26px;
60+
margin-bottom: 10px;
3661
}
3762
}
3863

3964
.ac-box {
65+
display: none;
4066
position: relative;
4167
border: 1px solid $night-10;
4268
border-radius: $border-radius;
@@ -53,37 +79,8 @@
5379
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.04);
5480
}
5581

56-
&:nth-child(-n + 2) {
57-
margin-top: 10px;
58-
59-
@media only screen and (max-width: 560px) {
60-
margin-top: 6px;
61-
}
62-
}
63-
64-
&--conference,
65-
&--meetup {
66-
&:before {
67-
content: '';
68-
position: absolute;
69-
right: 17px;
70-
top: 17px;
71-
width: 8px;
72-
height: 8px;
73-
border-radius: 8px;
74-
}
75-
}
76-
77-
&--conference {
78-
&:before {
79-
background: $angular;
80-
}
81-
}
82-
83-
&--meetup {
84-
&:before {
85-
background: $typescript;
86-
}
82+
&.active {
83+
display: block;
8784
}
8885

8986
&-title {

assets/css/source/layout/_hero.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.ac-hero {
2-
background: url('/assets/img/homepage/hero.png') center center no-repeat;
2+
background: url('/assets/img/homepage/hero.jpg') center center no-repeat;
33
background-size: cover;
44

55
text-align: center;

assets/img/homepage/hero.jpg

142 KB
Loading

assets/img/homepage/hero.png

-1.49 MB
Binary file not shown.

assets/js/bundle.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)