From deeaa9f94728fe11e1aa2e29857a6d110a54a6ad Mon Sep 17 00:00:00 2001 From: Sean Dearnaley Date: Wed, 8 Jan 2020 02:05:20 -0500 Subject: [PATCH] add soundcloud to contacts --- 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 80a30e8..2b14d97 100644 --- a/config.js +++ b/config.js @@ -42,7 +42,8 @@ module.exports = { gitlab: '', weibo: '', codepen: '', - youtube: '' + youtube: '', + soundcloud: '', } } }; diff --git a/src/constants/icons.js b/src/constants/icons.js index 6f68c1b..fda5a60 100644 --- a/src/constants/icons.js +++ b/src/constants/icons.js @@ -55,6 +55,10 @@ const ICONS = { YOUTUBE: { path: 'M21.582,6.186c-0.23-0.86-0.908-1.538-1.768-1.768C18.254,4,12,4,12,4S5.746,4,4.186,4.418 c-0.86,0.23-1.538,0.908-1.768,1.768C2,7.746,2,12,2,12s0,4.254,0.418,5.814c0.23,0.86,0.908,1.538,1.768,1.768 C5.746,20,12,20,12,20s6.254,0,7.814-0.418c0.861-0.23,1.538-0.908,1.768-1.768C22,16.254,22,12,22,12S22,7.746,21.582,6.186z M10,15.464V8.536L16,12L10,15.464z', viewBox: '0 0 24 24' + }, + SOUNDCLOUD: { + path: 'M 14.5 6 C 12.601563 6 11 6.90625 10 8.40625 L 10 17 L 20.5 17 C 22.398438 17 24 15.398438 24 13.5 C 24 11.601563 22.398438 10 20.5 10 C 20.300781 10 20.011719 9.992188 19.8125 10.09375 C 19.210938 7.695313 17 6 14.5 6 Z M 8 8 L 8 17 L 9 17 L 9 8.09375 C 8.699219 7.992188 8.300781 8 8 8 Z M 7 8.09375 C 6.601563 8.195313 6.300781 8.398438 6 8.5 L 6 17 L 7 17 Z M 5 9.40625 C 4.5 9.90625 4.195313 10.488281 4.09375 11.1875 L 4 11.1875 L 4 17 L 5 17 Z M 3 11 C 2.601563 11 2.300781 11.085938 2 11.1875 L 2 16.8125 C 2.300781 16.914063 2.601563 17 3 17 Z M 1 11.8125 C 0.398438 12.3125 0 13.101563 0 14 C 0 14.898438 0.398438 15.6875 1 16.1875 Z', + viewBox: '0 0 24 24' } }; diff --git a/src/hooks/use-site-metadata.js b/src/hooks/use-site-metadata.js index 62ef29b..4174c55 100644 --- a/src/hooks/use-site-metadata.js +++ b/src/hooks/use-site-metadata.js @@ -26,6 +26,7 @@ const useSiteMetadata = () => { weibo codepen youtube + soundcloud } } menu { diff --git a/src/utils/get-contact-href.js b/src/utils/get-contact-href.js index 0756d4e..2d66239 100644 --- a/src/utils/get-contact-href.js +++ b/src/utils/get-contact-href.js @@ -42,6 +42,9 @@ const getContactHref = (name: string, contact: string) => { case 'youtube': href = `https://www.youtube.com/channel/${contact}`; break; + case 'soundcloud': + href = `https://soundcloud.com/${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 695f6c9..df37472 100644 --- a/src/utils/get-contact-href.test.js +++ b/src/utils/get-contact-href.test.js @@ -16,4 +16,5 @@ test('getContactHref', () => { 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/#'); + expect(getContactHref('soundcloud', '#')).toBe('https://soundcloud.com/#'); }); diff --git a/src/utils/get-icon.js b/src/utils/get-icon.js index 1947bd8..28ed779 100644 --- a/src/utils/get-icon.js +++ b/src/utils/get-icon.js @@ -47,6 +47,9 @@ const getIcon = (name: string) => { case 'youtube': icon = ICONS.YOUTUBE; break; + case 'soundcloud': + icon = ICONS.SOUNDCLOUD; + break; default: icon = {}; break; diff --git a/src/utils/get-icon.test.js b/src/utils/get-icon.test.js index d7a75b2..5c73058 100644 --- a/src/utils/get-icon.test.js +++ b/src/utils/get-icon.test.js @@ -17,4 +17,5 @@ test('getIcon', () => { expect(getIcon('weibo')).toEqual(ICONS.WEIBO); expect(getIcon('codepen')).toEqual(ICONS.CODEPEN); expect(getIcon('youtube')).toEqual(ICONS.YOUTUBE); + expect(getIcon('soundcloud')).toEqual(ICONS.SOUNDCLOUD); }); \ No newline at end of file