25 lines
No EOL
529 B
TypeScript
25 lines
No EOL
529 B
TypeScript
import React from "react";
|
|
|
|
interface LabelProps {
|
|
href?: string;
|
|
children: React.ReactNode;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
const Label = ({ href, children, onClick }: LabelProps) => {
|
|
const styles = "items-center space-x-1 background-accent p-2 rounded"
|
|
|
|
if (href !== undefined) {
|
|
return (
|
|
<div className={styles}>
|
|
{ children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return <button className={styles} onClick={onClick}>
|
|
{ children }
|
|
</button>
|
|
}
|
|
|
|
export default Label |