mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-09-16 19:45:33 -04:00
fix stitches variable conflicts
This commit is contained in:
@@ -13,12 +13,15 @@ const StyledLink = styled(NextLink, {
|
|||||||
// fancy animated link underline effect (on by default)
|
// fancy animated link underline effect (on by default)
|
||||||
true: {
|
true: {
|
||||||
// sets psuedo linear-gradient() for the underline's color; see stitches config for the weird calculation behind
|
// sets psuedo linear-gradient() for the underline's color; see stitches config for the weird calculation behind
|
||||||
// the local `$$underline` variable.
|
// the local `$$underlineColor` variable.
|
||||||
setUnderlineVar: { color: "$colors$linkUnderline" },
|
setUnderlineVars: {},
|
||||||
backgroundImage: `linear-gradient($$underline, $$underline)`,
|
// underline height is based on link's font size
|
||||||
|
$$underlineSize: "calc(0.1em + 0.05rem)",
|
||||||
|
|
||||||
|
backgroundImage: `linear-gradient($$underlineColor, $$underlineColor)`,
|
||||||
backgroundPosition: "0% 100%",
|
backgroundPosition: "0% 100%",
|
||||||
backgroundRepeat: "no-repeat",
|
backgroundRepeat: "no-repeat",
|
||||||
backgroundSize: "0% $underline",
|
backgroundSize: "0% $$underlineSize",
|
||||||
paddingBottom: "0.2rem",
|
paddingBottom: "0.2rem",
|
||||||
|
|
||||||
"@media (prefers-reduced-motion: no-preference)": {
|
"@media (prefers-reduced-motion: no-preference)": {
|
||||||
@@ -26,7 +29,7 @@ const StyledLink = styled(NextLink, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
"&:hover": {
|
"&:hover": {
|
||||||
backgroundSize: "100% $underline",
|
backgroundSize: "100% $$underlineSize",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false: {},
|
false: {},
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { createStitches, defaultThemeMap } from "@stitches/react";
|
import { createStitches } from "@stitches/react";
|
||||||
|
|
||||||
// modified modern-normalize.css in object form:
|
// modified modern-normalize.css in object form:
|
||||||
// https://github.com/jakejarvis/stitches-normalize/blob/main/src/index.ts
|
// https://github.com/jakejarvis/stitches-normalize/blob/main/src/index.ts
|
||||||
@@ -51,10 +51,6 @@ export const { styled, css, getCssText, globalCss, keyframes, createTheme, theme
|
|||||||
codeDeletion: "#ff1b1b",
|
codeDeletion: "#ff1b1b",
|
||||||
},
|
},
|
||||||
|
|
||||||
borderWidths: {
|
|
||||||
underline: "calc(0.1em + 0.05rem)",
|
|
||||||
},
|
|
||||||
|
|
||||||
radii: {
|
radii: {
|
||||||
rounded: "0.65em",
|
rounded: "0.65em",
|
||||||
},
|
},
|
||||||
@@ -65,20 +61,18 @@ export const { styled, css, getCssText, globalCss, keyframes, createTheme, theme
|
|||||||
medium: "(max-width: 768px)",
|
medium: "(max-width: 768px)",
|
||||||
// used rarely only for SUPER narrow windows:
|
// used rarely only for SUPER narrow windows:
|
||||||
small: "(max-width: 380px)",
|
small: "(max-width: 380px)",
|
||||||
// ...note: things then COMPLETELY break at 300px.
|
// ...note: things then COMPLETELY break at 300px. but it's 2022 let's be real.
|
||||||
},
|
},
|
||||||
|
|
||||||
utils: {
|
utils: {
|
||||||
setUnderlineVar: ({ color, alpha = 0.4 }) => ({
|
setUnderlineVars: ({
|
||||||
|
color = "$colors$linkUnderline", // see theme values below
|
||||||
|
alpha = 0.4,
|
||||||
|
}) => ({
|
||||||
// allow both pre-set rgba stitches variables and hex values
|
// allow both pre-set rgba stitches variables and hex values
|
||||||
$$underline: color.startsWith("#") ? hexToRgba(color, alpha) : color,
|
$$underlineColor: color.startsWith("#") ? hexToRgba(color, alpha) : color,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
themeMap: {
|
|
||||||
...defaultThemeMap,
|
|
||||||
backgroundSize: "borderWidths",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const darkTheme = createTheme({
|
export const darkTheme = createTheme({
|
||||||
|
@@ -14,11 +14,11 @@ const ColorfulLink = ({
|
|||||||
<Link
|
<Link
|
||||||
css={{
|
css={{
|
||||||
color: lightColor,
|
color: lightColor,
|
||||||
setUnderlineVar: { color: lightColor },
|
setUnderlineVars: { color: lightColor },
|
||||||
|
|
||||||
[`.${darkTheme} &`]: {
|
[`.${darkTheme} &`]: {
|
||||||
color: darkColor,
|
color: darkColor,
|
||||||
setUnderlineVar: { color: darkColor },
|
setUnderlineVars: { color: darkColor },
|
||||||
},
|
},
|
||||||
|
|
||||||
...css,
|
...css,
|
||||||
|
@@ -31,7 +31,7 @@ const DOS = styled(Terminal, {
|
|||||||
maxWidth: "700px",
|
maxWidth: "700px",
|
||||||
});
|
});
|
||||||
|
|
||||||
const Wrapper = ({ style, ...rest }: ComponentProps<typeof Wrapper>) => {
|
const RandomWallpaper = ({ style, ...rest }: ComponentProps<typeof Wallpaper>) => {
|
||||||
const [wallpaperUrl, setWallpaperUrl] = useState("");
|
const [wallpaperUrl, setWallpaperUrl] = useState("");
|
||||||
|
|
||||||
// set a random retro Windows ME desktop tile for the entire content area
|
// set a random retro Windows ME desktop tile for the entire content area
|
||||||
@@ -101,7 +101,7 @@ Y2K.getLayout = (page: ReactElement) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Wrapper>{page}</Wrapper>
|
<RandomWallpaper>{page}</RandomWallpaper>
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user