-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from ASSETS-Conference/dev
new header component & fixing alphabetical ordering
- Loading branch information
Showing
3 changed files
with
109 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import react from "react"; | ||
/** | ||
* Displays a box with a letter in it, acts as a list heading for alphabetic lists. | ||
* @param {object} props The props of the component | ||
* @param {String} props.letter The letter of the alphabet you would like displayed as the header in the listing | ||
* @param {HTMLElement?} props.className Standard Class property. | ||
* @returns {import("react").ReactNode} | ||
*/ | ||
export default function Letter({ letter, className }) { | ||
return ( | ||
<> | ||
<a | ||
key={`letter-${letter}`} | ||
className={`border-2 w-12 border-theme-dark text-theme-dark flex items-center px-2 pt-4 hover:text-white hover:bg-theme-dark transition-colors ${className}`} | ||
href={letter ? "#beginning-with-" + letter .toLowerCase(): "#?"} | ||
> | ||
<h2 className={"text-xl font-light m-0"}>{letter ? letter : "?"}</h2> | ||
</a> | ||
{/* this is a way to push the scrollbar so it offsets the header */} | ||
<div | ||
aria-hidden | ||
className="h-0 scroll-m-36" | ||
id={letter ? "beginning-with-" + letter.toLowerCase() : "#?"} | ||
></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
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