Fix drag-performance (#1184)

* Fix drag-performance

* Fixes

* Fixes

* Fixes

* Fixes
This commit is contained in:
Charles Bochet
2023-08-13 05:28:33 +02:00
committed by GitHub
parent bf09a4d6a2
commit e6b20b5ff2
25 changed files with 260 additions and 175 deletions

View File

@ -30,16 +30,25 @@ export function SocialLink({ children, href, onClick, type }: OwnProps) {
let displayValue = children;
if (type === 'linkedin') {
const splitUrl = href.split('/');
const splitName = splitUrl[4].split('-');
displayValue = splitName[2]
? `${splitName[0]}-${splitName[1]}`
: splitName[0];
const matches = href.match(
/(?:https?:\/\/)?(?:www.)?linkedin.com\/(?:in|company)\/([-a-zA-Z0-9@:%_+.~#?&//=]*)/,
);
if (matches && matches[1]) {
displayValue = matches[1];
} else {
displayValue = 'LinkedIn';
}
}
if (type === 'twitter') {
const splitUrl = href.split('/');
displayValue = `@${splitUrl[3]}`;
const matches = href.match(
/(?:https?:\/\/)?(?:www.)?twitter.com\/([-a-zA-Z0-9@:%_+.~#?&//=]*)/,
);
if (matches && matches[1]) {
displayValue = `@${matches[1]}`;
} else {
displayValue = '@twitter';
}
}
return (