Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DoctorDerek/5b91b9c75d438eb2e42053737dc7a69f to your computer and use it in GitHub Desktop.
Save DoctorDerek/5b91b9c75d438eb2e42053737dc7a69f to your computer and use it in GitHub Desktop.
The Tailwind CSS "JIT Mode" Bug That Only Happens in Production https://medium.com/p/4f25ef009fe8/
import Email from "./email.svg"
import Medium from "./medium.svg"
import Linkedin from "./linkedin.svg"
import Twitter from "./twitter.svg"
// Icons taken from: https://simpleicons.org/
const components = {
email: Email,
medium: Medium,
linkedin: Linkedin,
twitter: Twitter,
}
const classNames = (...classes) => classes.join(" ")
const SocialIcon = ({
kind = () => {
"Missing required kind prop in SocialIcon"
},
href,
}) => {
const SocialSvg = components[kind]
// brand colors for social icons, configured in tailwind.config.js
const socialColors = {
twitter: "bg-social-twitter",
linkedin: "bg-social-linkedin",
medium: "bg-social-medium",
email: "bg-social-email",
}
return (
<a
className={classNames(
"text-sm text-gray-100 rounded-full border-2 border-transparent hover:border-gray-100 border-solid transition duration-700",
socialColors[kind]
)}
target="_blank"
rel="noopener noreferrer"
href={href}
>
<span className="sr-only">{kind}</span>
<SocialSvg className="w-5 h-5 m-2 fill-current" />
</a>
)
}
export default SocialIcon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment