fix(sidebar): environment names on hover EE-6854 (#11755)

pull/11604/merge
Dakota Walsh 2024-05-08 17:08:07 -04:00 committed by GitHub
parent 4ef71f4aca
commit 014c491205
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -64,6 +64,7 @@ function Content({ environment, onClear }: ContentProps) {
return ( return (
<SidebarSection <SidebarSection
title={<Title environment={environment} onClear={onClear} />} title={<Title environment={environment} onClear={onClear} />}
hoverText={environment.Name}
aria-label={environment.Name} aria-label={environment.Name}
showTitleWhenOpen showTitleWhenOpen
> >

View File

@ -4,19 +4,24 @@ import { useSidebarState } from './useSidebarState';
interface Props { interface Props {
title: ReactNode; title: ReactNode;
hoverText?: string;
showTitleWhenOpen?: boolean; showTitleWhenOpen?: boolean;
'aria-label'?: string; 'aria-label'?: string;
} }
export function SidebarSection({ export function SidebarSection({
title, title,
hoverText,
children, children,
showTitleWhenOpen, showTitleWhenOpen,
'aria-label': ariaLabel, 'aria-label': ariaLabel,
}: PropsWithChildren<Props>) { }: PropsWithChildren<Props>) {
return ( return (
<div> <div>
<SidebarSectionTitle showWhenOpen={showTitleWhenOpen}> <SidebarSectionTitle
showWhenOpen={showTitleWhenOpen}
hoverText={hoverText}
>
{title} {title}
</SidebarSectionTitle> </SidebarSectionTitle>
@ -32,10 +37,12 @@ export function SidebarSection({
interface TitleProps { interface TitleProps {
showWhenOpen?: boolean; showWhenOpen?: boolean;
hoverText?: string;
} }
export function SidebarSectionTitle({ export function SidebarSectionTitle({
showWhenOpen, showWhenOpen,
hoverText,
children, children,
}: PropsWithChildren<TitleProps>) { }: PropsWithChildren<TitleProps>) {
const { isOpen } = useSidebarState(); const { isOpen } = useSidebarState();
@ -45,7 +52,10 @@ export function SidebarSectionTitle({
} }
return ( return (
<li className="ml-3 text-sm text-gray-3 transition-all duration-500 ease-in-out be:text-gray-6"> <li
title={hoverText}
className="ml-3 text-sm text-gray-3 transition-all duration-500 ease-in-out be:text-gray-6"
>
{children} {children}
</li> </li>
); );