Merge pull request #499 from rtveitch/master

Add youtube as a contact option
This commit is contained in:
Alexander Shelepenok 2019-12-12 19:19:14 +03:00 committed by GitHub
commit e5122ae1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 1 deletions

View File

@ -41,7 +41,8 @@ module.exports = {
line: '', line: '',
gitlab: '', gitlab: '',
weibo: '', weibo: '',
codepen: '' codepen: '',
youtube: ''
} }
} }
}; };

View File

@ -51,6 +51,10 @@ const ICONS = {
CODEPEN: { CODEPEN: {
path: 'M24 8.182l-.018-.087-.017-.05c-.01-.024-.018-.05-.03-.075-.003-.018-.015-.034-.02-.05l-.035-.067-.03-.05-.044-.06-.046-.045-.06-.045-.046-.03-.06-.044-.044-.04-.015-.02L12.58.19c-.347-.232-.796-.232-1.142 0L.453 7.502l-.015.015-.044.035-.06.05-.038.04-.05.056-.037.045-.05.06c-.02.017-.03.03-.03.046l-.05.06-.02.06c-.02.01-.02.04-.03.07l-.01.05C0 8.12 0 8.15 0 8.18v7.497c0 .044.003.09.01.135l.01.046c.005.03.01.06.02.086l.015.05c.01.027.016.053.027.075l.022.05c0 .01.015.04.03.06l.03.04c.015.01.03.04.045.06l.03.04.04.04c.01.013.01.03.03.03l.06.042.04.03.01.014 10.97 7.33c.164.12.375.163.57.163s.39-.06.57-.18l10.99-7.28.014-.01.046-.037.06-.043.048-.036.052-.058.033-.045.04-.06.03-.05.03-.07.016-.052.03-.077.015-.045.03-.08v-7.5c0-.05 0-.095-.016-.14l-.014-.045.044.003zm-11.99 6.28l-3.65-2.44 3.65-2.442 3.65 2.44-3.65 2.44zm-1.034-6.674l-4.473 2.99L2.89 8.362l8.086-5.39V7.79zm-6.33 4.233l-2.582 1.73V10.3l2.582 1.726zm1.857 1.25l4.473 2.99v4.82L2.89 15.69l3.618-2.417v-.004zm6.537 2.99l4.474-2.98 3.613 2.42-8.087 5.39v-4.82zm6.33-4.23l2.583-1.72v3.456l-2.583-1.73zm-1.855-1.24L13.042 7.8V2.97l8.085 5.39-3.612 2.415v.003z', path: 'M24 8.182l-.018-.087-.017-.05c-.01-.024-.018-.05-.03-.075-.003-.018-.015-.034-.02-.05l-.035-.067-.03-.05-.044-.06-.046-.045-.06-.045-.046-.03-.06-.044-.044-.04-.015-.02L12.58.19c-.347-.232-.796-.232-1.142 0L.453 7.502l-.015.015-.044.035-.06.05-.038.04-.05.056-.037.045-.05.06c-.02.017-.03.03-.03.046l-.05.06-.02.06c-.02.01-.02.04-.03.07l-.01.05C0 8.12 0 8.15 0 8.18v7.497c0 .044.003.09.01.135l.01.046c.005.03.01.06.02.086l.015.05c.01.027.016.053.027.075l.022.05c0 .01.015.04.03.06l.03.04c.015.01.03.04.045.06l.03.04.04.04c.01.013.01.03.03.03l.06.042.04.03.01.014 10.97 7.33c.164.12.375.163.57.163s.39-.06.57-.18l10.99-7.28.014-.01.046-.037.06-.043.048-.036.052-.058.033-.045.04-.06.03-.05.03-.07.016-.052.03-.077.015-.045.03-.08v-7.5c0-.05 0-.095-.016-.14l-.014-.045.044.003zm-11.99 6.28l-3.65-2.44 3.65-2.442 3.65 2.44-3.65 2.44zm-1.034-6.674l-4.473 2.99L2.89 8.362l8.086-5.39V7.79zm-6.33 4.233l-2.582 1.73V10.3l2.582 1.726zm1.857 1.25l4.473 2.99v4.82L2.89 15.69l3.618-2.417v-.004zm6.537 2.99l4.474-2.98 3.613 2.42-8.087 5.39v-4.82zm6.33-4.23l2.583-1.72v3.456l-2.583-1.73zm-1.855-1.24L13.042 7.8V2.97l8.085 5.39-3.612 2.415v.003z',
viewBox: '0 0 24 24' viewBox: '0 0 24 24'
},
YOUTUBE: {
path: '',
viewBox: ''
} }
}; };

View File

@ -25,6 +25,7 @@ const useSiteMetadata = () => {
gitlab gitlab
weibo weibo
codepen codepen
youtube
} }
} }
menu { menu {

View File

@ -39,6 +39,9 @@ const getContactHref = (name: string, contact: string) => {
case 'codepen': case 'codepen':
href = `https://www.codepen.io/${contact}`; href = `https://www.codepen.io/${contact}`;
break; break;
case 'youtube':
href = `https://www.youtube.com/channel/${contact}`;
break;
default: default:
href = contact; href = contact;
break; break;

View File

@ -15,4 +15,5 @@ test('getContactHref', () => {
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('https://www.youtube.com/channel/#');
}); });

View File

@ -44,6 +44,9 @@ const getIcon = (name: string) => {
case 'codepen': case 'codepen':
icon = ICONS.CODEPEN; icon = ICONS.CODEPEN;
break; break;
case 'youtube':
icon = ICONS.YOUTUBE;
break;
default: default:
icon = {}; icon = {};
break; break;

View File

@ -16,4 +16,5 @@ test('getIcon', () => {
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);
}); });