@@ -5,6 +5,7 @@ import { Stack, Card, Text, Title, Group, Divider, Box, useMantineTheme } from '
55import { IconUser , IconCpu } from '@tabler/icons-react' ;
66import * as S from './ComparisonTable.styles' ;
77import { sectionContainerWithoutMarginStyle } from '../../pages/WhitePaper/components/AiAutopilotAnalogy/AiAutopilotAnalogy.styles' ; // Import for padding values
8+ import { usePathname } from 'next/navigation' ;
89
910// Mobile version with stacked layout using Mantine components
1011export const ComparisonTableMobile : React . FC < ComparisonTableProps > = ( {
@@ -14,10 +15,16 @@ export const ComparisonTableMobile: React.FC<ComparisonTableProps> = ({
1415 variant = 'default' , // Variant might influence mobile styling too
1516 className,
1617} ) => {
18+ const pathname = usePathname ( ) ;
19+ const isHomePage = pathname === '/' ;
20+
21+ // Only use accent/dark variant on homepage
22+ const effectiveVariant = isHomePage ? variant : 'default' ;
23+
1724 const theme = useMantineTheme ( ) ;
1825 const [ ref , inView ] = useInView ( {
1926 triggerOnce : true ,
20- rootMargin : "-50px" , // Adjusted rootMargin for mobile
27+ rootMargin : "-50px" ,
2128 threshold : 0.1
2229 } ) ;
2330
@@ -29,63 +36,81 @@ export const ComparisonTableMobile: React.FC<ComparisonTableProps> = ({
2936 }
3037 } , [ inView ] ) ;
3138
32- const getBackgroundColor = ( themeVariant : typeof variant ) => {
33- return theme . white ;
34- } ;
39+ // Get color based on the variant and whether we're in a light context
40+ const headerBgColor = effectiveVariant === 'accent'
41+ ? theme . colors . blue [ 7 ]
42+ : theme . colors . gray [ 1 ] ;
3543
36- const getTextColor = ( themeVariant : typeof variant ) => {
37- return theme . black ;
38- } ;
44+ const headerTextColor = effectiveVariant === 'accent'
45+ ? theme . white
46+ : theme . black ;
3947
40- const categoryTitleColor = variant === 'accent' ? theme . colors . blue [ 6 ] : theme . primaryColor ;
41-
42- // Get horizontal padding from the shared style
43- const horizontalPadding = sectionContainerWithoutMarginStyle . paddingLeft ; // Assuming paddingLeft and paddingRight are the same
48+ const cardBgColor = theme . white ;
49+ const cardTextColor = theme . black ;
4450
4551 return (
46- < Stack
47- ref = { ref }
48- className = { className }
49- gap = "lg"
50- style = { {
51- paddingLeft : horizontalPadding ,
52- paddingRight : horizontalPadding ,
53- } }
54- >
55- { items . map ( ( item , index ) => (
52+ < Box ref = { ref } className = { className } >
53+ < Stack gap = "lg" >
54+ { /* Header Card */ }
5655 < Card
57- shadow = "sm"
58- padding = "lg"
56+ p = "md"
5957 radius = "md"
60- withBorder
61- key = { index }
62- className = { isVisible ? 'visible' : '' }
6358 style = { {
59+ backgroundColor : headerBgColor ,
6460 opacity : isVisible ? 1 : 0 ,
6561 transform : isVisible ? 'translateY(0)' : 'translateY(20px)' ,
66- transition : `opacity 0.5s ease-out ${ index * 0.1 } s, transform 0.5s ease-out ${ index * 0.1 } s` ,
67- backgroundColor : getBackgroundColor ( variant ) ,
68- color : getTextColor ( variant ) ,
62+ transition : 'opacity 0.3s ease, transform 0.5s ease' ,
6963 } }
7064 >
71- < Stack gap = "xs" >
72- < Title order = { 4 } c = { categoryTitleColor } > { item . category } </ Title >
73- < Divider my = "xs" />
74- < Group gap = "xs" wrap = "nowrap" >
75- < IconUser size = { 18 } color = { getTextColor ( variant ) } />
76- < Text size = "sm" fw = { 700 } style = { { color : getTextColor ( variant ) } } > { leftTitle } :</ Text >
65+ < Stack align = "center" gap = "xs" >
66+ < Group gap = "xs" >
67+ < IconUser size = { 20 } color = { headerTextColor } />
68+ < Title order = { 5 } style = { { color : headerTextColor } } > { leftTitle } </ Title >
7769 </ Group >
78- < Text size = "sm" style = { { color : getTextColor ( variant ) , paddingLeft : '26px' } } > { item . leftContent } </ Text >
79-
80- < Divider my = "xs" variant = "dashed" />
81- < Group gap = "xs" wrap = "nowrap" >
82- < IconCpu size = { 18 } color = { getTextColor ( variant ) } />
83- < Text size = "sm" fw = { 700 } style = { { color : getTextColor ( variant ) } } > { rightTitle } :</ Text >
70+ < Text size = "sm" style = { { color : headerTextColor } } > vs.</ Text >
71+ < Group gap = "xs" >
72+ < IconCpu size = { 20 } color = { headerTextColor } />
73+ < Title order = { 5 } style = { { color : headerTextColor } } > { rightTitle } </ Title >
8474 </ Group >
85- < Text size = "sm" style = { { color : getTextColor ( variant ) , paddingLeft : '26px' } } > { item . rightContent } </ Text >
8675 </ Stack >
8776 </ Card >
88- ) ) }
89- </ Stack >
77+
78+ { /* Comparison Cards */ }
79+ { items . map ( ( item , index ) => (
80+ < Card
81+ key = { index }
82+ p = "lg"
83+ radius = "md"
84+ style = { {
85+ backgroundColor : cardBgColor ,
86+ opacity : isVisible ? 1 : 0 ,
87+ transform : isVisible ? 'translateY(0)' : 'translateY(20px)' ,
88+ transition : `opacity 0.3s ease, transform 0.5s ease ${ index * 0.1 } s` ,
89+ } }
90+ >
91+ < Title order = { 6 } mb = "xs" > { item . category } </ Title >
92+ < Divider mb = "md" />
93+
94+ < Stack gap = "md" >
95+ < Box >
96+ < Group gap = "xs" mb = "xs" >
97+ < IconUser size = { 16 } color = { cardTextColor } />
98+ < Text size = "sm" fw = { 600 } > { leftTitle } </ Text >
99+ </ Group >
100+ < Text size = "sm" > { item . leftContent } </ Text >
101+ </ Box >
102+
103+ < Box >
104+ < Group gap = "xs" mb = "xs" >
105+ < IconCpu size = { 16 } color = { cardTextColor } />
106+ < Text size = "sm" fw = { 600 } > { rightTitle } </ Text >
107+ </ Group >
108+ < Text size = "sm" > { item . rightContent } </ Text >
109+ </ Box >
110+ </ Stack >
111+ </ Card >
112+ ) ) }
113+ </ Stack >
114+ </ Box >
90115 ) ;
91116} ;
0 commit comments