refactor(hero-section): 替换SealButton为Button组件并简化点击追踪
移除SealButton组件,使用更通用的Button组件替代 删除冗余的trackServiceInterest调用,简化点击事件追踪
This commit was merged in pull request #14.
This commit is contained in:
@@ -3,12 +3,13 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { StaticLink } from '@/components/ui/static-link';
|
import { StaticLink } from '@/components/ui/static-link';
|
||||||
import { RippleButton, SealButton } from '@/components/ui/ripple-button';
|
import { RippleButton } from '@/components/ui/ripple-button';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
import { MagneticButton, BlurReveal, CounterWithEffect } from '@/lib/animations';
|
import { MagneticButton, BlurReveal, CounterWithEffect } from '@/lib/animations';
|
||||||
import { COMPANY_INFO, STATS } from '@/lib/constants';
|
import { COMPANY_INFO, STATS } from '@/lib/constants';
|
||||||
import { ArrowRight, Shield, Zap, Award } from 'lucide-react';
|
import { ArrowRight, Shield, Zap, Award } from 'lucide-react';
|
||||||
import { useReducedMotion } from '@/hooks/use-reduced-motion';
|
import { useReducedMotion } from '@/hooks/use-reduced-motion';
|
||||||
import { trackButtonClick, trackServiceInterest } from '@/lib/analytics';
|
import { trackButtonClick } from '@/lib/analytics';
|
||||||
|
|
||||||
interface HeroContentProps {
|
interface HeroContentProps {
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
@@ -95,11 +96,6 @@ export function HeroDescription(_props: HeroContentProps) {
|
|||||||
export function HeroButtons({ isVisible }: HeroContentProps) {
|
export function HeroButtons({ isVisible }: HeroContentProps) {
|
||||||
const shouldReduceMotion = useReducedMotion();
|
const shouldReduceMotion = useReducedMotion();
|
||||||
|
|
||||||
const handleConsultClick = () => {
|
|
||||||
trackButtonClick('consult_now', 'hero_section');
|
|
||||||
trackServiceInterest('consultation');
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleLearnMoreClick = () => {
|
const handleLearnMoreClick = () => {
|
||||||
trackButtonClick('learn_more', 'hero_section');
|
trackButtonClick('learn_more', 'hero_section');
|
||||||
scrollTo('about');
|
scrollTo('about');
|
||||||
@@ -113,12 +109,12 @@ export function HeroButtons({ isVisible }: HeroContentProps) {
|
|||||||
className="flex flex-col sm:flex-row items-center justify-center gap-4 mb-8"
|
className="flex flex-col sm:flex-row items-center justify-center gap-4 mb-8"
|
||||||
>
|
>
|
||||||
<MagneticButton strength={0.4}>
|
<MagneticButton strength={0.4}>
|
||||||
<StaticLink href="/contact" onClick={handleConsultClick}>
|
<Button size="lg" className="min-w-45 bg-[#C41E3A] hover:bg-[#A01830] text-white shadow-[0_6px_20px_rgba(196,30,58,0.3)]" asChild>
|
||||||
<SealButton size="lg" className="min-w-45">
|
<StaticLink href="/contact">
|
||||||
立即咨询
|
立即咨询
|
||||||
<ArrowRight className="w-4 h-4 ml-2" />
|
<ArrowRight className="w-4 h-4 ml-2" />
|
||||||
</SealButton>
|
|
||||||
</StaticLink>
|
</StaticLink>
|
||||||
|
</Button>
|
||||||
</MagneticButton>
|
</MagneticButton>
|
||||||
<MagneticButton strength={0.4}>
|
<MagneticButton strength={0.4}>
|
||||||
<RippleButton
|
<RippleButton
|
||||||
|
|||||||
Reference in New Issue
Block a user