add soundcloud to contacts

This commit is contained in:
Sean Dearnaley 2020-01-08 02:05:20 -05:00
parent b369a26785
commit deeaa9f947
7 changed files with 15 additions and 1 deletions

View File

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

View File

@ -55,6 +55,10 @@ const ICONS = {
YOUTUBE: { 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', 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' 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'
} }
}; };

View File

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

View File

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

View File

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

View File

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

View File

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