@conduction/components
Version:
React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)
19 lines (18 loc) • 680 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import * as styles from "./CardWrapper.module.css";
export const CardWrapper = (props) => {
const handleKeyDown = (event) => {
if (props.onClick && (event.key === "Enter" || event.key === " ")) {
event.preventDefault();
props.onClick(event);
}
};
const _props = {
...props,
className: `${props.className} ${styles.container}`,
role: props.onClick ? "button" : undefined,
tabIndex: props.onClick ? 0 : undefined,
...(props.onClick && { onKeyDown: handleKeyDown }),
};
return _jsx("div", { ..._props, children: props.children });
};