Add contact icons for Facebook, LinkedIn, Instagram and Line.

This commit is contained in:
Aleksander Helgaker 2019-08-23 21:59:21 +02:00
parent 0c93f9c8a9
commit 2d590f411e
7 changed files with 60 additions and 8 deletions

View File

@ -30,11 +30,15 @@ module.exports = {
bio: 'Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.',
contacts: {
email: '#',
facebook: '#',
telegram: '#',
twitter: '#',
github: '#',
rss: '#',
vkontakte: '#'
vkontakte: '#',
linkedin: '#',
instagram: '#',
line: '#'
}
}
};
};

View File

@ -27,7 +27,19 @@ const ICONS = {
RSS: {
path: 'M6 21c0 1.656-1.344 3-3 3s-3-1.344-3-3 1.344-3 3-3 3 1.344 3 3zM14 22.922c0.016 0.281-0.078 0.547-0.266 0.75-0.187 0.219-0.453 0.328-0.734 0.328h-2.109c-0.516 0-0.938-0.391-0.984-0.906-0.453-4.766-4.234-8.547-9-9-0.516-0.047-0.906-0.469-0.906-0.984v-2.109c0-0.281 0.109-0.547 0.328-0.734 0.172-0.172 0.422-0.266 0.672-0.266h0.078c3.328 0.266 6.469 1.719 8.828 4.094 2.375 2.359 3.828 5.5 4.094 8.828zM22 22.953c0.016 0.266-0.078 0.531-0.281 0.734-0.187 0.203-0.438 0.313-0.719 0.313h-2.234c-0.531 0-0.969-0.406-1-0.938-0.516-9.078-7.75-16.312-16.828-16.844-0.531-0.031-0.938-0.469-0.938-0.984v-2.234c0-0.281 0.109-0.531 0.313-0.719 0.187-0.187 0.438-0.281 0.688-0.281h0.047c5.469 0.281 10.609 2.578 14.484 6.469 3.891 3.875 6.188 9.016 6.469 14.484z',
viewBox: '0 0 22 28'
},
LINKEDIN: {
path: 'M4.98 3.5c0 1.381-1.11 2.5-2.48 2.5s-2.48-1.119-2.48-2.5c0-1.38 1.11-2.5 2.48-2.5s2.48 1.12 2.48 2.5zm.02 4.5h-5v16h5v-16zm7.982 0h-4.968v16h4.969v-8.399c0-4.67 6.029-5.052 6.029 0v8.399h4.988v-10.131c0-7.88-8.922-7.593-11.018-3.714v-2.155z',
viewBox: '0 0 24 24'
},
INSTAGRAM: {
path: 'M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z',
viewBox: '0 0 24 24'
},
LINE: {
path: 'M24 10.304c0-5.369-5.383-9.738-12-9.738-6.616 0-12 4.369-12 9.738 0 4.814 4.269 8.846 10.036 9.608.391.084.922.258 1.057.592.121.303.079.778.039 1.085l-.171 1.027c-.053.303-.242 1.186 1.039.647 1.281-.54 6.911-4.069 9.428-6.967 1.739-1.907 2.572-3.843 2.572-5.992zm-18.988-2.595c.129 0 .234.105.234.234v4.153h2.287c.129 0 .233.104.233.233v.842c0 .129-.104.234-.233.234h-3.363c-.063 0-.119-.025-.161-.065l-.001-.001-.002-.002-.001-.001-.003-.003c-.04-.042-.065-.099-.065-.161v-5.229c0-.129.104-.234.233-.234h.842zm14.992 0c.129 0 .233.105.233.234v.842c0 .129-.104.234-.233.234h-2.287v.883h2.287c.129 0 .233.105.233.234v.842c0 .129-.104.234-.233.234h-2.287v.884h2.287c.129 0 .233.105.233.233v.842c0 .129-.104.234-.233.234h-3.363c-.063 0-.12-.025-.162-.065l-.003-.004-.003-.003c-.04-.042-.066-.099-.066-.161v-5.229c0-.062.025-.119.065-.161l.004-.004.003-.003c.042-.04.099-.066.162-.066h3.363zm-10.442.001c.129 0 .234.104.234.233v5.229c0 .128-.105.233-.234.233h-.842c-.129 0-.234-.105-.234-.233v-5.229c0-.129.105-.233.234-.233h.842zm2.127 0h.008l.012.001.013.001.01.001.013.003.008.003.014.004.008.003.013.006.007.003.013.007.007.004.012.009.006.004.013.011.004.004.014.014.002.002.018.023 2.396 3.236v-3.106c0-.129.105-.233.234-.233h.841c.13 0 .234.104.234.233v5.229c0 .128-.104.233-.234.233h-.841l-.06-.008-.004-.001-.015-.005-.007-.003-.012-.004-.011-.006-.007-.003-.014-.009-.002-.002-.06-.058-2.399-3.24v3.106c0 .128-.104.233-.234.233h-.841c-.129 0-.234-.105-.234-.233v-5.229c0-.129.105-.233.234-.233h.841z',
viewBox: '0 0 24 24'
}
};
export default ICONS;
export default ICONS;

View File

@ -13,11 +13,15 @@ const useSiteMetadata = () => {
photo
contacts {
email
facebook
telegram
twitter
github
rss
vkontakte
linkedin
instagram
line
}
}
menu {
@ -38,4 +42,4 @@ const useSiteMetadata = () => {
return site.siteMetadata;
};
export default useSiteMetadata;
export default useSiteMetadata;

View File

@ -18,6 +18,18 @@ const getContactHref = (name: string, contact: string) => {
case 'email':
href = `mailto:${contact}`;
break;
case 'linkedin':
href = `https://www.linkedin.com/in/${contact}`;
break;
case 'instagram':
href = `https://www.instagram.com/${contact}`;
break;
case 'line':
href = `line://ti/p/${contact}`;
break;
case 'facebook':
href = `https://www.facebook.com/${contact}`;
break;
default:
href = contact;
break;
@ -26,4 +38,4 @@ const getContactHref = (name: string, contact: string) => {
return href;
};
export default getContactHref;
export default getContactHref;

View File

@ -8,4 +8,8 @@ test('getContactHref', () => {
expect(getContactHref('vkontakte', '#')).toBe('https://vk.com/#');
expect(getContactHref('telegram', '#')).toBe('https://t.me/#');
expect(getContactHref('rss', '#')).toBe('#');
});
expect(getContactHref('linkedin', '#')).toBe('#');
expect(getContactHref('instagram', '#')).toBe('#');
expect(getContactHref('line', '#')).toBe('#');
expect(getContactHref('facebook', '#')).toBe('#');
});

View File

@ -23,6 +23,18 @@ const getIcon = (name: string) => {
case 'rss':
icon = ICONS.RSS;
break;
case 'linkedin':
icon = ICONS.LINKEDIN;
break;
case 'instagram':
icon = ICONS.INSTAGRAM;
break;
case 'line':
icon = ICONS.LINE;
break;
case 'facebook':
icon = ICONS.FACEBOOK;
break;
default:
icon = {};
break;
@ -31,4 +43,4 @@ const getIcon = (name: string) => {
return icon;
};
export default getIcon;
export default getIcon;

View File

@ -9,4 +9,8 @@ test('getIcon', () => {
expect(getIcon('telegram')).toEqual(ICONS.TELEGRAM);
expect(getIcon('email')).toEqual(ICONS.EMAIL);
expect(getIcon('rss')).toEqual(ICONS.RSS);
});
expect(getIcon('linkedin')).toEqual(ICONS.LINKEDIN);
expect(getIcon('instagram')).toEqual(ICONS.INSTAGRAM);
expect(getIcon('line')).toEqual(ICONS.LINE);
expect(getIcon('facebook')).toEqual(ICONS.FACEBOOK);
});