Skip to content

Instantly share code, notes, and snippets.

Avatar

Marton Borlay borlaym

  • Budapest, Hungary
View GitHub Profile
View curationlayouttypes.js
type FiveCardModular = {
name: 'FiveCardModular',
}
type FourCardModular = {
name: 'FourCardModular',
}
type HorizontalList = {
name: 'HorizontalList',
@borlaym
borlaym / curated-front-page-final-data.js
Last active December 16, 2019 14:28
Final type of data structure for curated front page
View curated-front-page-final-data.js
type SideHeader = {
type: 'SideHeader',
title: string,
useLogo? : boolean,
description? : string,
customImage: SimpleImage,
links: Array <{
url: string,
text: string
}>
@borlaym
borlaym / curated-front-page-data.js
Last active December 2, 2019 17:06
Curated front page
View curated-front-page-data.js
// Here is the proposed data structure for the new home page, which consists entirely of these modules.
// Here is a wip doc for the modules: https://docs.google.com/document/d/1eA8CZmEVfwge3oNBOyD1YCiK1UIz2HXLbnBmdRzPYps/edit#
// A single blog would have an array of these modules
// HELP WANTED: help us find a freakin name for these CurationBlocks that make sense and doesn't conflict with anything
// we have currently.
type CurationBlock = {
id: CurationBlockId, // We store an id for each one so when you edit it, we can save based on id and not index
layout: string, // enum, each layout has its own name
autofill?: { // If this is not undefined, the module will autofill and ignore the cards array (for now)
@borlaym
borlaym / DeletedEmbedJSON.js
Created October 3, 2019 14:03
DeletedEmbedJSON Exact
View DeletedEmbedJSON.js
export type DeletedEmbedJSON = {|
type: 'DeletedEmbed',
originalContent: {type?: string},
deletedReason: ?DeletedReason
|};
@borlaym
borlaym / DeletedEmbedJSON.js
Created October 3, 2019 13:50
DeletedEmbedJSON
View DeletedEmbedJSON.js
export type DeletedEmbedJSON = {
type: 'DeletedEmbed',
originalContent: {type?: string},
deletedReason: ?DeletedReason
};
@borlaym
borlaym / DeletedEmbedJSON.js
Created October 3, 2019 13:50
DeletedEmbedJSON
View DeletedEmbedJSON.js
export type DeletedEmbedJSON = {
type: 'DeletedEmbed',
originalContent: {type?: string},
deletedReason: ?DeletedReason
};
@borlaym
borlaym / issue.js
Created October 3, 2019 13:45
The issue
View issue.js
get featuredVideoUrl(): ?string {
if (this.featuredMedia && this.featuredMedia.id) {
let videoParams;
switch (this.featuredMedia.type) {
case 'YoutubeVideo':
videoParams = {
id: `youtube-video-${this.featuredMedia.id}`,
start: this.featuredMedia.start
};
break;
@borlaym
borlaym / solution.js
Created October 3, 2019 13:18
The solution
View solution.js
function getKinjaVideoForPost(post: Post): Array<string> {
const videoNodes = post.body.reduce<Array<KinjaVideoJSON>>((acc, n) => {
if (n.type === 'KinjaVideo') {
return [...acc, n];
}
return acc;
}, []);
return videoNodes.map(vn => vn.id);
}
@borlaym
borlaym / issue.js
Created October 3, 2019 13:07
The issue
View issue.js
function isKinjaVideo(blockNode: BlockNodeJSON): boolean {
return blockNode.type === 'KinjaVideo';
}
export default function getKinjaVideoForPost(post: Post): Array<string> {
const videoNodes = post.body.filter(n => isKinjaVideo(n));
return videoNodes.map(vn => vn.id);
}
@borlaym
borlaym / issue.js
Created October 3, 2019 13:07
The issue
View issue.js
function isKinjaVideo(blockNode: BlockNodeJSON): boolean {
return blockNode.type === 'KinjaVideo';
}
export default function getKinjaVideoForPost(post: Post): Array<string> {
const videoNodes = post.body.filter(n => isKinjaVideo(n));
return videoNodes.map(vn => vn.id);
}