chore: IndexSidebar class

This commit is contained in:
Sami Mazouz 2024-08-08 15:41:48 +01:00
parent 09b9b4a083
commit a00b0df4d8
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,10 @@ export default function isDark(hexcolor: string | null): boolean {
let hexnumbers = hexcolor.replace('#', '');
if (hexnumbers.length === 3) {
hexnumbers = hexnumbers.split('').map(char => char.repeat(2)).join('');
hexnumbers = hexnumbers
.split('')
.map((char) => char.repeat(2))
.join('');
}
const r = parseInt(hexnumbers.slice(0, 2), 16);

View File

@ -7,13 +7,14 @@ import Button from '../../common/components/Button';
import SelectDropdown from '../../common/components/SelectDropdown';
import listItems from '../../common/helpers/listItems';
import LinkButton from '../../common/components/LinkButton';
import classList from '../../common/utils/classList';
export interface IndexSidebarAttrs extends ComponentAttrs {}
export default class IndexSidebar<CustomAttrs extends IndexSidebarAttrs = IndexSidebarAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children {
return (
<nav className="IndexPage-nav sideNav">
<nav className={classList('IndexPage-nav sideNav', this.attrs.className)}>
<ul>{listItems(this.items().toArray())}</ul>
</nav>
);