@@ -8,7 +8,7 @@ import Box from '../Box';
88import { useColorScheme } from '../contexts/ColorSchemeProvider' ;
99import icons from '../icons/index' ;
1010import vrIcons from '../icons-vr-theme/index' ;
11- import useInExperiment from '../useInExperiment ' ;
11+ import useExperimentalTheme from '../utils/useExperimentalTheme ' ;
1212
1313const ICON_SIZE_RATIO = ( 20 / 48 ) * 100 ; // For pixel perfect icon button, we use the icon (20px) to parent container (48px) size ratio
1414
@@ -31,10 +31,7 @@ function ResponsiveFitSizeBox({
3131 isPressed,
3232 outline,
3333} : ResponsiveFitSizeBoxProps ) {
34- const isInVRExperiment = useInExperiment ( {
35- webExperimentName : 'web_gestalt_visualrefresh' ,
36- mwebExperimentName : 'web_gestalt_visualrefresh' ,
37- } ) ;
34+ const theme = useExperimentalTheme ( ) ;
3835
3936 const { colorSchemeName } = useColorScheme ( ) ;
4037 const isDarkMode = colorSchemeName === 'darkMode' ;
@@ -44,11 +41,11 @@ function ResponsiveFitSizeBox({
4441 ? getAvatarColorToken ( 'default' , isHovered , isPressed , isDarkMode )
4542 : getAvatarColorToken ( color || 'default' , isHovered , isPressed , isDarkMode ) ;
4643
47- return isInVRExperiment ? (
44+ return theme . MAIN ? (
4845 < div
4946 className = { classnames ( {
5047 [ avatarStyles . container ] : true ,
51- [ avatarStyles . outlineVR ] : isInVRExperiment && outline ,
48+ [ avatarStyles . outlineVR ] : theme . MAIN && outline ,
5249 } ) }
5350 role = "button"
5451 style = { {
@@ -114,10 +111,7 @@ export default function AvatarFoundation({
114111 translate,
115112 content = 'text' ,
116113} : AvatarFoundationProps ) {
117- const isInVRExperiment = useInExperiment ( {
118- webExperimentName : 'web_gestalt_visualrefresh' ,
119- mwebExperimentName : 'web_gestalt_visualrefresh' ,
120- } ) ;
114+ const theme = useExperimentalTheme ( ) ;
121115 const { colorSchemeName } = useColorScheme ( ) ;
122116 const isDarkMode = colorSchemeName === 'darkMode' ;
123117
@@ -134,7 +128,7 @@ export default function AvatarFoundation({
134128 < svg
135129 preserveAspectRatio = "xMidYMid meet"
136130 version = "1.1"
137- viewBox = { isInVRExperiment ? '-25 -25 50 50' : '-50 -50 100 100' }
131+ viewBox = { theme . MAIN ? '-25 -25 50 50' : '-50 -50 100 100' }
138132 width = "100%"
139133 xmlns = "http://www.w3.org/2000/svg"
140134 >
@@ -143,13 +137,13 @@ export default function AvatarFoundation({
143137 className = { classnames (
144138 translate && avatarGroupStyles [ translate ] , // if addCollaborator button is present, translateX moves numbers closer to the edge
145139 {
146- [ avatarStyles . text ] : ! isInVRExperiment ,
147- [ avatarStyles . vrText ] : isInVRExperiment ,
140+ [ avatarStyles . text ] : ! theme . MAIN ,
141+ [ avatarStyles . vrText ] : theme . MAIN ,
148142 } ,
149143 ) }
150144 dy = "0.35em"
151145 fill = { TOKEN_COLOR_TEXT_DEFAULT }
152- fontSize = { ! isInVRExperiment ? fontSize : undefined }
146+ fontSize = { ! theme . MAIN ? fontSize : undefined }
153147 textAnchor = { textAnchor }
154148 >
155149 { children }
@@ -160,8 +154,8 @@ export default function AvatarFoundation({
160154 < svg
161155 className = { classnames ( {
162156 [ avatarStyles . icon ] : true ,
163- [ avatarStyles . iconFillDefault ] : isInVRExperiment && ! isDarkMode ,
164- [ avatarStyles . iconFillDarkMode ] : isInVRExperiment && isDarkMode ,
157+ [ avatarStyles . iconFillDefault ] : theme . MAIN && ! isDarkMode ,
158+ [ avatarStyles . iconFillDarkMode ] : theme . MAIN && isDarkMode ,
165159 } ) }
166160 preserveAspectRatio = "xMidYMid meet" // percentual width to the parent container, reduces icon to 20px on a 48px parent container and keeps proportions upon resizing
167161 role = "img" // full icon size
@@ -171,7 +165,7 @@ export default function AvatarFoundation({
171165 xmlns = "http://www.w3.org/2000/svg"
172166 >
173167 < title > Icon</ title >
174- < path d = { ( isInVRExperiment ? vrIcons : icons ) [ 'person-add' ] } />
168+ < path d = { ( theme . MAIN ? vrIcons : icons ) [ 'person-add' ] } />
175169 </ svg >
176170 ) : null }
177171 </ ResponsiveFitSizeBox >
0 commit comments