mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-16 18:52:12 +03:00
a540a201e3
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
46 lines
995 B
TypeScript
46 lines
995 B
TypeScript
import { useState } from "react";
|
|
|
|
import { iconList } from "@/lib/helpers/iconList";
|
|
import { Color } from "@/lib/types/Colors";
|
|
|
|
import styles from "./TextButton.module.scss";
|
|
|
|
import { Icon } from "../Icon/Icon";
|
|
|
|
interface TextButtonProps {
|
|
iconName: keyof typeof iconList;
|
|
label: string;
|
|
color: Color;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
export const TextButton = (props: TextButtonProps): JSX.Element => {
|
|
const [hovered, setHovered] = useState(false);
|
|
|
|
return (
|
|
<div
|
|
className={styles.text_button_wrapper}
|
|
onMouseEnter={() => setHovered(true)}
|
|
onMouseLeave={() => setHovered(false)}
|
|
onClick={props.onClick}
|
|
>
|
|
<Icon
|
|
name={props.iconName}
|
|
size="normal"
|
|
color={props.color}
|
|
hovered={hovered}
|
|
/>
|
|
<span
|
|
className={`
|
|
${styles[props.color] ?? ""}
|
|
${hovered ? styles.hovered ?? "" : ""}
|
|
`}
|
|
>
|
|
{props.label}
|
|
</span>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default TextButton;
|