Skip to content

Commit

Permalink
feat: adding protection email from scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteLacroix committed Sep 21, 2024
1 parent 6cf472a commit d55c18c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/modules/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {LanguageIcon} from "./icons/personalDetailsIcons/LanguageIcon.tsx";
import {DownloadCVComponent} from "./DownloadCVComponent.tsx";
import {motion} from "framer-motion";
import {FlagIcon} from "@heroicons/react/16/solid";
import ProtectedEmailLink from "./ProtectedEmailLink.tsx";

export const Home = () => {
const cardVariants = {
Expand Down Expand Up @@ -67,9 +68,7 @@ export const Home = () => {
<CardFooter>
<div className="flex space-x-4">
<Button color={"primary"}>
<a href={`mailto:contact@baptiste-lacroix.fr?subject=${encodeURIComponent('Potential Hire')}`}>
Hire Me!
</a>
<ProtectedEmailLink message={'Hire Me !'}/>
</Button>
<DownloadCVComponent variant={"bordered"}/>
</div>
Expand Down Expand Up @@ -101,11 +100,9 @@ export const Home = () => {
<EmailIcon className={"w-[30px] h-[30px]"}/>
<p className="text-gray-600">
<strong className="text-gray-800 dark:text-blue-700">Email:</strong>
<a className={'dark:text-white'}
href={`mailto:contact@baptiste-lacroix.fr?subject=${encodeURIComponent('Potential Hire')}`}>
{" "}
contact@baptiste-lacroix.fr{" "}
</a>
<ProtectedEmailLink className={'dark:text-white'}
message={' contact@baptiste-lacroix.fr '}
subject={encodeURIComponent('Potential Hire')}/>
</p>
</div>
<div className="flex items-center space-x-3">
Expand Down
22 changes: 22 additions & 0 deletions src/modules/ProtectedEmailLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";

interface ProtectedEmailLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
message: string;
subject?: string
}

const ProtectedEmailLink: React.FC<ProtectedEmailLinkProps> = ({message, subject, ...props}) => {
const email = 'contact@baptiste-lacroix.fr';
const encodedEmail = email
.split('')
.map(char => `%${char.charCodeAt(0).toString(16).toUpperCase()}`)
.join('');

return (
<a href={`mailto:${encodedEmail}?subject=${subject}`} {...props}>
{message}
</a>
);
};

export default ProtectedEmailLink;
1 change: 0 additions & 1 deletion tsconfig.app.tsbuildinfo

This file was deleted.

0 comments on commit d55c18c

Please sign in to comment.