import React, { PropsWithChildren } from "react" import classNames from "classnames"…
- User
import React, { PropsWithChildren } from "react" import classNames from "classnames" import styles from "./button.styles.module.css" import { memoComponent } from "../../memo-component/memo-component.component"
export const Button = memoComponent( "Button", function ({ children, title, mode = "primary", ...otherProps }: PropsWithChildren< { title?: string mode?: | "primary" | "primary-small" | "success" | "success-small" | "danger" | "danger-small" | "outline" | "outline-small" | "outline-danger" | "outline-danger-small" | "simple" | "simple-small" | "link" | "link-small" } & React.ButtonHTMLAttributes
) { return ( <button type="button" {...otherProps} className={classNames(otherProps.className, { [styles.button]: true, [styles.primary]: mode === "primary" || mode === "primary-small", [styles.success]: mode === "success" || mode === "success-small", [styles.danger]: mode === "danger" || mode === "danger-small", [styles.border]: mode === "outline" || mode === "outline-small", [styles.borderDanger]: mode === "outline-danger" || mode === "outline-danger-small", [styles.simple]: mode === "simple" || mode === "simple-small", [styles.link]: mode === "link" || mode === "link-small", [styles.linkSmall]: mode === "link-small", [styles.small]: mode === "primary-small" || mode === "success-small" || mode === "danger-small" || mode === "outline-small" || mode === "outline-danger-small" || mode === "simple-small", })} > {children} ) }, ) how to give priority to otherProps.className than others
- Assistant
- User
not worked
- Assistant