Skip to content

Commit

Permalink
chore: add missing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti committed Oct 10, 2024
1 parent 6cb5934 commit 2e90359
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions apps/meteor/client/sidebar/Item/Condensed.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IconButton, SidebarV2Item, SidebarV2ItemAvatarWrapper, SidebarV2ItemMenu, SidebarV2ItemTitle } from '@rocket.chat/fuselage';
import { useEffectEvent, usePrefersReducedMotion } from '@rocket.chat/fuselage-hooks';
import type { Keys as IconName } from '@rocket.chat/icons';
import type { ReactElement } from 'react';
import type { AllHTMLAttributes, ReactElement } from 'react';
import React, { memo, useState } from 'react';

type CondensedProps = {
Expand All @@ -17,9 +17,9 @@ type CondensedProps = {
selected?: boolean;
badges?: ReactElement;
clickable?: boolean;
};
} & Omit<AllHTMLAttributes<HTMLAnchorElement>, 'is'>;

const Condensed = ({ icon, title, avatar, actions, href, unread, menu, badges, selected }: CondensedProps) => {
const Condensed = ({ icon, title, avatar, actions, href, unread, menu, badges, selected, ...props }: CondensedProps) => {
const [menuVisibility, setMenuVisibility] = useState(!!window.DISABLE_ANIMATION);

const isReduceMotionEnabled = usePrefersReducedMotion();
Expand All @@ -32,7 +32,7 @@ const Condensed = ({ icon, title, avatar, actions, href, unread, menu, badges, s
};

return (
<SidebarV2Item href={href} selected={selected}>
<SidebarV2Item href={href} selected={selected} {...props}>
{avatar && <SidebarV2ItemAvatarWrapper>{avatar}</SidebarV2ItemAvatarWrapper>}
{icon && icon}
<SidebarV2ItemTitle unread={unread}>{title}</SidebarV2ItemTitle>
Expand Down
6 changes: 4 additions & 2 deletions apps/meteor/client/sidebar/Item/Extended.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@rocket.chat/fuselage';
import { useEffectEvent, usePrefersReducedMotion } from '@rocket.chat/fuselage-hooks';
import type { Keys as IconName } from '@rocket.chat/icons';
import type { AllHTMLAttributes } from 'react';
import React, { memo, useState } from 'react';

import { useShortTimeAgo } from '../../hooks/useTimeAgo';
Expand All @@ -30,7 +31,7 @@ type ExtendedProps = {
menuOptions?: any;
titleIcon?: React.ReactNode;
threadUnread?: boolean;
};
} & Omit<AllHTMLAttributes<HTMLAnchorElement>, 'is'>;

const Extended = ({
icon,
Expand All @@ -47,6 +48,7 @@ const Extended = ({
threadUnread: _threadUnread,
unread,
selected,
...props
}: ExtendedProps) => {
const formatDate = useShortTimeAgo();
const [menuVisibility, setMenuVisibility] = useState(!!window.DISABLE_ANIMATION);
Expand All @@ -61,7 +63,7 @@ const Extended = ({
};

return (
<SidebarV2Item href={href} selected={selected}>
<SidebarV2Item href={href} selected={selected} {...props}>
{avatar && <SidebarV2ItemAvatarWrapper>{avatar}</SidebarV2ItemAvatarWrapper>}

<SidebarV2ItemCol>
Expand Down
7 changes: 4 additions & 3 deletions apps/meteor/client/sidebar/Item/Medium.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IconButton, SidebarV2Item, SidebarV2ItemAvatarWrapper, SidebarV2ItemMenu, SidebarV2ItemTitle } from '@rocket.chat/fuselage';
import { useEffectEvent, usePrefersReducedMotion } from '@rocket.chat/fuselage-hooks';
import type { Keys as IconName } from '@rocket.chat/icons';
import type { AllHTMLAttributes } from 'react';
import React, { memo, useState } from 'react';

type MediumProps = {
Expand All @@ -15,9 +16,9 @@ type MediumProps = {
badges?: React.ReactNode;
selected?: boolean;
menuOptions?: any;
};
} & Omit<AllHTMLAttributes<HTMLAnchorElement>, 'is'>;

const Medium = ({ icon, title, avatar, actions, href, badges, unread, menu, selected }: MediumProps) => {
const Medium = ({ icon, title, avatar, actions, href, badges, unread, menu, selected, ...props }: MediumProps) => {
const [menuVisibility, setMenuVisibility] = useState(!!window.DISABLE_ANIMATION);

const isReduceMotionEnabled = usePrefersReducedMotion();
Expand All @@ -30,7 +31,7 @@ const Medium = ({ icon, title, avatar, actions, href, badges, unread, menu, sele
};

return (
<SidebarV2Item href={href} selected={selected}>
<SidebarV2Item href={href} selected={selected} {...props}>
<SidebarV2ItemAvatarWrapper>{avatar}</SidebarV2ItemAvatarWrapper>
{icon && icon}
<SidebarV2ItemTitle unread={unread}>{title}</SidebarV2ItemTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const SidebarItemTemplateWithData = ({
const badges = (
<>
{showBadge && isUnread && (
<SidebarV2ItemBadge variant={variant} title={badgeTitle}>
<SidebarV2ItemBadge variant={variant} title={badgeTitle} role='status'>
{unread + tunread?.length}
</SidebarV2ItemBadge>
)}
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/client/sidebar/header/SearchSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const SearchSection = () => {
role='searchbox'
small
addon={<Icon name={isDirty ? 'cross' : 'magnifier'} size='x20' onClick={handleEscSearch} />}
aria-label={placeholder}
/>

{user && !isDirty && (
Expand Down

0 comments on commit 2e90359

Please sign in to comment.