88 */
99
1010import * as stylex from '@stylexjs/stylex' ;
11- import { globalTokens as $ , spacing , text , colors } from '@/app/globalTokens.stylex' ;
12- import { tokens } from '@/app/CardTokens.stylex' ;
11+ import {
12+ globalTokens as $ ,
13+ spacing ,
14+ text ,
15+ colors ,
16+ } from '@/app/globalTokens.stylex' ;
17+ import { cardMarker , headingMarker } from './CardTokens.stylex' ;
1318
1419type Props = Readonly < {
1520 title : string ;
@@ -20,12 +25,12 @@ type Props = Readonly<{
2025export default function Card ( { title, body, href } : Props ) {
2126 return (
2227 < a
23- { ...stylex . props ( styles . link ) }
28+ { ...stylex . props ( styles . link , cardMarker ) }
2429 href = { href }
2530 rel = "noopener noreferrer"
2631 target = "_blank"
2732 >
28- < h2 { ...stylex . props ( styles . h2 ) } >
33+ < h2 { ...stylex . props ( styles . h2 , headingMarker ) } >
2934 { title } < span { ...stylex . props ( styles . span ) } > →</ span >
3035 </ h2 >
3136 < p { ...stylex . props ( styles . p ) } > { body } </ p >
@@ -67,10 +72,6 @@ const styles = stylex.create({
6772 transitionDuration : '400ms' ,
6873 textAlign : 'center' ,
6974 textDecoration : 'none' ,
70- [ tokens . arrowTransform ] : {
71- default : 'translateX(0)' ,
72- ':hover' : 'translateX(4px)' ,
73- } ,
7475 } ,
7576 h2 : {
7677 color : colors . blue3 ,
@@ -84,7 +85,11 @@ const styles = stylex.create({
8485 span : {
8586 display : 'inline-block' ,
8687 transitionProperty : 'transform' ,
87- transform : tokens . arrowTransform ,
88+ transform : {
89+ default : null ,
90+ [ stylex . when . ancestor ( ':hover' , cardMarker ) ] : 'translateX(10px)' ,
91+ [ stylex . when . ancestor ( ':hover' , headingMarker ) ] : 'translateX(4px)' ,
92+ } ,
8893 transitionDuration : {
8994 default : '200ms' ,
9095 [ REDUCE_MOTION ] : '0s' ,
0 commit comments