mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-28 14:45:52 -04:00
fix magic wand cursor 🪄
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
import { memo } from "react";
|
import { memo } from "react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import css from "styled-jsx/css";
|
|
||||||
import classNames from "classnames";
|
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -14,9 +12,8 @@ type Props = {
|
|||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// spits out properties for link's color and background-image in a linear-gradient (that's not really a gradient) with
|
// spits out alpha'd version of given color in rgba() format within a linear-gradient (that's not really a gradient)
|
||||||
// translucent color in rgba() format.
|
const getLinearGradient = (hex: string, alpha = 0.4) => {
|
||||||
const getColorProperties = (hex: string, alpha = 0.4) => {
|
|
||||||
// hex -> rgb, pulled from https://github.com/sindresorhus/hex-rgb/blob/main/index.js#L29
|
// hex -> rgb, pulled from https://github.com/sindresorhus/hex-rgb/blob/main/index.js#L29
|
||||||
const number = Number.parseInt(hex.replace(/^#/, ""), 16);
|
const number = Number.parseInt(hex.replace(/^#/, ""), 16);
|
||||||
const red = number >> 16;
|
const red = number >> 16;
|
||||||
@@ -25,30 +22,31 @@ const getColorProperties = (hex: string, alpha = 0.4) => {
|
|||||||
|
|
||||||
const rgbaString = `rgba(${red},${green},${blue},${alpha})`;
|
const rgbaString = `rgba(${red},${green},${blue},${alpha})`;
|
||||||
|
|
||||||
// prettier-ignore
|
return `linear-gradient(${rgbaString},${rgbaString})`;
|
||||||
return `
|
|
||||||
color:${hex};
|
|
||||||
background-image:linear-gradient(${rgbaString},${rgbaString})`.trim();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorfulLink = ({ href, lightColor, darkColor, external, className, ...rest }: Props) => {
|
const ColorfulLink = ({ href, lightColor, darkColor, external, className, ...rest }: Props) => {
|
||||||
// prettier-ignore
|
|
||||||
const { className: underlineClassName, styles: underlineStyles } = css.resolve`
|
|
||||||
a {${getColorProperties(lightColor)}}
|
|
||||||
:global([data-theme="dark"]) a {${getColorProperties(darkColor)}}`;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link href={href} passHref={true} prefetch={false}>
|
<Link href={href} passHref={true} prefetch={false}>
|
||||||
<a
|
<a
|
||||||
className={classNames(underlineClassName, className)}
|
className={className}
|
||||||
target={external ? "_blank" : undefined}
|
target={external ? "_blank" : undefined}
|
||||||
rel={external ? "noopener noreferrer" : undefined}
|
rel={external ? "noopener noreferrer" : undefined}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{underlineStyles}
|
<style jsx>{`
|
||||||
|
a {
|
||||||
|
color: ${lightColor};
|
||||||
|
background-image: ${getLinearGradient(lightColor)};
|
||||||
|
}
|
||||||
|
:global([data-theme="dark"]) a {
|
||||||
|
color: ${darkColor};
|
||||||
|
background-image: ${getLinearGradient(darkColor)};
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const CustomImage = ({
|
|||||||
height,
|
height,
|
||||||
placeholder,
|
placeholder,
|
||||||
alt,
|
alt,
|
||||||
|
layout,
|
||||||
quality,
|
quality,
|
||||||
priority,
|
priority,
|
||||||
className,
|
className,
|
||||||
@@ -17,13 +18,13 @@ const CustomImage = ({
|
|||||||
}: NextImageProps) => {
|
}: NextImageProps) => {
|
||||||
// passed directly into next/image: https://nextjs.org/docs/api-reference/next/image
|
// passed directly into next/image: https://nextjs.org/docs/api-reference/next/image
|
||||||
const imageProps: Partial<NextImageProps> = {
|
const imageProps: Partial<NextImageProps> = {
|
||||||
width: typeof width === "string" ? parseInt(width) : width,
|
width: typeof width === "string" ? Number.parseInt(width) : width,
|
||||||
height: typeof height === "string" ? parseInt(height) : height,
|
height: typeof height === "string" ? Number.parseInt(height) : height,
|
||||||
layout: "intrinsic",
|
|
||||||
alt: alt || "",
|
alt: alt || "",
|
||||||
|
layout: layout || "intrinsic",
|
||||||
quality: quality || 65,
|
quality: quality || 65,
|
||||||
loading: priority ? "eager" : "lazy",
|
|
||||||
priority: !!priority,
|
priority: !!priority,
|
||||||
|
loading: priority ? "eager" : "lazy",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof src === "object") {
|
if (typeof src === "object") {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jakejarvis/eslint-config": "github:jakejarvis/eslint-config#main",
|
"@jakejarvis/eslint-config": "github:jakejarvis/eslint-config#main",
|
||||||
"@svgr/webpack": "^6.2.0",
|
"@svgr/webpack": "^6.2.0",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.11",
|
||||||
"@types/prop-types": "^15.7.4",
|
"@types/prop-types": "^15.7.4",
|
||||||
"@types/react": "^17.0.38",
|
"@types/react": "^17.0.38",
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
|
|||||||
@@ -343,8 +343,8 @@ const Index = () => (
|
|||||||
}
|
}
|
||||||
.home .birthday :global(a:hover) {
|
.home .birthday :global(a:hover) {
|
||||||
/* magic wand cursor easter egg */
|
/* magic wand cursor easter egg */
|
||||||
cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='font-size:24px'><text y='50%' transform='rotate(-70 0 0) translate(-18, 5)'>🪄</text></svg>")
|
cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='30' style='font-size:24px'><text y='50%' transform='rotate(-70 0 0) translate(-20, 6)'>🪄</text></svg>")
|
||||||
16 0,
|
5 5,
|
||||||
auto;
|
auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const getStaticProps: GetStaticProps = async () => {
|
|||||||
// parse the year of each note and group them together
|
// parse the year of each note and group them together
|
||||||
const notesByYear = {};
|
const notesByYear = {};
|
||||||
getAllNotes().map((note) => {
|
getAllNotes().map((note) => {
|
||||||
const year = parseInt(format(new Date(note.date), "yyyy"));
|
const year = Number.parseInt(format(new Date(note.date), "yyyy"));
|
||||||
(notesByYear[year] || (notesByYear[year] = [])).push(note);
|
(notesByYear[year] || (notesByYear[year] = [])).push(note);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
14
yarn.lock
14
yarn.lock
@@ -1539,10 +1539,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197"
|
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197"
|
||||||
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==
|
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==
|
||||||
|
|
||||||
"@types/node@^17.0.10":
|
"@types/node@^17.0.11":
|
||||||
version "17.0.10"
|
version "17.0.11"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.10.tgz#616f16e9d3a2a3d618136b1be244315d95bd7cab"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.11.tgz#e0630988ea4c75efde22d5b099360ecfe494160f"
|
||||||
integrity sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==
|
integrity sha512-TgLsFcuinMobmML3PsILoRJq/h11/qS7UDlak1LUsazJcvJeKejEBuI1m5X2pBnMBF5T5HRAvtcnr4cV5nvc8Q==
|
||||||
|
|
||||||
"@types/normalize-package-data@^2.4.0":
|
"@types/normalize-package-data@^2.4.0":
|
||||||
version "2.4.1"
|
version "2.4.1"
|
||||||
@@ -2531,9 +2531,9 @@ eastasianwidth@^0.2.0:
|
|||||||
integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
|
integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
|
||||||
|
|
||||||
electron-to-chromium@^1.4.17:
|
electron-to-chromium@^1.4.17:
|
||||||
version "1.4.51"
|
version "1.4.52"
|
||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.51.tgz#a432f5a5d983ace79278a33057300cf949627e63"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.52.tgz#ce44c6d6cc449e7688a4356b8c261cfeafa26833"
|
||||||
integrity sha512-JNEmcYl3mk1tGQmy0EvL5eik/CKSBuzAyGP0QFdG6LIgxQe3II0BL1m2zKc2MZMf3uGqHWE1TFddJML0RpjSHQ==
|
integrity sha512-JGkh8HEh5PnVrhU4HbpyyO0O791dVY6k7AdqfDeqbcRMeoGxtNHWT77deR2nhvbLe4dKpxjlDEvdEwrvRLGu2Q==
|
||||||
|
|
||||||
email-regex@^5.0.0:
|
email-regex@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user