-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
438 additions
and
51 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 |
---|---|---|
|
@@ -2,4 +2,3 @@ node_modules | |
dist | ||
functions | ||
yarn-error.log | ||
main.css |
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,19 @@ | ||
const gulp = require('gulp') | ||
const webpack = require('webpack-stream') | ||
|
||
const webpackConfig = { | ||
mode: 'production', | ||
entry: { | ||
map: './src/assets/scripts/map.js' | ||
}, | ||
output: { | ||
filename: '[name].js' | ||
} | ||
} | ||
|
||
gulp.task('scripts', function() { | ||
return gulp | ||
.src('src/assets/scripts/map.js') | ||
.pipe(webpack(webpackConfig)) | ||
.pipe(gulp.dest('dist/assets/scripts')) | ||
}) |
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
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,71 @@ | ||
import * as d3 from 'd3' | ||
import members from '../../data/members' | ||
|
||
class WebringMap { | ||
constructor() { | ||
this.radius = 200 | ||
this.canvasWidth = this.radius * 2 + 32 | ||
|
||
this.svg = null | ||
this.nodes = [] | ||
|
||
this.init() | ||
} | ||
|
||
init() { | ||
d3.selectAll('svg').remove() | ||
this.svg = d3 | ||
.select('#map-canvas') | ||
.append('svg') | ||
.attr('width', this.canvasWidth) | ||
.attr('height', this.canvasWidth) | ||
|
||
this.nodes = members.map((member, index) => { | ||
const angle = (index / (members.length / 2)) * Math.PI | ||
const x = this.radius * Math.cos(angle) + this.canvasWidth / 2 | ||
const y = this.radius * Math.sin(angle) + this.canvasWidth / 2 | ||
|
||
return { | ||
id: index, | ||
title: member.title, | ||
url: member.url, | ||
x, | ||
y | ||
} | ||
}) | ||
} | ||
|
||
drawCircle() { | ||
this.svg | ||
.append('circle') | ||
.attr('cx', this.canvasWidth / 2) | ||
.attr('cy', this.canvasWidth / 2) | ||
.attr('r', this.radius) | ||
.attr('strokeWidth', 2) | ||
} | ||
|
||
drawNodes() { | ||
this.svg | ||
.selectAll('circle') | ||
.data(this.nodes) | ||
.enter() | ||
.append('circle') | ||
.attr('r', 10) | ||
.attr('cx', function(d, i) { | ||
return d.x | ||
}) | ||
.attr('cy', function(d, i) { | ||
return d.y | ||
}) | ||
} | ||
|
||
draw() { | ||
this.drawCircle() | ||
this.drawNodes() | ||
} | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
const map = new WebringMap() | ||
map.draw() | ||
}) |
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 |
---|---|---|
@@ -1,28 +1,33 @@ | ||
<article class="webring"> | ||
<header class="webring__header"> | ||
{% if meta.image %} | ||
<img class="webring__image" src="/assets/images/{{ meta.image }}" width="70" height="70" alt=""> | ||
{% endif %} | ||
<div class="webring__map" hidden> | ||
<canvas id="map-canvas"></canvas> | ||
</div> | ||
<div class="webring__card"> | ||
<header class="webring__header"> | ||
{% if meta.image %} | ||
<img class="webring__image" src="/assets/images/{{ meta.image }}" width="70" height="70" alt=""> | ||
{% endif %} | ||
|
||
<div class="webring__description"> | ||
<h1 class="webring__title">{{ meta.title }}</h1> | ||
<p>{{ meta.description }}</p> | ||
<a href="/code-of-conduct">Code of Conduct</a> | ||
</div> | ||
</header> | ||
|
||
<div class="webring__body"> | ||
<div class="webring__subtitle"> | ||
<h2 class="h3">Members ({{ members | length }})</h2> | ||
<a href="/feeds.xml">RSS Feeds</a> | ||
</div> | ||
<div class="webring__description"> | ||
<h1 class="webring__title">{{ meta.title }}</h1> | ||
<p>{{ meta.description }}</p> | ||
<a href="/code-of-conduct">Code of Conduct</a> | ||
</div> | ||
</header> | ||
<div class="webring__body"> | ||
<div class="webring__subtitle"> | ||
<h2 class="h3">Members ({{ members | length }})</h2> | ||
<a href="/feeds.xml">RSS Feeds</a> | ||
</div> | ||
|
||
<ol class="webring__memberlist"> | ||
{% for member in members %} | ||
<li class="webring__member"> | ||
<a href="{{ member.url }}" class="webring__link">{{ member.title }}</a> | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
<ol class="webring__memberlist"> | ||
{% for member in members %} | ||
<li class="webring__member"> | ||
<a href="{{ member.url }}" class="webring__link">{{ member.title }}</a> | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
</div> | ||
</div> | ||
</article> |
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,5 +1,6 @@ | ||
--- | ||
layout: base | ||
is_front: true | ||
--- | ||
|
||
{% include 'webring.njk' %} | ||
|
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
Oops, something went wrong.