chore: better Prettier config for easier reviews
This commit is contained in:
@ -1,18 +1,18 @@
|
||||
import { forwardRef } from 'react'
|
||||
import classNames from 'clsx'
|
||||
import { forwardRef } from "react"
|
||||
import classNames from "clsx"
|
||||
|
||||
const className =
|
||||
'py-2 px-6 font-paragraph rounded-lg bg-transparent border hover:text-white dark:hover:text-black fill-current stroke-current transform transition-colors duration-300 ease-in-out focus:outline-none focus:text-white dark:focus:text-black'
|
||||
"py-2 px-6 font-paragraph rounded-lg bg-transparent border hover:text-white dark:hover:text-black fill-current stroke-current transform transition-colors duration-300 ease-in-out focus:outline-none focus:text-white dark:focus:text-black"
|
||||
|
||||
const classNameGreen =
|
||||
'border-green-800 dark:border-green-400 text-green-800 dark:text-green-400 hover:bg-green-800 focus:bg-green-800 dark:focus:bg-green-400 dark:hover:bg-green-400'
|
||||
"border-green-800 dark:border-green-400 text-green-800 dark:text-green-400 hover:bg-green-800 focus:bg-green-800 dark:focus:bg-green-400 dark:hover:bg-green-400"
|
||||
|
||||
const classNameRed =
|
||||
'border-red-800 dark:border-red-400 text-red-800 dark:text-red-400 hover:bg-red-800 focus:bg-red-800 dark:focus:bg-red-400 dark:hover:bg-red-400'
|
||||
"border-red-800 dark:border-red-400 text-red-800 dark:text-red-400 hover:bg-red-800 focus:bg-red-800 dark:focus:bg-red-400 dark:hover:bg-red-400"
|
||||
|
||||
export type ButtonColor = 'green' | 'red'
|
||||
export type ButtonColor = "green" | "red"
|
||||
|
||||
export interface ButtonLinkProps extends React.ComponentPropsWithRef<'a'> {
|
||||
export interface ButtonLinkProps extends React.ComponentPropsWithRef<"a"> {
|
||||
color?: ButtonColor
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ export const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(
|
||||
const {
|
||||
children,
|
||||
className: givenClassName,
|
||||
color = 'green',
|
||||
color = "green",
|
||||
...rest
|
||||
} = props
|
||||
|
||||
@ -31,22 +31,22 @@ export const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(
|
||||
className={classNames(
|
||||
className,
|
||||
{
|
||||
[classNameGreen]: color === 'green',
|
||||
[classNameRed]: color === 'red'
|
||||
[classNameGreen]: color === "green",
|
||||
[classNameRed]: color === "red",
|
||||
},
|
||||
givenClassName
|
||||
givenClassName,
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
ButtonLink.displayName = 'ButtonLink'
|
||||
ButtonLink.displayName = "ButtonLink"
|
||||
|
||||
export interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
|
||||
export interface ButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
||||
color?: ButtonColor
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ export const Button: React.FC<ButtonProps> = (props) => {
|
||||
const {
|
||||
children,
|
||||
className: givenClassName,
|
||||
color = 'green',
|
||||
color = "green",
|
||||
...rest
|
||||
} = props
|
||||
|
||||
@ -63,10 +63,10 @@ export const Button: React.FC<ButtonProps> = (props) => {
|
||||
className={classNames(
|
||||
className,
|
||||
{
|
||||
[classNameGreen]: color === 'green',
|
||||
[classNameRed]: color === 'red'
|
||||
[classNameGreen]: color === "green",
|
||||
[classNameRed]: color === "red",
|
||||
},
|
||||
givenClassName
|
||||
givenClassName,
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
|
@ -1 +1 @@
|
||||
export * from './Button'
|
||||
export * from "./Button"
|
||||
|
Reference in New Issue
Block a user