Skip to content

Commit

Permalink
Merge pull request #58 from GemCopeland/dev
Browse files Browse the repository at this point in the history
v0.3
  • Loading branch information
piperhaywood authored Nov 15, 2019
2 parents f5f3a64 + 91d0ff8 commit 7036041
Show file tree
Hide file tree
Showing 51 changed files with 510 additions and 149 deletions.
7 changes: 6 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,20 @@ module.exports = eleventyConfig => {
let options = {
html: true,
breaks: true,
linkify: true
linkify: true,
typographer: true
};
eleventyConfig.setLibrary("md", markdownIt(options));
eleventyConfig.addNunjucksFilter("markdownify", markdownString =>
markdownIt(options).render(markdownString)
);

// Copy the fonts
eleventyConfig.addPassthroughCopy({ "src/_includes/assets/fonts": "fonts" });

// Copy the favicon contents
eleventyConfig.addPassthroughCopy({ "src/_includes/assets/favicon": "/" });

return {
templateFormats: ["md", "njk", "html", "liquid", "woff", "woff2"],

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.DS_Store
_dist/
node_modules/
.vscode/
71 changes: 36 additions & 35 deletions src/_data/arena.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
// TODO Make this an environment variable
// https://www.11ty.io/docs/data-js/#example%3A-exposing-environment-variables
// The Arena channel ID
const arenaChannelId = 479545;

// Required package
const Arena = require("are.na");

const getChannelImages = async arena => {
return arena
.channel(channel.id)
.contents({ page: 1, per: 10 }) // NOTE We’re manually getting the contents because channel.contents sometimes returns null
.then(contents => {
// Get images within channel contents
return contents
.filter(b => b.image)
.map(b => {
return b.image.thumb.url;
});
});
};

const getArenaChannels = async channelId => {
// Set up the Arena instance
const arena = new Arena();
// Get the channel
let rootChannel = arena.channel(channelId);
// Set up base URL
let url = "https://are.na/";

// Set up number per page
const per = 60;
// Set up number of images per block
const imgPerBlock = 30;
// Get the channels
let channels = rootChannel
.get()
.then(async channel => {
// Add the user to the base URL
url = url + channel.user.slug + "/";

// Create a new array of channel contents
let reducedChannels = await Promise.all(
channel.contents
Expand All @@ -45,27 +32,41 @@ const getArenaChannels = async channelId => {
description: channel.metadata
? channel.metadata.description
: null,
images: null,
images: [],
count: channel.length,
url: url + channel.slug
};
// Add some further content to the channel via its child blocks
newChannel = await arena
.channel(channel.id)
.contents() // NOTE We’re manually getting the contents because channel.contents sometimes returns null
.then(contents => {
// Get images within channel contents
newChannel.images = contents
.filter(b => b.image)
.map(b => {
return b.image.thumb.url;
})
.reverse()
.slice(0, 10);

// Return the channel with the additional image and description content
return newChannel;
});
// Calculate the options based on the total pages
// NOTE If we could pass `sort_by` and / or `direction` to the opts, we would not need to do this
let totalPages = Math.ceil(channel.length / per);
let opts = { per: per };
// Loop through the pages backwards
for (let i = totalPages; i > 0; i--) {
// Stop looping through pages if we have enough images
if (newChannel.images.length > imgPerBlock) {
break;
}
// Set page to next
opts.page = i;
// Add some further content to the channel via its child blocks
newChannel = await arena
.channel(channel.id)
.contents(opts) // NOTE We’re manually getting the contents because channel.contents sometimes returns null
.then(contents => {
// Get images within channel contents
contents = contents
.filter(b => b.image)
.map(b => {
return b.image.thumb.url;
});
// Add contents to images array
newChannel.images = contents.concat(newChannel.images);
// Return the channel with the additional image and description content
return newChannel;
});
}
newChannel.images = newChannel.images.reverse();

// Return the formatted channel object
return newChannel;
Expand Down
3 changes: 2 additions & 1 deletion src/_data/global.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"arrowsTop": "↟, ⇑, ⬏, ↑, ⇡, ⟰, ⤴",
"lang": "en",
"schemaType": "Person",
"siteTitle": "Gemma Copeland"
"siteTitle": "Gemma Copeland",
"twitterHandle": "gemcopeland"
}
32 changes: 27 additions & 5 deletions src/_includes/assets/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,38 @@ time {
}

h1,
h2,
h3,
h3 {
color: var(--color-1);
font-size: var(--font-small);
font-weight: inherit;
line-height: var(--line-height-small);
margin: 0;
}

h2 {
color: var(--color-1);
font-weight: inherit;
font-size: inherit;
margin: 0;
line-height: 1.5;
}

h4,
h5,
h6 {
color: var(--color-1);
color: var(--color-black);
font-size: var(--font-small);
font-weight: inherit;
line-height: var(--line-height-small);
margin: 0;
}

strong {
font-family: "Standard Book", sans-serif;
font-style: normal;
font-weight: 700;
}

ol,
ul,
p {
Expand All @@ -75,9 +95,10 @@ ul {

a {
border: 1px solid transparent;
border-bottom: 1px solid var(--color-1);
color: currentColor;
text-decoration: none;
text-decoration-color: var(--color-1);
text-decoration-thickness: 1px;
text-underline-offset: 0.25rem;
}

a:hover {
Expand All @@ -87,6 +108,7 @@ a:hover {
a:focus {
border: 1px solid var(--color-1);
color: var(--color-1);
text-decoration: none;
}

img {
Expand Down
9 changes: 6 additions & 3 deletions src/_includes/assets/css/components.blocks.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

.block {
background-color: var(--color-white);
margin-bottom: 1.25rem;
margin-bottom: var(--gutter);
padding: 1rem;
position: relative;
}

.block__link {
border-bottom: none;
bottom: 0;
display: block;
left: 0;
Expand Down Expand Up @@ -43,7 +42,11 @@
}

.block__desc a {
border-bottom: none;
text-decoration: none;
}

.block__desc a:focus {
border: 1px solid var(--color-1);
}

.block__media {
Expand Down
14 changes: 5 additions & 9 deletions src/_includes/assets/css/components.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.button {
background-color: var(--color-2);
border-bottom: 1px solid transparent;
border-radius: 0.125rem;
color: var(--color-white);
display: inline-block;
margin-bottom: 1rem;
margin-top: 0.5rem;
padding: 0.125rem 0.5rem;
text-decoration: none;
}

.tags {
Expand All @@ -20,15 +20,15 @@
line-height: var(--line-height-small);
}

.tag a {
text-decoration: none;
}

.tag:after {
content: ",";
margin-right: 0.2rem;
}

.tag:hover {
text-decoration: none;
}

.tag:last-child:after {
content: none;
}
Expand All @@ -41,10 +41,6 @@
color: var(--color-grey-dark);
}

.article__time {
display: inline-block;
}

.header--article {
margin-bottom: 0.875rem;
}
11 changes: 10 additions & 1 deletion src/_includes/assets/css/components.footer.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
.footer {
font-size: var(--font-small);
line-height: var(--line-height-small);
position: relative;
}

.footer--site {
background-color: var(--color-2);
padding-top: 1rem;
}

.footer .section {
padding: 1rem;
padding-bottom: 1.25rem;
padding-left: var(--gutter);
padding-right: var(--gutter);
}

.footer--site h2 {
color: var(--color-1);
font-size: var(--font-small);
line-height: var(--line-height-small);
margin-top: 0 !important;
}

.footer--site *:last-child {
margin-bottom: 0;
}

.section--footer > * {
Expand Down
Loading

0 comments on commit 7036041

Please sign in to comment.