quivr/frontend/lib/components/ui/TextButton/TextButton.tsx
Antoine Dewez b5e2d5ad9c
feat(frontend): Add Brain On Search Page (#2067)
# Description

- Implement Icon Component
- Implement TextButton Component
- Change Add Brain Button And Set it in the Search Page
- Fix Errors When sending empty message
- Change EsLint rules

## 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):
2024-01-22 17:37:45 -08:00

44 lines
941 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;
}
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)}
>
<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;