swap out marquee component

This commit is contained in:
2022-05-29 18:51:12 -04:00
parent c1c03db412
commit 3c866ddabf
5 changed files with 84 additions and 118 deletions
-47
View File
@@ -1,47 +0,0 @@
import { styled, keyframes } from "../../lib/styles/stitches.config";
import type { ComponentProps } from "react";
// warning: super duper hacky CSS, probably don't use this.
// inspired by https://codepen.io/Knovour/pen/boJNPN
const Wrapper = styled("div", {
position: "relative",
overflowX: "hidden",
width: "100%",
height: "2em",
});
const Track = styled("div", {
position: "absolute",
width: "100%",
height: "100%",
whiteSpace: "nowrap",
textAlign: "left",
"@media (prefers-reduced-motion: no-preference)": {
animation: `${keyframes({
from: { transform: "translateX(100%)" },
to: { transform: "translateX(-100%)" },
})} 16s linear infinite`,
willChange: "transform",
"@medium": {
animation: `${keyframes({
from: { transform: "translateX(100%)" },
to: { transform: "translateX(-180%)" },
})} 20s linear infinite`,
},
},
});
export type MarqueeProps = ComponentProps<typeof Wrapper>;
const Marquee = ({ children, ...rest }: MarqueeProps) => {
return (
<Wrapper {...rest}>
<Track>{children}</Track>
</Wrapper>
);
};
export default Marquee;
-2
View File
@@ -1,2 +0,0 @@
export * from "./Marquee";
export { default } from "./Marquee";