Skip to content

Commit

Permalink
🎨 [#36] Simplify building link modifiers list
Browse files Browse the repository at this point in the history
From PR feedback - unused arguments are removed, which allows for
a simpler list building implementation.
  • Loading branch information
sergei-maertens committed Nov 24, 2023
1 parent 00a22aa commit a3cfe62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/ProgressIndicator/ProgressIndicatorItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import {getBEMClassName} from 'utils';

import CompletionMark from './CompletionMark';

const getLinkModifiers = (isActive, isApplicable, isCompleted) => {
return ['inherit', 'hover', isActive ? 'current' : undefined].filter(mod => mod !== undefined);
const getLinkModifiers = isActive => {
const modifiers = ['inherit', 'hover'];
if (isActive) {
modifiers.push('current');
}
return modifiers;
};

/**
Expand Down Expand Up @@ -40,7 +44,7 @@ export const ProgressIndicatorItem = ({
<Link
to={to}
placeholder={!canNavigateTo}
modifiers={canNavigateTo ? getLinkModifiers(isActive, isApplicable, isCompleted) : []}
modifiers={canNavigateTo ? getLinkModifiers(isActive) : []}
aria-label={label}
>
<FormattedMessage
Expand Down

0 comments on commit a3cfe62

Please sign in to comment.