11import { Fragment , isValidElement , useCallback , useContext , useMemo } from 'react' ;
2- import type { Theme } from '@emotion/react' ;
2+ import { type Theme , useTheme } from '@emotion/react' ;
33import { css } from '@emotion/react' ;
44import styled from '@emotion/styled' ;
55import type { LocationDescriptor } from 'history' ;
@@ -16,6 +16,7 @@ import {space} from 'sentry/styles/space';
1616import { defined } from 'sentry/utils' ;
1717import { trackAnalytics } from 'sentry/utils/analytics' ;
1818import localStorage from 'sentry/utils/localStorage' ;
19+ import { isChonkTheme } from 'sentry/utils/theme/withChonk' ;
1920import normalizeUrl from 'sentry/utils/url/normalizeUrl' ;
2021import useOrganization from 'sentry/utils/useOrganization' ;
2122import useRouter from 'sentry/utils/useRouter' ;
@@ -151,6 +152,7 @@ function SidebarItem({
151152 badgeTitle,
152153 ...props
153154} : SidebarItemProps ) {
155+ const theme = useTheme ( ) ;
154156 const { setExpandedItemId, shouldAccordionFloat} = useContext ( ExpandedContext ) ;
155157 const router = useRouter ( ) ;
156158 // label might be wrapped in a guideAnchor
@@ -242,6 +244,7 @@ function SidebarItem({
242244 < SidebarNavigationItemHook id = { id } >
243245 { ( { additionalContent} ) => (
244246 < StyledSidebarItem
247+ theme = { theme }
245248 { ...props }
246249 id = { `sidebar-item-${ id } ` }
247250 isInFloatingAccordion = { isInFloatingAccordion }
@@ -371,10 +374,10 @@ const getActiveStyle = ({
371374 theme,
372375 isInFloatingAccordion,
373376} : {
377+ theme : Theme ;
374378 active ?: string ;
375379 hasNewNav ?: boolean ;
376380 isInFloatingAccordion ?: boolean ;
377- theme ?: Theme ;
378381} ) => {
379382 if ( ! active ) {
380383 return '' ;
@@ -384,21 +387,23 @@ const getActiveStyle = ({
384387 & : active ,
385388 & : focus ,
386389 & : hover {
387- color : ${ theme ? .gray400 } ;
390+ color : ${ isChonkTheme ( theme ) ? theme . subText : theme . gray400 } ;
388391 }
389392 ` ;
390393 }
391394 return css `
392- color : ${ theme ? .white } ;
395+ color : ${ isChonkTheme ( theme ) ? theme . colors . blue400 : theme . white } ;
393396
394397 & : active ,
395398 & : focus ,
396399 & : hover {
397- color : ${ theme ? .white } ;
400+ color : ${ isChonkTheme ( theme ) ? theme . colors . blue400 : theme . white } ;
398401 }
399402
400403 & : before {
401- background-color : ${ theme ?. active } ;
404+ background-color : ${ ! ! theme && isChonkTheme ( theme )
405+ ? theme . colors . chonk . blue400
406+ : theme . active } ;
402407 }
403408 ` ;
404409} ;
@@ -407,12 +412,17 @@ const StyledSidebarItem = styled(Link, {
407412 shouldForwardProp : p =>
408413 ! [ 'isInFloatingAccordion' , 'hasNewNav' , 'index' , 'organization' ] . includes ( p ) ,
409414} ) `
415+ color: ${ p =>
416+ isChonkTheme ( p . theme )
417+ ? p . theme . subText
418+ : p . isInFloatingAccordion
419+ ? p . theme . gray400
420+ : 'inherit' } ;
421+ height: ${ p => ( p . isInFloatingAccordion ? '35px' : p . hasNewNav ? '40px' : '30px' ) } ;
410422 display: flex;
411- color: ${ p => ( p . isInFloatingAccordion ? p . theme . gray400 : 'inherit' ) } ;
412423 position: relative;
413424 cursor: pointer;
414425 font-size: 15px;
415- height: ${ p => ( p . isInFloatingAccordion ? '35px' : p . hasNewNav ? '40px' : '30px' ) } ;
416426 flex-shrink: 0;
417427 border-radius: ${ p => p . theme . borderRadius } ;
418428 transition: none;
@@ -458,11 +468,11 @@ const StyledSidebarItem = styled(Link, {
458468 if ( p . isInFloatingAccordion ) {
459469 return css `
460470 background-color : ${ p . theme . hover } ;
461- color : ${ p . theme . gray400 } ;
471+ color : ${ isChonkTheme ( p . theme ) ? p . theme . subText : p . theme . gray400 } ;
462472 ` ;
463473 }
464474 return css `
465- color : ${ p . theme . white } ;
475+ color : ${ isChonkTheme ( p . theme ) ? p . theme . colors . chonk . blue400 : p . theme . white } ;
466476 ` ;
467477 } }
468478 }
@@ -483,10 +493,10 @@ const SidebarItemWrapper = styled('div')<{collapsed?: boolean; hasNewNav?: boole
483493 display: flex;
484494 align-items: center;
485495 justify-content: center;
486- ${ p => p . hasNewNav && 'flex-direction: column;' }
487496 width: 100%;
488-
497+ ${ p => p . hasNewNav && 'flex-direction: column;' }
489498 ${ p => ! p . collapsed && `padding-right: ${ space ( 1 ) } ;` }
499+
490500 @media (max-width: ${ p => p . theme . breakpoints . medium } ) {
491501 padding-right: 0;
492502 }
@@ -541,26 +551,27 @@ const getCollapsedBadgeStyle = ({collapsed, theme}: any) => {
541551 }
542552
543553 return css `
554+ background : ${ theme . red300 } ;
544555 text-indent : -99999em ;
545556 position : absolute;
546557 right : 0 ;
547558 top : 1px ;
548- background : ${ theme . red300 } ;
549559 width : 11px ;
550560 height : 11px ;
551561 border-radius : 11px ;
552562 line-height : 11px ;
553- box-shadow : 0 3px 3px # 2f2936 ;
563+ box-shadow : ${ theme . isChonk ? 'none' : ' 0 3px 3px #2f2936' } ;
554564 ` ;
555565} ;
556566
557567// @ts -expect-error TS(7031): Binding element '_' implicitly has an 'any' type.
558568const SidebarItemBadge = styled ( ( { collapsed : _ , ...props } ) => < span { ...props } /> ) `
569+ color: ${ p => p . theme . white } ;
570+ background: ${ p =>
571+ isChonkTheme ( p . theme ) ? p . theme . colors . chonk . red400 : p . theme . red300 } ;
559572 display: block;
560573 text-align: center;
561- color: ${ p => p . theme . white } ;
562574 font-size: 12px;
563- background: ${ p => p . theme . red300 } ;
564575 width: 22px;
565576 height: 22px;
566577 border-radius: 22px;
@@ -576,6 +587,6 @@ const CollapsedFeatureBadge = styled(FeatureBadge)`
576587` ;
577588
578589const StyledInteractionStateLayer = styled ( InteractionStateLayer ) `
579- height: ${ 16 * 2 + 40 } px ;
590+ height: 72px ;
580591 width: 70px;
581592` ;
0 commit comments