From 0bf452c9067f0592821e03eeb898709f5fd1bc0c Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Mon, 6 May 2024 21:52:41 +0300 Subject: [PATCH] feat: remove firaMono --- src/constants/fonts.ts | 10 +--------- src/containers/Editor/LiveEditor.tsx | 3 +-- src/containers/Views/GraphView/CustomNode/styles.tsx | 3 +-- src/lib/utils/graph/calculateNodeSize.ts | 3 +-- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/constants/fonts.ts b/src/constants/fonts.ts index 1b8567f..c1c1996 100644 --- a/src/constants/fonts.ts +++ b/src/constants/fonts.ts @@ -1,4 +1,3 @@ -import { Fira_Mono } from "next/font/google"; import localFont from "next/font/local"; const monaSans = localFont({ @@ -8,11 +7,4 @@ const monaSans = localFont({ fallback: ["Futura, Helvetica, sans-serif", "Tahoma, Verdana, sans-serif"], }); -const firaMono = Fira_Mono({ - weight: ["500"], - subsets: ["latin"], - display: "swap", - fallback: ["Menlo, Monaco, monospace", "Consolas, Courier New, monospace"], -}); - -export { monaSans, firaMono }; +export { monaSans }; diff --git a/src/containers/Editor/LiveEditor.tsx b/src/containers/Editor/LiveEditor.tsx index 8ef5ce5..8b41beb 100644 --- a/src/containers/Editor/LiveEditor.tsx +++ b/src/containers/Editor/LiveEditor.tsx @@ -1,6 +1,5 @@ import React from "react"; import styled from "styled-components"; -import { firaMono } from "src/constants/fonts"; import { Graph } from "src/containers/Views/GraphView"; import { TreeView } from "src/containers/Views/TreeView"; import { ViewMode } from "src/enums/viewMode.enum"; @@ -16,7 +15,7 @@ const StyledLiveEditor = styled.div` & > ul { margin-top: 0 !important; padding: 12px !important; - font-family: ${firaMono.style.fontFamily}; + font-family: monospace; font-size: 14px; font-weight: 500; } diff --git a/src/containers/Views/GraphView/CustomNode/styles.tsx b/src/containers/Views/GraphView/CustomNode/styles.tsx index a63fb8d..d4fc2c6 100644 --- a/src/containers/Views/GraphView/CustomNode/styles.tsx +++ b/src/containers/Views/GraphView/CustomNode/styles.tsx @@ -1,6 +1,5 @@ import styled, { DefaultTheme } from "styled-components"; import { LinkItUrl } from "react-linkify-it"; -import { firaMono } from "src/constants/fonts"; type TextColorFn = { theme: DefaultTheme; @@ -34,7 +33,7 @@ export const StyledLinkItUrl = styled(LinkItUrl)` export const StyledForeignObject = styled.foreignObject<{ $isObject?: boolean }>` text-align: ${({ $isObject }) => !$isObject && "center"}; color: ${({ theme }) => theme.NODE_COLORS.TEXT}; - font-family: ${firaMono.style.fontFamily}; + font-family: monospace; font-size: 12px; font-weight: 500; overflow: hidden; diff --git a/src/lib/utils/graph/calculateNodeSize.ts b/src/lib/utils/graph/calculateNodeSize.ts index 181ab8d..5a26717 100644 --- a/src/lib/utils/graph/calculateNodeSize.ts +++ b/src/lib/utils/graph/calculateNodeSize.ts @@ -1,4 +1,3 @@ -import { firaMono } from "src/constants/fonts"; import useConfig from "src/store/useConfig"; type Text = string | [string, string][]; @@ -34,7 +33,7 @@ const calculateWidthAndHeight = (str: string, single = false) => { dummyElement.style.padding = "10px"; dummyElement.style.fontWeight = "500"; dummyElement.style.overflowWrap = "break-word"; - dummyElement.style.fontFamily = firaMono.style.fontFamily; + dummyElement.style.fontFamily = "monospace"; document.body.appendChild(dummyElement); const clientRect = dummyElement.getBoundingClientRect();