diff --git a/components/DarkModeBtn.tsx b/components/DarkModeBtn.tsx index 35e3a86..dd8b724 100644 --- a/components/DarkModeBtn.tsx +++ b/components/DarkModeBtn.tsx @@ -1,6 +1,7 @@ import clsx from 'clsx'; import useMounted from 'lib/hooks/useMounted'; import { useTheme } from 'next-themes'; +import { memo } from 'react'; import { FiMoon, FiSun } from 'react-icons/fi'; const DarkModeBtn = () => { @@ -35,4 +36,4 @@ const DarkModeBtn = () => { ); }; -export default DarkModeBtn; +export default memo(DarkModeBtn); \ No newline at end of file diff --git a/components/Footer.tsx b/components/Footer.tsx index 2ad7706..c7088ed 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -1,3 +1,4 @@ +import { memo } from 'react'; import { FiGithub } from 'react-icons/fi'; const nowDay = new Date().getFullYear(); @@ -25,4 +26,4 @@ const Footer = () => { ); }; -export default Footer; +export default memo(Footer); \ No newline at end of file diff --git a/components/NavBar.tsx b/components/NavBar.tsx index a7a189c..1fcf855 100644 --- a/components/NavBar.tsx +++ b/components/NavBar.tsx @@ -3,7 +3,7 @@ import { DocSearch } from '@docsearch/react'; import clsx from 'clsx'; import dynamic from 'next/dynamic'; import Link from 'next/link'; -import { useEffect, useState } from 'react'; +import { memo, useEffect, useState } from 'react'; import { FiMenu } from 'react-icons/fi'; const DarkModeBtn = dynamic(() => import('components/DarkModeBtn')); @@ -162,4 +162,4 @@ const HeadBar = () => { ); }; -export default HeadBar; +export default memo(HeadBar); \ No newline at end of file diff --git a/components/PostCard.tsx b/components/PostCard.tsx index 4fc3674..369d16d 100644 --- a/components/PostCard.tsx +++ b/components/PostCard.tsx @@ -1,6 +1,7 @@ import Link from 'next/link'; import { Post } from 'types'; import clsx from 'clsx'; +import { memo } from 'react'; interface Props { post: Post; @@ -50,4 +51,4 @@ const PostCard = ({ post }: Props) => { ); }; -export default PostCard; +export default memo(PostCard); \ No newline at end of file diff --git a/components/RUA/Button.tsx b/components/RUA/Button.tsx index 2225117..77cf19e 100644 --- a/components/RUA/Button.tsx +++ b/components/RUA/Button.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx'; -import { ButtonHTMLAttributes, DetailedHTMLProps } from 'react'; +import { ButtonHTMLAttributes, DetailedHTMLProps, memo } from 'react'; export type ButtonProps = { children: React.ReactNode; @@ -36,4 +36,4 @@ const Button = ({ children, ...rest }: ButtonProps) => { ); }; -export default Button; \ No newline at end of file +export default memo(Button); \ No newline at end of file diff --git a/components/RUA/RUACodeSandbox.tsx b/components/RUA/RUACodeSandbox.tsx index 2ae9409..bf37291 100644 --- a/components/RUA/RUACodeSandbox.tsx +++ b/components/RUA/RUACodeSandbox.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import useInView from 'lib/hooks/useInView'; import { useTheme } from 'next-themes'; -import { useEffect, useState } from 'react'; +import { memo, useEffect, useState } from 'react'; import RUALoading from './loading/RUALoading'; const partten = @@ -64,4 +64,4 @@ const RUACodeSandbox = ({ url }: Props) => { ); }; -export default RUACodeSandbox; +export default memo(RUACodeSandbox); \ No newline at end of file diff --git a/components/RUA/RUACodepen.tsx b/components/RUA/RUACodepen.tsx index a2a1f04..2068b69 100644 --- a/components/RUA/RUACodepen.tsx +++ b/components/RUA/RUACodepen.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import useInView from 'lib/hooks/useInView'; import { useTheme } from 'next-themes'; -import { useEffect, useState } from 'react'; +import { memo, useEffect, useState } from 'react'; import RUALoading from './loading/RUALoading'; export const commonClass = clsx( @@ -63,15 +63,14 @@ const RUACodepen = ({ defaultTab, url }: Props) => { 'transition-all h-[402px]', 'border-none', 'absolute top-1/2 left-1/2', - '-translate-x-1/2 -translate-y-1/2' + '-translate-x-1/2 -translate-y-1/2', + 'overflow-hidden' )} style={{ width: 'calc(100% + 2px)', }} onLoad={handleLoad} - scrolling="no" src={src} - frameBorder="no" loading="lazy" allowFullScreen > @@ -81,4 +80,4 @@ const RUACodepen = ({ defaultTab, url }: Props) => { ); }; -export default RUACodepen; +export default memo(RUACodepen); \ No newline at end of file diff --git a/components/RUA/RUAPagination.tsx b/components/RUA/RUAPagination.tsx index 07402e9..3ba35e2 100644 --- a/components/RUA/RUAPagination.tsx +++ b/components/RUA/RUAPagination.tsx @@ -1,6 +1,6 @@ import dynamic from 'next/dynamic'; import Link from 'next/link'; -import { DetailedHTMLProps, HTMLAttributes } from 'react'; +import { DetailedHTMLProps, HTMLAttributes, memo } from 'react'; const Button = dynamic(() => import('components/RUA/Button')); @@ -59,4 +59,4 @@ const RUAPagination = ({ ); }; -export default RUAPagination; +export default memo(RUAPagination); \ No newline at end of file diff --git a/components/RUA/RUASandpack.tsx b/components/RUA/RUASandpack.tsx index 59e79de..1992d60 100644 --- a/components/RUA/RUASandpack.tsx +++ b/components/RUA/RUASandpack.tsx @@ -1,5 +1,6 @@ import { Sandpack, SandpackProps } from '@codesandbox/sandpack-react'; import { useTheme } from 'next-themes'; +import { memo } from 'react'; interface Props extends SandpackProps {} @@ -19,4 +20,4 @@ const RUASandpack = ({ ...rest }: Props) => { ); }; -export default RUASandpack; +export default memo(RUASandpack); \ No newline at end of file diff --git a/components/RUA/loading/PostCardLoading.tsx b/components/RUA/loading/PostCardLoading.tsx index 3392d03..cbdc9c6 100644 --- a/components/RUA/loading/PostCardLoading.tsx +++ b/components/RUA/loading/PostCardLoading.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { memo } from 'react'; import clsx from 'clsx'; const PostCardLoading = () => { @@ -26,4 +26,4 @@ const PostCardLoading = () => { ); }; -export default PostCardLoading; +export default memo(PostCardLoading); \ No newline at end of file diff --git a/components/RUA/loading/RUALoading.tsx b/components/RUA/loading/RUALoading.tsx index e90803d..c0728c6 100644 --- a/components/RUA/loading/RUALoading.tsx +++ b/components/RUA/loading/RUALoading.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { memo } from 'react'; import clsx from 'clsx'; import loadingImage from 'public/images/img/mona-loading-default.gif'; import loadingImageDimmed from 'public/images/img/mona-loading-dimmed.gif'; @@ -34,4 +34,4 @@ const RUALoading = ({ className: classNames }: Props) => { ); }; -export default RUALoading; +export default memo(RUALoading); \ No newline at end of file diff --git a/components/RUA/loading/VercelLoading.tsx b/components/RUA/loading/VercelLoading.tsx index 1d65ac8..d56e9f0 100644 --- a/components/RUA/loading/VercelLoading.tsx +++ b/components/RUA/loading/VercelLoading.tsx @@ -1,4 +1,5 @@ import clsx from 'clsx'; +import { memo } from 'react'; import styles from './VercelLoading.module.css'; const VercelLoading = () => { @@ -40,4 +41,4 @@ const VercelLoading = () => { ); }; -export default VercelLoading; +export default memo(VercelLoading); \ No newline at end of file diff --git a/components/RUA/tab/TabItem.tsx b/components/RUA/tab/TabItem.tsx index eaa05f6..2744404 100644 --- a/components/RUA/tab/TabItem.tsx +++ b/components/RUA/tab/TabItem.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx'; -import React from 'react'; +import React, { memo } from 'react'; export type ItemProps = { value: string | number; @@ -16,4 +16,4 @@ const TabItem = ({ showContent, children }: ItemProps) => { ); }; -export default TabItem; +export default memo(TabItem); \ No newline at end of file diff --git a/components/RUA/tab/index.tsx b/components/RUA/tab/index.tsx index c07e47c..e2da7ed 100644 --- a/components/RUA/tab/index.tsx +++ b/components/RUA/tab/index.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx'; -import React, { useState } from 'react'; +import React, { memo, useState } from 'react'; import { ItemProps } from './TabItem'; type Props = { @@ -56,4 +56,4 @@ const Tab = ({ defaultValue, children }: Props) => { ); }; -export default Tab; +export default memo(Tab); \ No newline at end of file diff --git a/components/common/BackToTop.tsx b/components/common/BackToTop.tsx index eda7de5..c2a15c8 100644 --- a/components/common/BackToTop.tsx +++ b/components/common/BackToTop.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; import Button from 'components/RUA/Button'; +import { memo } from 'react'; import { FiChevronUp } from 'react-icons/fi'; const BackToTop = () => { @@ -15,7 +16,7 @@ const BackToTop = () => {