Skip to content

Commit

Permalink
[SXA] #539173 fixed lint (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
sc-ruslanmatkovskyi authored Jun 21, 2022
1 parent 079d830 commit 7e6f04d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $bg-submenu-active:#f6f6f6 !default;
$bg-black:#000;
$bg-black-active:#3d3d3d;
//Text colors
$text-gray: #262626;
$text-white:#fff !default;
$text-heading-color: #222 !default;
$text-basic:#747474 !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Fields {
type NavigationProps = {
params?: { [key: string]: string };
fields: Fields;
handleClick: Function;
handleClick: () => void;
};

const getNavigationText = function (props: NavigationProps): JSX.Element | string {
Expand All @@ -41,6 +41,8 @@ const getLinkField = (props: NavigationProps): LinkField => ({
});

const Navigation = (props: NavigationProps): JSX.Element => {
const [isOpenMenu, openMenu] = useState(false);

if (!Object.values(props.fields).length) {
return (
<div className={`component navigation`}>
Expand All @@ -49,7 +51,6 @@ const Navigation = (props: NavigationProps): JSX.Element => {
);
}

const [isOpenMenu, openMenu] = useState(false);
const handleToggleMenu = (flag?: boolean): void => {
if (flag !== undefined) {
return openMenu(flag);
Expand All @@ -60,7 +61,11 @@ const Navigation = (props: NavigationProps): JSX.Element => {
const list = Object.values(props.fields)
.filter((element) => element)
.map((element: Fields, key: number) => (
<NavigationList key={`${key}${element.Id}`} fields={element} handleClick={() => handleToggleMenu(false)} />
<NavigationList
key={`${key}${element.Id}`}
fields={element}
handleClick={() => handleToggleMenu(false)}
/>
));
const styles =
props.params != null ? `${props.params.GridParameters} ${props.params.Styles}` : null;
Expand Down Expand Up @@ -98,7 +103,11 @@ const NavigationList = (props: NavigationProps) => {
let children: JSX.Element[] = [];
if (props.fields.Children && props.fields.Children.length) {
children = props.fields.Children.map((element: Fields, index: number) => (
<NavigationList key={`${index}${element.Id}`} fields={element} handleClick={props.handleClick} />
<NavigationList
key={`${index}${element.Id}`}
fields={element}
handleClick={props.handleClick}
/>
));
}

Expand Down

0 comments on commit 7e6f04d

Please sign in to comment.