Merge pull request #393 from remi-bruguier/master

Add support for a codepen contact link
This commit is contained in:
Alexander Shelepenok 2019-11-11 22:21:28 +03:00 committed by GitHub
commit 6085489dfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 7 deletions

View File

@ -40,7 +40,8 @@ module.exports = {
instagram: '#',
line: '',
gitlab: '',
weibo: ''
weibo: '',
codepen: ''
}
}
};
};

View File

@ -47,7 +47,11 @@ const ICONS = {
WEIBO: {
path: 'M 16.28125 3.8125 C 16.054688 3.828125 15.816406 3.859375 15.59375 3.90625 C 15.179688 3.996094 14.910156 4.402344 15 4.8125 C 15.085938 5.226563 15.492188 5.496094 15.90625 5.40625 C 17.179688 5.136719 18.566406 5.53125 19.5 6.5625 C 20.433594 7.597656 20.679688 9.011719 20.28125 10.25 C 20.152344 10.652344 20.378906 11.089844 20.78125 11.21875 C 21.183594 11.347656 21.617188 11.121094 21.75 10.71875 C 22.3125 8.976563 21.96875 7.015625 20.65625 5.5625 C 19.671875 4.46875 18.296875 3.875 16.9375 3.8125 C 16.710938 3.800781 16.507813 3.796875 16.28125 3.8125 Z M 10.0625 6.09375 C 8.667969 6.242188 6.699219 7.332031 4.96875 9.0625 C 3.082031 10.949219 2 12.957031 2 14.6875 C 2 17.996094 6.226563 20 10.375 20 C 15.8125 20 19.4375 16.820313 19.4375 14.3125 C 19.4375 12.796875 18.179688 11.949219 17.03125 11.59375 C 16.75 11.507813 16.539063 11.464844 16.6875 11.09375 C 17.007813 10.289063 17.066406 9.589844 16.71875 9.09375 C 16.070313 8.164063 14.253906 8.210938 12.21875 9.0625 C 12.21875 9.0625 11.585938 9.351563 11.75 8.84375 C 12.0625 7.835938 12.019531 6.988281 11.53125 6.5 C 11.1875 6.152344 10.695313 6.027344 10.0625 6.09375 Z M 16.8125 6.5 C 16.589844 6.488281 16.375 6.515625 16.15625 6.5625 C 15.800781 6.636719 15.578125 7.019531 15.65625 7.375 C 15.734375 7.730469 16.082031 7.953125 16.4375 7.875 C 16.863281 7.785156 17.34375 7.902344 17.65625 8.25 C 17.96875 8.597656 18.042969 9.054688 17.90625 9.46875 C 17.792969 9.816406 17.964844 10.199219 18.3125 10.3125 C 18.660156 10.421875 19.046875 10.253906 19.15625 9.90625 C 19.429688 9.058594 19.265625 8.085938 18.625 7.375 C 18.144531 6.84375 17.476563 6.53125 16.8125 6.5 Z M 10.8125 10.90625 C 13.582031 11.003906 15.8125 12.378906 16 14.28125 C 16.214844 16.457031 13.71875 18.484375 10.40625 18.8125 C 7.09375 19.140625 4.214844 17.640625 4 15.46875 C 3.785156 13.292969 6.316406 11.265625 9.625 10.9375 C 10.039063 10.898438 10.417969 10.890625 10.8125 10.90625 Z M 8.9375 13 C 7.804688 13.101563 6.734375 13.75 6.25 14.6875 C 5.589844 15.964844 6.242188 17.378906 7.75 17.84375 C 9.308594 18.324219 11.140625 17.597656 11.78125 16.21875 C 12.410156 14.871094 11.605469 13.472656 10.0625 13.09375 C 9.691406 13 9.316406 12.964844 8.9375 13 Z M 8.21875 15.0625 C 8.351563 15.066406 8.472656 15.109375 8.59375 15.15625 C 9.082031 15.355469 9.234375 15.878906 8.9375 16.34375 C 8.632813 16.804688 7.988281 17.027344 7.5 16.8125 C 7.019531 16.601563 6.882813 16.074219 7.1875 15.625 C 7.414063 15.289063 7.824219 15.058594 8.21875 15.0625 Z',
viewBox: '2 2 19 19'
},
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'
}
};
export default ICONS;
export default ICONS;

View File

@ -24,6 +24,7 @@ const useSiteMetadata = () => {
line
gitlab
weibo
codepen
}
}
menu {
@ -44,4 +45,4 @@ const useSiteMetadata = () => {
return site.siteMetadata;
};
export default useSiteMetadata;
export default useSiteMetadata;

View File

@ -36,6 +36,9 @@ const getContactHref = (name: string, contact: string) => {
case 'weibo':
href = `https://www.weibo.com/${contact}`;
break;
case 'codepen':
href = `https://www.codepen.io/${contact}`;
break;
default:
href = contact;
break;
@ -44,4 +47,4 @@ const getContactHref = (name: string, contact: string) => {
return href;
};
export default getContactHref;
export default getContactHref;

View File

@ -14,4 +14,5 @@ test('getContactHref', () => {
expect(getContactHref('facebook', '#')).toBe('https://www.facebook.com/#');
expect(getContactHref('gitlab', '#')).toBe('https://www.gitlab.com/#');
expect(getContactHref('weibo', '#')).toBe('https://www.weibo.com/#');
});
expect(getContactHref('codepen', '#')).toBe('https://www.codepen.io/#');
});

View File

@ -41,6 +41,9 @@ const getIcon = (name: string) => {
case 'weibo':
icon = ICONS.WEIBO;
break;
case 'codepen':
icon = ICONS.CODEPEN;
break;
default:
icon = {};
break;
@ -49,4 +52,4 @@ const getIcon = (name: string) => {
return icon;
};
export default getIcon;
export default getIcon;

View File

@ -15,4 +15,5 @@ test('getIcon', () => {
expect(getIcon('facebook')).toEqual(ICONS.FACEBOOK);
expect(getIcon('gitlab')).toEqual(ICONS.GITLAB);
expect(getIcon('weibo')).toEqual(ICONS.WEIBO);
expect(getIcon('codepen')).toEqual(ICONS.CODEPEN);
});