-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c02ac8
commit aacd267
Showing
2 changed files
with
49 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,55 @@ | ||
"use client"; | ||
|
||
import { motion } from "framer-motion"; | ||
import clsx from "clsx"; | ||
import { RefObject, useEffect, useState } from "react"; | ||
import { logotype } from "./logotype"; | ||
|
||
type SvgHeaderProps = { | ||
className?: string; | ||
containerRef: RefObject<HTMLDivElement>; | ||
}; | ||
|
||
const SvgHeader = ({ className }: SvgHeaderProps) => ( | ||
<motion.svg | ||
viewBox="0 0 208 79" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
className={className} | ||
> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d={logotype} | ||
fill="none" | ||
stroke="currentColor" | ||
strokeWidth={0.5} | ||
strokeDasharray={1} | ||
/> | ||
</motion.svg> | ||
); | ||
const SvgHeader = ({ className, containerRef }: SvgHeaderProps) => { | ||
const [scale, setScale] = useState(1); | ||
|
||
useEffect(() => { | ||
const updateScale = () => { | ||
if (!containerRef.current) return; | ||
const { width } = containerRef.current.getBoundingClientRect(); | ||
// Adjust these values to control how the logo scales | ||
const baseWidth = 208; // Original SVG width | ||
const newScale = width / baseWidth; | ||
setScale(newScale); | ||
}; | ||
|
||
updateScale(); | ||
window.addEventListener("resize", updateScale); | ||
return () => window.removeEventListener("resize", updateScale); | ||
}, []); | ||
return ( | ||
<svg | ||
className={clsx("absolute bottom-0 w-full aspect-[23.6/9]", className)} | ||
viewBox="0 0 208 79" | ||
preserveAspectRatio="xMidYMid meet" | ||
vectorEffect={"non-scaling-stroke"} | ||
> | ||
<defs> | ||
<mask id="logotypeMask"> | ||
<g transform={`translate(0, ${20 * scale}) scale(${scale})`}> | ||
<path d={logotype} fill="white" transform="translate(0, -10)" /> | ||
</g> | ||
</mask> | ||
</defs> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d={logotype} | ||
fill="none" | ||
stroke="currentColor" | ||
strokeWidth={0.2} | ||
strokeDasharray={0.75} | ||
/> | ||
</svg> | ||
); | ||
}; | ||
export default SvgHeader; |