Skip to content

Instantly share code, notes, and snippets.

View abedzantout's full-sized avatar
🌍
Hello World!

Abdul Rahman Zantout abedzantout

🌍
Hello World!
View GitHub Profile
@abedzantout
abedzantout / card.tsx
Last active September 22, 2019 18:33
Card Component
import React, {FunctionComponent, Fragment} from 'react';
import Link from 'next/link';
import { getHref, getNavigationLink } from '../../helpers/helper';
import 'styles.css';
type Props = {
info: { id: string, title: string; description: string; heroImage: string; publishedAt: Date; slug: string }
}
@abedzantout
abedzantout / layout.tsx
Last active September 21, 2019 11:36
Blog Layout without meta tags
import React, {FunctionComponent, Fragment, ReactNode} from 'react';
type Props = {
children: ReactNode;
}
const Layout: FunctionComponent<Props> = ({children}) => {
return (
<Fragment>
<div className="layout">
@abedzantout
abedzantout / meta.tsx
Last active September 21, 2019 11:42
Meta Tag Component
import React, { Fragment, FunctionComponent } from 'react';
import Head from 'next/head';
import { MetaTags } from '../../../interfaces/meta-tags';
type Props = {
tags: MetaTags;
}
const Meta: FunctionComponent<Props> = ({tags}) => {
@abedzantout
abedzantout / tag.ts
Last active September 21, 2019 12:03
Meta Tag Type
export enum PageType {
website = 'website',
article = 'article'
}
export enum RobotsContent {
follow = 'follow',
index = 'index',
no_follow = 'nofollow',
no_index = 'noindex'
@abedzantout
abedzantout / contentful.ts
Last active September 24, 2019 18:24
Contentful API Integration
import { createClient } from 'contentful';
export const CONTENT_TYPE_BLOGPOST = 'blogPost';
export const CONTENT_TYPE_PERSON = 'author';
export const CONTENT_TYPE_TAGS = 'tag';
const Space = process.env.CONTENTFUL_SPACE;
const Token = process.env.CONTENTFUL_TOKEN;
export class ContentfulService {
@abedzantout
abedzantout / populate-contentful.js
Created September 19, 2019 16:02
Automatically populate Contentful
const authorFields = [
{
id: 'name',
name: 'Name',
type: 'Symbol',
required: true
},
{
id: 'title',
name: 'Job Title',