From 8c91e5bf14e3e3be60d3a4aecf1687fe887289b0 Mon Sep 17 00:00:00 2001 From: alij Date: Sun, 23 Jun 2024 16:33:10 +0430 Subject: [PATCH] feat : in intro component button andd scroll to products(configs) section(div) --- src/components/scrollLink/index.tsx | 22 +++++++++++++++++++ src/pages/shop/section/intro/Intro.tsx | 5 ++++- .../shop/section/productList/ProductList.tsx | 6 ++--- src/types/props.d.ts | 5 +++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 src/components/scrollLink/index.tsx diff --git a/src/components/scrollLink/index.tsx b/src/components/scrollLink/index.tsx new file mode 100644 index 0000000..a31dd0d --- /dev/null +++ b/src/components/scrollLink/index.tsx @@ -0,0 +1,22 @@ +// components/SmoothScrollLink.tsx +import React from 'react'; +import { ScrollLinkProps } from '../../types/props'; + + +const SmoothScrollLink: React.FC = ({ to, children }) => { + const handleClick = (event: React.MouseEvent) => { + event.preventDefault(); + const targetElement = document.querySelector(to); + if (targetElement) { + targetElement.scrollIntoView({ behavior: 'smooth' }); + } + }; + + return ( + + {children} + + ); +}; + +export default SmoothScrollLink; diff --git a/src/pages/shop/section/intro/Intro.tsx b/src/pages/shop/section/intro/Intro.tsx index 497499d..53bda0f 100644 --- a/src/pages/shop/section/intro/Intro.tsx +++ b/src/pages/shop/section/intro/Intro.tsx @@ -1,6 +1,7 @@ import Button from "../../../../components/button"; import Rocket3D from "../../../../assets/ui/Rocket.png"; +import SmoothScrollLink from "../../../../components/scrollLink"; const Intro = () => { return ( @@ -15,7 +16,9 @@ const Intro = () => {

سال ها تجربه پشت یک کانفیگ شماست

- + + +
{ }, }); return ( -
+
-

- برای انتخاب پلن مورد نظر کلیک کنید تا پلن و سرویس ها براتون نمایش داده +

+ برای انتخاب سرویس مورد نظر کلیک کنید تا براتون نمایش داده شود