This commit is contained in:
Samuel W 2020-05-09 00:08:44 +08:00
parent cabbd611ed
commit 4592baba95
8 changed files with 156 additions and 156 deletions

View File

@ -1,6 +1,6 @@
{ {
"trailingComma": "es5", "trailingComma": "es5",
"tabWidth": 2, "tabWidth": 2,
"semi": false, "semi": true,
"singleQuote": true "singleQuote": true
} }

View File

@ -1,52 +1,52 @@
"use strict"; 'use strict';
module.exports = { module.exports = {
url: "https://lumen.netlify.com", url: 'https://lumen.netlify.com',
pathPrefix: "/", pathPrefix: '/',
title: "Blog by John Doe", title: 'Blog by John Doe',
subtitle: subtitle:
"Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.", 'Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.',
copyright: "© All rights reserved.", copyright: '© All rights reserved.',
disqusShortname: "", disqusShortname: '',
postsPerPage: 4, postsPerPage: 4,
googleAnalyticsId: "UA-73379983-2", googleAnalyticsId: 'UA-73379983-2',
useKatex: false, useKatex: false,
menu: [ menu: [
{ {
label: "Articles", label: 'Articles',
path: "/", path: '/',
}, },
{ {
label: "About me", label: 'About me',
path: "/pages/about", path: '/pages/about',
}, },
{ {
label: "Contact me", label: 'Contact me',
path: "/pages/contacts", path: '/pages/contacts',
}, },
], ],
author: { author: {
name: "John Doe", name: 'John Doe',
photo: "/photo.jpg", photo: '/photo.jpg',
bio: bio:
"Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.", 'Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.',
contacts: { contacts: {
email: "", email: '',
facebook: "#", facebook: '#',
telegram: "#", telegram: '#',
twitter: "#", twitter: '#',
github: "#", github: '#',
rss: "", rss: '',
vkontakte: "", vkontakte: '',
linkedin: "#", linkedin: '#',
instagram: "#", instagram: '#',
line: "", line: '',
gitlab: "", gitlab: '',
weibo: "", weibo: '',
codepen: "", codepen: '',
youtube: "", youtube: '',
soundcloud: "", soundcloud: '',
medium: "#", medium: '#',
}, },
}, },
}; };

View File

@ -80,6 +80,6 @@ const ICONS = {
'M2.846 6.887a.928.928 0 00-.303-.784l-2.24-2.7V3h6.958l5.378 11.795L17.367 3H24v.403L22.084 5.24a.561.561 0 00-.213.538v13.498a.56.56 0 00.213.537l1.871 1.837v.403h-9.412v-.403l1.939-1.882c.19-.19.19-.246.19-.537V8.321l-5.389 13.688h-.728L4.28 8.321v9.174c-.052.385.076.774.347 1.052l2.521 3.058v.404H0v-.404l2.521-3.058c.27-.279.39-.67.325-1.052V6.887z', 'M2.846 6.887a.928.928 0 00-.303-.784l-2.24-2.7V3h6.958l5.378 11.795L17.367 3H24v.403L22.084 5.24a.561.561 0 00-.213.538v13.498a.56.56 0 00.213.537l1.871 1.837v.403h-9.412v-.403l1.939-1.882c.19-.19.19-.246.19-.537V8.321l-5.389 13.688h-.728L4.28 8.321v9.174c-.052.385.076.774.347 1.052l2.521 3.058v.404H0v-.404l2.521-3.058c.27-.279.39-.67.325-1.052V6.887z',
viewBox: '0 0 24 24', viewBox: '0 0 24 24',
}, },
} };
export default ICONS export default ICONS;

View File

@ -1,5 +1,5 @@
// @flow strict // @flow strict
import { useStaticQuery, graphql } from 'gatsby' import { useStaticQuery, graphql } from 'gatsby';
const useSiteMetadata = () => { const useSiteMetadata = () => {
const { site } = useStaticQuery( const { site } = useStaticQuery(
@ -43,9 +43,9 @@ const useSiteMetadata = () => {
} }
} }
` `
) );
return site.siteMetadata return site.siteMetadata;
} };
export default useSiteMetadata export default useSiteMetadata;

View File

@ -1,59 +1,59 @@
// @flow strict // @flow strict
const getContactHref = (name: string, contact: string) => { const getContactHref = (name: string, contact: string) => {
let href let href;
switch (name) { switch (name) {
case 'twitter': case 'twitter':
href = `https://www.twitter.com/${contact}` href = `https://www.twitter.com/${contact}`;
break break;
case 'github': case 'github':
href = `https://github.com/${contact}` href = `https://github.com/${contact}`;
break break;
case 'vkontakte': case 'vkontakte':
href = `https://vk.com/${contact}` href = `https://vk.com/${contact}`;
break break;
case 'telegram': case 'telegram':
href = `https://t.me/${contact}` href = `https://t.me/${contact}`;
break break;
case 'email': case 'email':
href = `mailto:${contact}` href = `mailto:${contact}`;
break break;
case 'linkedin': case 'linkedin':
href = `https://www.linkedin.com/in/${contact}` href = `https://www.linkedin.com/in/${contact}`;
break break;
case 'instagram': case 'instagram':
href = `https://www.instagram.com/${contact}` href = `https://www.instagram.com/${contact}`;
break break;
case 'line': case 'line':
href = `line://ti/p/${contact}` href = `line://ti/p/${contact}`;
break break;
case 'facebook': case 'facebook':
href = `https://www.facebook.com/${contact}` href = `https://www.facebook.com/${contact}`;
break break;
case 'gitlab': case 'gitlab':
href = `https://www.gitlab.com/${contact}` href = `https://www.gitlab.com/${contact}`;
break break;
case 'weibo': case 'weibo':
href = `https://www.weibo.com/${contact}` href = `https://www.weibo.com/${contact}`;
break break;
case 'codepen': case 'codepen':
href = `https://www.codepen.io/${contact}` href = `https://www.codepen.io/${contact}`;
break break;
case 'youtube': case 'youtube':
href = `https://www.youtube.com/channel/${contact}` href = `https://www.youtube.com/channel/${contact}`;
break break;
case 'soundcloud': case 'soundcloud':
href = `https://soundcloud.com/${contact}` href = `https://soundcloud.com/${contact}`;
break break;
case 'medium': case 'medium':
href = `https://medium.com/${contact}` href = `https://medium.com/${contact}`;
break break;
default: default:
href = contact href = contact;
break break;
} }
return href return href;
} };
export default getContactHref export default getContactHref;

View File

@ -1,23 +1,23 @@
// @flow strict // @flow strict
import getContactHref from './get-contact-href' import getContactHref from './get-contact-href';
test('getContactHref', () => { test('getContactHref', () => {
expect(getContactHref('twitter', '#')).toBe('https://www.twitter.com/#') expect(getContactHref('twitter', '#')).toBe('https://www.twitter.com/#');
expect(getContactHref('github', '#')).toBe('https://github.com/#') expect(getContactHref('github', '#')).toBe('https://github.com/#');
expect(getContactHref('email', '#')).toBe('mailto:#') expect(getContactHref('email', '#')).toBe('mailto:#');
expect(getContactHref('vkontakte', '#')).toBe('https://vk.com/#') expect(getContactHref('vkontakte', '#')).toBe('https://vk.com/#');
expect(getContactHref('telegram', '#')).toBe('https://t.me/#') expect(getContactHref('telegram', '#')).toBe('https://t.me/#');
expect(getContactHref('rss', '#')).toBe('#') expect(getContactHref('rss', '#')).toBe('#');
expect(getContactHref('linkedin', '#')).toBe('https://www.linkedin.com/in/#') expect(getContactHref('linkedin', '#')).toBe('https://www.linkedin.com/in/#');
expect(getContactHref('instagram', '#')).toBe('https://www.instagram.com/#') expect(getContactHref('instagram', '#')).toBe('https://www.instagram.com/#');
expect(getContactHref('line', '#')).toBe('line://ti/p/#') expect(getContactHref('line', '#')).toBe('line://ti/p/#');
expect(getContactHref('facebook', '#')).toBe('https://www.facebook.com/#') expect(getContactHref('facebook', '#')).toBe('https://www.facebook.com/#');
expect(getContactHref('gitlab', '#')).toBe('https://www.gitlab.com/#') expect(getContactHref('gitlab', '#')).toBe('https://www.gitlab.com/#');
expect(getContactHref('weibo', '#')).toBe('https://www.weibo.com/#') expect(getContactHref('weibo', '#')).toBe('https://www.weibo.com/#');
expect(getContactHref('codepen', '#')).toBe('https://www.codepen.io/#') expect(getContactHref('codepen', '#')).toBe('https://www.codepen.io/#');
expect(getContactHref('youtube', '#')).toBe( expect(getContactHref('youtube', '#')).toBe(
'https://www.youtube.com/channel/#' 'https://www.youtube.com/channel/#'
) );
expect(getContactHref('soundcloud', '#')).toBe('https://soundcloud.com/#') expect(getContactHref('soundcloud', '#')).toBe('https://soundcloud.com/#');
expect(getContactHref('medium', '#')).toBe('https://medium.com/#') expect(getContactHref('medium', '#')).toBe('https://medium.com/#');
}) });

View File

@ -1,64 +1,64 @@
// @flow strict // @flow strict
import { ICONS } from '../constants' import { ICONS } from '../constants';
const getIcon = (name: string) => { const getIcon = (name: string) => {
let icon let icon;
switch (name) { switch (name) {
case 'twitter': case 'twitter':
icon = ICONS.TWITTER icon = ICONS.TWITTER;
break break;
case 'github': case 'github':
icon = ICONS.GITHUB icon = ICONS.GITHUB;
break break;
case 'vkontakte': case 'vkontakte':
icon = ICONS.VKONTAKTE icon = ICONS.VKONTAKTE;
break break;
case 'telegram': case 'telegram':
icon = ICONS.TELEGRAM icon = ICONS.TELEGRAM;
break break;
case 'email': case 'email':
icon = ICONS.EMAIL icon = ICONS.EMAIL;
break break;
case 'rss': case 'rss':
icon = ICONS.RSS icon = ICONS.RSS;
break break;
case 'linkedin': case 'linkedin':
icon = ICONS.LINKEDIN icon = ICONS.LINKEDIN;
break break;
case 'instagram': case 'instagram':
icon = ICONS.INSTAGRAM icon = ICONS.INSTAGRAM;
break break;
case 'line': case 'line':
icon = ICONS.LINE icon = ICONS.LINE;
break break;
case 'facebook': case 'facebook':
icon = ICONS.FACEBOOK icon = ICONS.FACEBOOK;
break break;
case 'gitlab': case 'gitlab':
icon = ICONS.GITLAB icon = ICONS.GITLAB;
break break;
case 'weibo': case 'weibo':
icon = ICONS.WEIBO icon = ICONS.WEIBO;
break break;
case 'codepen': case 'codepen':
icon = ICONS.CODEPEN icon = ICONS.CODEPEN;
break break;
case 'youtube': case 'youtube':
icon = ICONS.YOUTUBE icon = ICONS.YOUTUBE;
break break;
case 'soundcloud': case 'soundcloud':
icon = ICONS.SOUNDCLOUD icon = ICONS.SOUNDCLOUD;
break break;
case 'medium': case 'medium':
icon = ICONS.MEDIUM icon = ICONS.MEDIUM;
break break;
default: default:
icon = {} icon = {};
break break;
} }
return icon return icon;
} };
export default getIcon export default getIcon;

View File

@ -1,22 +1,22 @@
// @flow strict // @flow strict
import getIcon from './get-icon' import getIcon from './get-icon';
import { ICONS } from '../constants' import { ICONS } from '../constants';
test('getIcon', () => { test('getIcon', () => {
expect(getIcon('twitter')).toBe(ICONS.TWITTER) expect(getIcon('twitter')).toBe(ICONS.TWITTER);
expect(getIcon('github')).toBe(ICONS.GITHUB) expect(getIcon('github')).toBe(ICONS.GITHUB);
expect(getIcon('vkontakte')).toBe(ICONS.VKONTAKTE) expect(getIcon('vkontakte')).toBe(ICONS.VKONTAKTE);
expect(getIcon('telegram')).toEqual(ICONS.TELEGRAM) expect(getIcon('telegram')).toEqual(ICONS.TELEGRAM);
expect(getIcon('email')).toEqual(ICONS.EMAIL) expect(getIcon('email')).toEqual(ICONS.EMAIL);
expect(getIcon('rss')).toEqual(ICONS.RSS) expect(getIcon('rss')).toEqual(ICONS.RSS);
expect(getIcon('linkedin')).toEqual(ICONS.LINKEDIN) expect(getIcon('linkedin')).toEqual(ICONS.LINKEDIN);
expect(getIcon('instagram')).toEqual(ICONS.INSTAGRAM) expect(getIcon('instagram')).toEqual(ICONS.INSTAGRAM);
expect(getIcon('line')).toEqual(ICONS.LINE) expect(getIcon('line')).toEqual(ICONS.LINE);
expect(getIcon('facebook')).toEqual(ICONS.FACEBOOK) expect(getIcon('facebook')).toEqual(ICONS.FACEBOOK);
expect(getIcon('gitlab')).toEqual(ICONS.GITLAB) expect(getIcon('gitlab')).toEqual(ICONS.GITLAB);
expect(getIcon('weibo')).toEqual(ICONS.WEIBO) expect(getIcon('weibo')).toEqual(ICONS.WEIBO);
expect(getIcon('codepen')).toEqual(ICONS.CODEPEN) expect(getIcon('codepen')).toEqual(ICONS.CODEPEN);
expect(getIcon('youtube')).toEqual(ICONS.YOUTUBE) expect(getIcon('youtube')).toEqual(ICONS.YOUTUBE);
expect(getIcon('soundcloud')).toEqual(ICONS.SOUNDCLOUD) expect(getIcon('soundcloud')).toEqual(ICONS.SOUNDCLOUD);
expect(getIcon('medium')).toEqual(ICONS.MEDIUM) expect(getIcon('medium')).toEqual(ICONS.MEDIUM);
}) });