Skip to content

Commit

Permalink
🐛 fix(font): svg animation not showing pt mono bold
Browse files Browse the repository at this point in the history
  • Loading branch information
lwinmoepaing committed Oct 19, 2023
1 parent d4f452f commit 35ca072
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/components/Animate/MseTypo/MseTypo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRef } from "react";
import { motion, useInView } from "framer-motion";
import { cn } from "@/utils";
import { titleFont } from "@/fonts/fonts";
import { titleFont, titleFontBold } from "@/fonts/fonts";

export const strokeAnimation = {
hidden: { strokeDashoffset: 650, strokeDasharray: 650 },
Expand Down Expand Up @@ -40,7 +40,7 @@ const MsoTypo = () => {
<g id="TextGroup">
<motion.text
variants={strokeAnimation}
className={cn("st10 st11 st12", titleFont.className)}
className={cn("st10 st11 st12", titleFontBold.className)}
transform="translate(10.957 106.424)"
>
{"M"}
Expand Down Expand Up @@ -68,7 +68,7 @@ const MsoTypo = () => {
</text>
<motion.text
variants={strokeAnimation}
className={cn("st10 st11 st12", titleFont.className)}
className={cn("st10 st11 st12", titleFontBold.className)}
transform="translate(272.74 108.424)"
>
{"E"}
Expand Down
13 changes: 11 additions & 2 deletions src/components/Common/TitleText/TitleText.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { titleFont } from "@/fonts/fonts";
import { titleFont, titleFontBold } from "@/fonts/fonts";
import { cn } from "@/utils";
import { PropsWithChildren } from "react";

type TTitleText = PropsWithChildren<{
className?: string;
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "div" | "p";
isBold?: boolean;
}>;

const TitleText: React.FC<TTitleText> = ({
className = "",
children,
tag = "h1",
isBold = false,
}) => {
const Component = tag;
return (
<Component className={cn(titleFont.className, "text-lg", className)}>
<Component
className={cn(
titleFont.className,
"text-lg",
isBold && titleFontBold.className,
className
)}
>
{children}
</Component>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Ui/MseLogo/MseLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const MseLogo = () => {
return (
<TitleText>
<MseLink href="/">
<TitleText tag="span" className="text-xl font-bold">
<TitleText tag="span" className="text-xl" isBold>
MM
</TitleText>
<TitleText tag="span" className="text-md">
<TitleText tag="span" className="text-base">
SWE.com
</TitleText>
</MseLink>
Expand Down
Binary file added src/fonts/PT Mono Bold.ttf
Binary file not shown.
7 changes: 7 additions & 0 deletions src/fonts/fonts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { PT_Mono, Work_Sans } from "next/font/google";
import localFont from "next/font/local";
// import {} from "next/font"

export const titleFont = PT_Mono({
weight: "400",
Expand All @@ -9,3 +11,8 @@ export const bodyFont = Work_Sans({
weight: "400",
subsets: ["latin"],
});

export const titleFontBold = localFont({
src: "./PT Mono Bold.ttf",
display: "swap",
});

0 comments on commit 35ca072

Please sign in to comment.