Skip to content

Commit

Permalink
chore: add no nested ternary to ESLint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
marktlinn committed Sep 7, 2023
1 parent 38de395 commit 4686ab8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"object-curly-newline": [2, { "minProperties": 4, "consistent": true }],
"brace-style": 2,
"no-multiple-empty-lines": 2,
"eol-last": [2, "always"]
"eol-last": [2, "always"],
"no-nested-ternary": 2
}
}
15 changes: 7 additions & 8 deletions src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import Image from "next/image";
interface AvatarProps {
imgPath?: string;
width?: number;
height?: number
height?: number;
}

export default function Avatar({ imgPath = "/grey_ball.png", width = 24, height = 24 }: AvatarProps) {
export default function Avatar({
imgPath = "/grey_ball.png",
width = 24,
height = 24,
}: AvatarProps) {
return (
<div className="px-0 pointer-events-none">
<Image
width={width}
height={height}
src={imgPath}
alt="Profile image"
/>
<Image width={width} height={height} src={imgPath} alt="Profile image" />
</div>
);
}
6 changes: 5 additions & 1 deletion src/components/navbar/DropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export default function DropDown({ name }: { name: string }) {
<ul className="mx-4 p-2 bg-white left-2 font-medium z-10">
<li>
<DropDownLink handleClick={handleClick} title="Link 1" />
<DropDownLink handleClick={handleClick} title="404???" href="/hello404" />
<DropDownLink
handleClick={handleClick}
title="404???"
href="/hello404"
/>
</li>
</ul>
</details>
Expand Down
14 changes: 12 additions & 2 deletions src/components/navbar/DropDownLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@ interface DropDownLinkProps {
handleClick: () => void;
}

export default function DropDownLink({ title, href = "#", handleClick }: DropDownLinkProps) {
export default function DropDownLink({
title,
href = "#",
handleClick,
}: DropDownLinkProps) {
return (
<Link href={href} className="text-neutral hover:text-primary duration-200" onClick={handleClick}>{title}</Link>
<Link
href={href}
className="text-neutral hover:text-primary duration-200"
onClick={handleClick}
>
{title}
</Link>
);
}

0 comments on commit 4686ab8

Please sign in to comment.