Skip to content

Commit

Permalink
refactor: use conditional operator, simplify expression
Browse files Browse the repository at this point in the history
  • Loading branch information
VinayakRugvedi authored and bshankar committed Sep 6, 2024
1 parent cc816d2 commit 9f2bf02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/formInputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const SwitchToggle = ({
{label && labelPosition !== 'right' && <span className="di mr2 nowrap f6 dn-m">{label}</span>}
<div className="relative dib">
<input
className={`absolute z-5 w-100 h-100 o-0 ${!isDisabled && 'pointer'} checkbox`}
className={`absolute z-5 w-100 h-100 o-0 ${!isDisabled ? 'pointer' : ''} checkbox`}
type="checkbox"
checked={isChecked}
onChange={onChange}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/projects/exploreProjectsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export const ExploreProjectsTable = ({ projects, status }) => {
{row.getVisibleCells().map((cell) => (
<td
className={`f6 pr3 mw5 pl2 bb b--moon-gray ${
cell.column.id !== 'progress' && 'truncate'
cell.column.id !== 'progress' ? 'truncate' : ''
}`} // Don't add truncate class to progress column as it shows a tooltip
key={cell.id}
style={{
Expand All @@ -258,14 +258,14 @@ export const ExploreProjectsTable = ({ projects, status }) => {
</tbody>
</table>

{isEmpty ? (
{isEmpty && (
<div className="flex items-center justify-start pa4 gap-1 pl2">
<CircleExclamationIcon className="red" width="20" height="20" />
<p className="ma0">
<FormattedMessage {...messages.projectsTableEmpty} />
</p>
</div>
) : null}
)}
</div>
);
};
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/projects/projectSearchResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ export const ProjectSearchResults = ({
);

const cardWidthClass = 'w-100';
let isShowListView = management && listViewIsActive;
if (isExploreProjectsPage && isExploreProjectsTableView) {
isShowListView = true;
}
const isShowListView =
(management && listViewIsActive) || (isExploreProjectsPage && isExploreProjectsTableView);

return (
<div className={`${className}`}>
Expand Down

0 comments on commit 9f2bf02

Please sign in to comment.