Skip to content

Commit

Permalink
make eslint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnIckler committed Jun 5, 2023
1 parent 167f528 commit 1505324
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
32 changes: 18 additions & 14 deletions src/components/Header/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import UiIcon from '../UiIcon'
import React, { useState } from 'react'
import UiIcon from '../UiIcon'

type Item = {
interface Item {
path: string
title: string
icon: string
}

type Divider = {
interface Divider {
divider: true
}

// eslint-disable-next-line no-prototype-builtins
const isDivider = (item: object) => item.hasOwnProperty('divider')

export interface DropdownProps {
active?: boolean
icon: string
Expand All @@ -35,24 +38,25 @@ export default function Dropdown({
onMouseEnter={toggleHover}
onMouseLeave={toggleHover}
>
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a href="#" onClick={close} className="dropdown-toggle top-nav">
<UiIcon name={icon} />
<span className="hidden-sm hidden-md">{title}</span>
<span className="caret"></span>
<span className="caret" />
</a>
<ul className="dropdown-menu" role="menu">
{items.map((item, index) => {
if ((item as Divider).divider) {
return <li className="divider" key={index}></li>
} else {
return (
<li>
<a href={(item as Item).path} key={index}>
<UiIcon name={(item as Item).icon} /> {(item as Item).title}
</a>
</li>
)
if (isDivider(item)) {
// eslint-disable-next-line react/no-array-index-key
return <li key={`divider-${index}`} className="divider" />
}
return (
<li key={(item as Item).title}>
<a href={(item as Item).path}>
<UiIcon name={(item as Item).icon} /> {(item as Item).title}
</a>
</li>
)
})}
</ul>
</li>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export default function Header({ brandImage, dropdowns }: HeaderProps) {
data-toggle="collapse"
data-target=".navbar-collapse"
>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar" />
<span className="icon-bar" />
<span className="icon-bar" />
</button>
<div className="navbar-collapse collapse disabled">
<ul className="nav navbar-nav">
Expand Down
2 changes: 1 addition & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { default as CubingIcon } from './CubingIcon'
export { default as EventSelector } from './EventSelector'
export { default as Footer } from './Footer'
export { default as Header } from './Header'
export { default as UiIcon } from './UiIcon'
export { default as EventSelector } from './EventSelector'

0 comments on commit 1505324

Please sign in to comment.