Merge branch 'main' of https://github.com/csarnataro/gitprofile into add-skype-and-telegram-to-social-links

This commit is contained in:
Christian Sarnataro
2023-02-15 09:59:51 +01:00
11 changed files with 396 additions and 336 deletions

View File

@@ -11,6 +11,7 @@ import Certification from './certification';
import Education from './education';
import Project from './project';
import Blog from './blog';
import Footer from './footer';
import {
genericError,
getInitialTheme,
@@ -19,7 +20,6 @@ import {
setupHotjar,
tooManyRequestError,
sanitizeConfig,
skeleton,
} from '../helpers/utils';
import { HelmetProvider } from 'react-helmet-async';
import PropTypes from 'prop-types';
@@ -221,24 +221,7 @@ const GitProfile = ({ config }) => {
className={`p-4 footer ${bgColor} text-base-content footer-center`}
>
<div className="card compact bg-base-100 shadow">
<a
className="card-body"
href="https://github.com/arifszn/gitprofile"
target="_blank"
rel="noreferrer"
>
<div>
{loading ? (
skeleton({ width: 'w-52', height: 'h-6' })
) : (
<p className="font-mono text-sm">
Made with{' '}
<span className="text-primary">GitProfile</span> and
</p>
)}
</div>
</a>
<Footer content={sanitizedConfig.footer} loading={loading} />
</div>
</footer>
</Fragment>
@@ -263,6 +246,7 @@ GitProfile.propTypes = {
social: PropTypes.shape({
linkedin: PropTypes.string,
twitter: PropTypes.string,
mastodon: PropTypes.string,
facebook: PropTypes.string,
instagram: PropTypes.string,
dribbble: PropTypes.string,
@@ -274,6 +258,9 @@ GitProfile.propTypes = {
phone: PropTypes.string,
email: PropTypes.string,
}),
resume: PropTypes.shape({
fileUrl: PropTypes.string,
}),
skills: PropTypes.array,
externalProjects: PropTypes.arrayOf(
PropTypes.shape({
@@ -335,6 +322,7 @@ GitProfile.propTypes = {
'--rounded-btn': PropTypes.string,
}),
}),
footer: PropTypes.string,
}).isRequired,
};

View File

@@ -183,7 +183,7 @@ const Blog = ({ loading, blog, googleAnalytics }) => {
<div
className={`card compact bg-base-100 ${
loading || (articles && articles.length)
? 'card compact shadow bg-opacity-40'
? 'shadow bg-opacity-40'
: 'shadow-lg'
}`}
>

View File

@@ -16,12 +16,39 @@ import {
FaFacebook,
FaGlobe,
FaSkype,
FaMastodon,
FaStackOverflow,
FaTelegram,
} from 'react-icons/fa';
import PropTypes from 'prop-types';
import { skeleton } from '../../helpers/utils';
const isCompanyMention = (company) => {
return company.startsWith('@') && !company.includes(' ');
};
const companyLink = (company) => {
return `https://github.com/${company.substring(1)}`;
};
const getMastodonValue = (mastodonURL) => {
const regex = /(https?:\/\/)?(www\.)?([^\s/]+)\/@(\w+)/;
const match = mastodonURL.match(regex);
if (match) {
const domain = match[3];
const username = match[4];
return `${domain}/@${username}`;
}
return mastodonURL;
};
const getMastodonLink = (mastodonURL) => {
return mastodonURL.replace(/^(https?:\/\/)?(www\.)?/, 'https://');
};
const ListItem = ({ icon, title, value, link, skeleton = false }) => {
return (
<a
@@ -36,27 +63,16 @@ const ListItem = ({ icon, title, value, link, skeleton = false }) => {
className={`${
skeleton ? 'flex-grow' : ''
} text-sm font-normal text-right mr-2 ml-3 ${link ? 'truncate' : ''}`}
style={{
wordBreak: 'break-word',
}}
>
<div
style={{
wordBreak: 'break-word',
}}
>
{value}
</div>
{value}
</div>
</a>
);
};
const isCompanyMention = (company) => {
return company.startsWith('@') && !company.includes(' ');
};
const companyLink = (company) => {
return `https://github.com/${company.substring(1)}`;
};
const Details = ({ profile, loading, social, github }) => {
const renderSkeleton = () => {
let array = [];
@@ -116,6 +132,14 @@ const Details = ({ profile, loading, social, github }) => {
link={`https://twitter.com/${social.twitter}`}
/>
)}
{social?.mastodon && (
<ListItem
icon={<FaMastodon className="mr-2" />}
title="Mastodon:"
value={getMastodonValue(social.mastodon)}
link={getMastodonLink(social.mastodon)}
/>
)}
{social?.linkedin && (
<ListItem
icon={<GrLinkedinOption className="mr-2" />}

View File

@@ -134,7 +134,7 @@ const ExternalProject = ({ externalProjects, loading, googleAnalytics }) => {
<div className="col-span-1 lg:col-span-2">
<div className="grid grid-cols-2 gap-6">
<div className="col-span-2">
<div className="card compact bg-gradient-to-br to-base-200 from-base-100 shadow">
<div className="card compact bg-base-100 shadow bg-opacity-40">
<div className="card-body">
<div className="mx-3 flex items-center justify-between mb-2">
<h5 className="card-title">

View File

@@ -0,0 +1,24 @@
import PropTypes from 'prop-types';
import { skeleton } from '../../helpers/utils';
const Footer = ({ content, loading }) => {
if (!content) return null;
return (
<div className="card-body">
{loading ? (
skeleton({ width: 'w-52', height: 'h-6' })
) : (
<div dangerouslySetInnerHTML={{ __html: content }} />
)}
</div>
);
};
Footer.propTypes = {
content: PropTypes.string,
loading: PropTypes.bool.isRequired,
};
export default Footer;

View File

@@ -96,7 +96,7 @@ const Project = ({ repo, loading, github, googleAnalytics }) => {
{item.description}
</p>
</div>
<div className="flex justify-between text-sm text-base-content text-opacity-60">
<div className="flex justify-between text-sm text-base-content text-opacity-60 truncate">
<div className="flex flex-grow">
<span className="mr-3 flex items-center">
<AiOutlineStar className="mr-0.5" />
@@ -146,7 +146,7 @@ const Project = ({ repo, loading, github, googleAnalytics }) => {
href={`https://github.com/${github.username}?tab=repositories`}
target="_blank"
rel="noreferrer"
className="text-base-content opacity-50"
className="text-base-content opacity-50 hover:underline"
>
See All
</a>