mirror of https://github.com/mkrhere/pw2
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
2.8 KiB
131 lines
2.8 KiB
4 years ago
|
import React from "react";
|
||
4 years ago
|
import { css } from "@emotion/css";
|
||
5 years ago
|
import { useEffect, useState } from "react";
|
||
3 years ago
|
import Container from "../../components/Container";
|
||
5 years ago
|
|
||
|
const A = css`
|
||
|
text-decoration: none;
|
||
|
`;
|
||
|
|
||
4 years ago
|
type Contact = {
|
||
|
[k: string]: { value: string; link?: string; replacer?: Record<string, string> };
|
||
|
};
|
||
|
|
||
|
const CONTACT: Contact = {
|
||
|
Twitter: { value: "MKRhere", link: "https://twitter.com/MKRhere" },
|
||
|
GitHub: { value: "MKRhere", link: "https://github.com/MKRhere" },
|
||
|
Email: {
|
||
|
value: "mυthυkυmαr@thεfεαthεrs.in",
|
||
|
link: "mailto:mυthυkυmαr@thεfεαthεrs.in",
|
||
|
replacer: {
|
||
|
υ: "u",
|
||
|
ε: "e",
|
||
|
α: "a",
|
||
5 years ago
|
},
|
||
4 years ago
|
},
|
||
|
Phone: {
|
||
|
value: "+9Ι Γ8Δ5 Γ9 8Δ88",
|
||
|
link: "tel:+91Γ8Δ5Γ98Δ88",
|
||
|
replacer: {
|
||
|
Ι: "1",
|
||
|
Δ: "4",
|
||
|
Γ: "7",
|
||
5 years ago
|
},
|
||
4 years ago
|
},
|
||
|
};
|
||
|
|
||
|
const Home: React.FunctionComponent = () => {
|
||
|
const [contact, setContact] = useState<Contact>(CONTACT);
|
||
5 years ago
|
|
||
|
useEffect(() => {
|
||
|
const deob = () => {
|
||
|
Object.keys(contact).forEach(key => {
|
||
4 years ago
|
const sect = contact[key];
|
||
|
const replacers = sect.replacer;
|
||
5 years ago
|
if (replacers) {
|
||
4 years ago
|
sect.value = sect.value.replace(
|
||
5 years ago
|
new RegExp(Object.keys(replacers).join("|"), "g"),
|
||
|
r => replacers[r] || r,
|
||
|
);
|
||
4 years ago
|
if (sect.link)
|
||
|
sect.link = sect.link.replace(
|
||
5 years ago
|
new RegExp(Object.keys(replacers).join("|"), "g"),
|
||
|
r => replacers[r] || r,
|
||
|
);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
setContact({ ...contact });
|
||
|
};
|
||
|
|
||
|
document.addEventListener("mousemove", deob, { once: true });
|
||
|
document.addEventListener("scroll", deob, { once: true });
|
||
|
document.addEventListener("click", deob, { once: true });
|
||
|
document.addEventListener("touchstart", deob, { once: true });
|
||
|
|
||
|
return () => {
|
||
|
document.removeEventListener("mousemove", deob);
|
||
|
document.removeEventListener("scroll", deob);
|
||
|
document.removeEventListener("click", deob);
|
||
|
document.removeEventListener("touchstart", deob);
|
||
|
};
|
||
|
}, []);
|
||
|
|
||
|
return (
|
||
|
<Container
|
||
|
next="/"
|
||
|
arrowReversed={true}
|
||
|
className={css`
|
||
|
min-height: 50vh;
|
||
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
`}>
|
||
|
<h1>MKRhere</h1>
|
||
|
<div
|
||
|
className={css`
|
||
|
margin-top: auto;
|
||
|
display: flex;
|
||
|
|
||
|
ul {
|
||
|
padding: 0;
|
||
|
margin-left: 1rem;
|
||
|
|
||
|
li {
|
||
|
list-style: none;
|
||
|
}
|
||
|
}
|
||
|
`}>
|
||
|
<ul
|
||
|
className={css`
|
||
|
text-align: right;
|
||
|
`}>
|
||
|
{Object.keys(contact).map(key => (
|
||
|
<li key={key}>
|
||
|
<b>{key}.</b>
|
||
|
</li>
|
||
|
))}
|
||
|
</ul>
|
||
|
<ul>
|
||
|
{Object.keys(contact).map(key => {
|
||
|
const value = contact[key];
|
||
|
|
||
|
return (
|
||
|
<li key={key}>
|
||
|
{value.link ? (
|
||
|
<a className={A} href={value.link} target="_blank" rel="noreferrer">
|
||
|
{value.value}
|
||
|
</a>
|
||
|
) : (
|
||
|
value.value
|
||
|
)}
|
||
|
</li>
|
||
|
);
|
||
|
})}
|
||
|
</ul>
|
||
|
</div>
|
||
|
</Container>
|
||
|
);
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
|
export default Home;
|