Skip to content

Commit 46e8274

Browse files
authored
refactor: remove null ternaries (#1306)
1 parent 55a7733 commit 46e8274

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
lines changed

src/components/AccountNotifications.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,28 @@ export const AccountNotifications: FC<IAccountNotifications> = (
101101
</div>
102102
)}
103103

104-
{showAccountNotifications
105-
? groupByRepository
106-
? Object.values(groupedNotifications).map((repoNotifications) => {
107-
const repoSlug = repoNotifications[0].repository.full_name;
104+
{showAccountNotifications && (
105+
<>
106+
{groupByRepository
107+
? Object.values(groupedNotifications).map((repoNotifications) => {
108+
const repoSlug = repoNotifications[0].repository.full_name;
108109

109-
return (
110-
<RepositoryNotifications
111-
key={repoSlug}
112-
repoName={repoSlug}
113-
repoNotifications={repoNotifications}
110+
return (
111+
<RepositoryNotifications
112+
key={repoSlug}
113+
repoName={repoSlug}
114+
repoNotifications={repoNotifications}
115+
/>
116+
);
117+
})
118+
: notifications.map((notification) => (
119+
<NotificationRow
120+
key={notification.id}
121+
notification={notification}
114122
/>
115-
);
116-
})
117-
: notifications.map((notification) => (
118-
<NotificationRow
119-
key={notification.id}
120-
notification={notification}
121-
/>
122-
))
123-
: null}
123+
))}
124+
</>
125+
)}
124126
</>
125127
);
126128
};

src/components/icons/AuthMethodIcon.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ export interface IAuthMethodIcon {
1111
export const AuthMethodIcon: FC<IAuthMethodIcon> = (props: IAuthMethodIcon) => {
1212
return (
1313
<span title={props.type} className="mr-1">
14-
{props.type === 'GitHub App' ? <AppsIcon size={props.size} /> : null}
15-
{props.type === 'Personal Access Token' ? (
16-
<KeyIcon size={props.size} />
17-
) : null}
18-
{props.type === 'OAuth App' ? <PersonIcon size={props.size} /> : null}
14+
{props.type === 'GitHub App' && <AppsIcon size={props.size} />}
15+
{props.type === 'Personal Access Token' && <KeyIcon size={props.size} />}
16+
{props.type === 'OAuth App' && <PersonIcon size={props.size} />}
1917
</span>
2018
);
2119
};

src/components/icons/PlatformIcon.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ export interface IPlatformIcon {
1111
export const PlatformIcon: FC<IPlatformIcon> = (props: IPlatformIcon) => {
1212
return (
1313
<span title={props.type} className="mr-1">
14-
{props.type === 'GitHub Cloud' ? (
15-
<MarkGithubIcon size={props.size} />
16-
) : null}
17-
{props.type === 'GitHub Enterprise Server' ? (
14+
{props.type === 'GitHub Cloud' && <MarkGithubIcon size={props.size} />}
15+
{props.type === 'GitHub Enterprise Server' && (
1816
<ServerIcon size={props.size} />
19-
) : null}
17+
)}
2018
</span>
2119
);
2220
};

0 commit comments

Comments
 (0)