From 9b39a037e7f1e8180fe02e4b6afac4613567e487 Mon Sep 17 00:00:00 2001 From: Robert Veitch Date: Sat, 7 Dec 2019 01:48:40 -0600 Subject: [PATCH] Add youtube as a contact option --- config.js | 3 ++- src/constants/icons.js | 4 ++++ src/hooks/use-site-metadata.js | 1 + src/utils/get-contact-href.js | 3 +++ src/utils/get-contact-href.test.js | 1 + src/utils/get-icon.js | 3 +++ src/utils/get-icon.test.js | 1 + 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index cc75409..80a30e8 100644 --- a/config.js +++ b/config.js @@ -41,7 +41,8 @@ module.exports = { line: '', gitlab: '', weibo: '', - codepen: '' + codepen: '', + youtube: '' } } }; diff --git a/src/constants/icons.js b/src/constants/icons.js index aaac600..ea4b7fd 100644 --- a/src/constants/icons.js +++ b/src/constants/icons.js @@ -51,6 +51,10 @@ const ICONS = { 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', viewBox: '0 0 24 24' + }, + YOUTUBE: { + path: '', + viewBox: '' } }; diff --git a/src/hooks/use-site-metadata.js b/src/hooks/use-site-metadata.js index e9df08b..62ef29b 100644 --- a/src/hooks/use-site-metadata.js +++ b/src/hooks/use-site-metadata.js @@ -25,6 +25,7 @@ const useSiteMetadata = () => { gitlab weibo codepen + youtube } } menu { diff --git a/src/utils/get-contact-href.js b/src/utils/get-contact-href.js index bc485f5..0756d4e 100644 --- a/src/utils/get-contact-href.js +++ b/src/utils/get-contact-href.js @@ -39,6 +39,9 @@ const getContactHref = (name: string, contact: string) => { case 'codepen': href = `https://www.codepen.io/${contact}`; break; + case 'youtube': + href = `https://www.youtube.com/channel/${contact}`; + break; default: href = contact; break; diff --git a/src/utils/get-contact-href.test.js b/src/utils/get-contact-href.test.js index c386f66..695f6c9 100644 --- a/src/utils/get-contact-href.test.js +++ b/src/utils/get-contact-href.test.js @@ -15,4 +15,5 @@ test('getContactHref', () => { expect(getContactHref('gitlab', '#')).toBe('https://www.gitlab.com/#'); expect(getContactHref('weibo', '#')).toBe('https://www.weibo.com/#'); expect(getContactHref('codepen', '#')).toBe('https://www.codepen.io/#'); + expect(getContactHref('youtube', '#')).toBe('https://www.youtube.com/channel/#'); }); diff --git a/src/utils/get-icon.js b/src/utils/get-icon.js index 27ff304..1947bd8 100644 --- a/src/utils/get-icon.js +++ b/src/utils/get-icon.js @@ -44,6 +44,9 @@ const getIcon = (name: string) => { case 'codepen': icon = ICONS.CODEPEN; break; + case 'youtube': + icon = ICONS.YOUTUBE; + break; default: icon = {}; break; diff --git a/src/utils/get-icon.test.js b/src/utils/get-icon.test.js index abadc98..d7a75b2 100644 --- a/src/utils/get-icon.test.js +++ b/src/utils/get-icon.test.js @@ -16,4 +16,5 @@ test('getIcon', () => { expect(getIcon('gitlab')).toEqual(ICONS.GITLAB); expect(getIcon('weibo')).toEqual(ICONS.WEIBO); expect(getIcon('codepen')).toEqual(ICONS.CODEPEN); + expect(getIcon('youtube')).toEqual(ICONS.YOUTUBE); }); \ No newline at end of file