Skip to content

Commit

Permalink
fix(FEC-13729): transcript menu fix (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
semarche-kaltura authored Jun 26, 2024
1 parent 2116145 commit fd50310
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/components/plugins/menu-item/menu-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
cursor: pointer;
border-radius: 2px;

&.disabled {
cursor: not-allowed;
opacity: 0.6;
}

.plugin-icon {
width: 24px;
height: 24px;
Expand Down
6 changes: 3 additions & 3 deletions src/components/plugins/menu-item/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ interface MenuItemProps {
onClick: (player: any) => void;
pluginName: string;
icon: {svgUrl: string; viewBox: string};
disabled?: boolean;
}

const MenuItem = ({pluginName, icon, onClick}: MenuItemProps) => {
const MenuItem = ({pluginName, icon, onClick, disabled}: MenuItemProps) => {
return (
// @ts-ignore - error TS2786: 'A11yWrapper' cannot be used as a JSX component.
<A11yWrapper onClick={onClick}>
<div className={styles.menuItem} tabIndex={0} aria-label={pluginName}>
<div className={[styles.menuItem, disabled ? styles.disabled : ''].join(' ')} tabIndex={0} aria-label={pluginName} aria-disabled={disabled}>
<span className={styles.pluginIcon}>
<Icon id={`min-audio-player-${pluginName}`} path={icon.svgUrl} viewBox={icon.viewBox} />
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,26 @@ const PluginsMenuOverlay = ({plugins, onClose, player}: PluginsMenuOverlayProps)
<div className={styles.menu}>
{plugins.map(({pluginName, action, icon, isDisabled}) => {
const disabled = isDisabled?.(player);
if (disabled) {
return null;
}
return (
<MenuItem
disabled={disabled}
pluginName={pluginName}
icon={icon}
onClick={() => {
if (disabled) {
return;
}
onClose();
action(player);
}}
/>
)
);
})}
</div>
</div>
</Overlay>
</OverlayPortal>
)
);
};

export {PluginsMenuOverlay};

0 comments on commit fd50310

Please sign in to comment.