-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
seaerchin
authored and
seaerchin
committed
Sep 13, 2023
1 parent
8df3ba8
commit 12dba17
Showing
4 changed files
with
220 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// NOTE: jsx-ally is disabled for this file as the output of this | ||
// should match jekyll output as closely as possible. | ||
// As jekyll outputs an <a /> tag like so, this behaviour is preserved here. | ||
/* eslint-disable jsx-a11y/anchor-is-valid */ | ||
|
||
/* eslint | ||
react/no-array-index-key: 0 | ||
*/ | ||
import editorStyles from "styles/isomer-cms/pages/Editor.module.scss" | ||
|
||
import { getClassNames } from "templates/utils/stylingUtils" | ||
|
||
interface HeroDropdownElemProps { | ||
title: string | ||
} | ||
const HeroDropdownElem = ({ title }: HeroDropdownElemProps) => ( | ||
<div className={editorStyles["bp-dropdown-item"]}> | ||
<h5>{title}</h5> | ||
</div> | ||
) | ||
|
||
interface HeroDropdownProps { | ||
title: string | ||
isActive?: boolean | ||
options: { title: string }[] | ||
toggleDropdown: () => void | ||
} | ||
export const HeroDropdown = ({ | ||
title, | ||
options, | ||
isActive, | ||
toggleDropdown, | ||
}: HeroDropdownProps) => ( | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"bp-dropdown", | ||
"margin--top--sm", | ||
`${isActive ? "is-active" : null}`, | ||
])} | ||
> | ||
<div className={editorStyles["bp-dropdown-trigger"]}> | ||
<a | ||
className={getClassNames(editorStyles, [ | ||
"bp-button", | ||
"bp-dropdown-button", | ||
"hero-dropdown", | ||
"is-centered", | ||
])} | ||
role="button" | ||
tabIndex={0} | ||
aria-haspopup="true" | ||
aria-controls="hero-dropdown-menu" | ||
onClick={toggleDropdown} | ||
onKeyDown={toggleDropdown} | ||
> | ||
<span> | ||
<b> | ||
<p>{title}</p> | ||
</b> | ||
</span> | ||
<span className={getClassNames(editorStyles, ["icon", "is-small"])}> | ||
<i | ||
className={getClassNames(editorStyles, [ | ||
"sgds-icon", | ||
"sgds-icon-chevron-down", | ||
"is-size-4", | ||
])} | ||
aria-hidden="true" | ||
/> | ||
</span> | ||
</a> | ||
</div> | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"bp-dropdown-menu", | ||
"has-text-left", | ||
])} | ||
id={editorStyles["hero-dropdown-menu"]} | ||
role="menu" | ||
> | ||
<div | ||
className={getClassNames(editorStyles, [ | ||
"bp-dropdown-content", | ||
"is-centered", | ||
])} | ||
> | ||
{options | ||
? options.map((option, index) => | ||
option.title ? ( | ||
<HeroDropdownElem | ||
key={`dropdown-${index}`} | ||
title={option.title} | ||
/> | ||
) : null | ||
) | ||
: null} | ||
</div> | ||
</div> | ||
</div> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.