mirror of
https://github.com/zadam/trilium.git
synced 2026-02-27 09:03:36 +01:00
ui/card frame: add support for arbitrary HTML attributes and event handlers
This commit is contained in:
parent
ad2df957c7
commit
e6e132e905
@ -1,23 +1,24 @@
|
|||||||
import "./Card.css";
|
import "./Card.css";
|
||||||
import { ComponentChildren, createContext } from "preact";
|
import { ComponentChildren, createContext } from "preact";
|
||||||
import { JSX } from "preact";
|
import { JSX, HTMLAttributes } from "preact";
|
||||||
import { useContext } from "preact/hooks";
|
import { useContext } from "preact/hooks";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
// #region Card Frame
|
// #region Card Frame
|
||||||
|
|
||||||
export interface CardFrameProps {
|
export interface CardFrameProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
className?: string;
|
className?: string;
|
||||||
highlightOnHover?: boolean;
|
highlightOnHover?: boolean;
|
||||||
children: ComponentChildren;
|
children: ComponentChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CardFrame(props: CardFrameProps) {
|
export function CardFrame({className, highlightOnHover, children, ...rest}: CardFrameProps) {
|
||||||
return <div className={clsx("tn-card-frame", props.className, {
|
return <div {...rest}
|
||||||
"tn-card-highlight-on-hover": props.highlightOnHover
|
className={clsx("tn-card-frame", className, {
|
||||||
|
"tn-card-highlight-on-hover": highlightOnHover
|
||||||
})}>
|
})}>
|
||||||
|
|
||||||
{props.children}
|
{children}
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user