mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-07-22 21:35:57 -04:00
swap out marquee component
This commit is contained in:
@@ -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;
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from "./Marquee";
|
||||
export { default } from "./Marquee";
|
||||
Reference in New Issue
Block a user