Skip to content
Snippets Groups Projects
Verified Commit ae290aa2 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new tuple component

parent 1ddd700c
No related branches found
No related tags found
1 merge request!8Support for react.js components
Pipeline #1060 passed
export * from "./button/button"; export * from "./button/button";
export * from "./tuple/tuple";
import React, { FC } from "react";
import "./tuple.css";
type TupleProps = {
key: string;
value?: string;
style?: string[];
onKeyClick?: () => void;
onValueClick?: () => void;
};
export const Tuple: FC<TupleProps> = ({
key,
value,
style = [],
onKeyClick,
onValueClick
}) => {
const classes = () => ["table-entry", ...style].join(" ");
const _onKeyClick = () => (onKeyClick ? onKeyClick() : undefined);
const _onValueClick = () => (onValueClick ? onValueClick() : undefined);
return (
<>
<dt className={classes()} onClick={_onKeyClick}>
{key}
</dt>
<dd className={classes()} onClick={_onValueClick}>
{value ?? ""}
</dd>
</>
);
};
export default Tuple;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment