mirror of
https://github.com/IgnatZakalinsky/home-works.git
synced 2026-01-28 12:32:45 +00:00
add prettier and reformat all files
This commit is contained in:
@@ -1,26 +1,24 @@
|
||||
import React, {ButtonHTMLAttributes, DetailedHTMLProps} from 'react'
|
||||
import React, { ButtonHTMLAttributes, DetailedHTMLProps } from 'react'
|
||||
import s from './SuperButton.module.css'
|
||||
|
||||
// тип пропсов обычной кнопки, children в котором храниться название кнопки там уже описан
|
||||
type DefaultButtonPropsType = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
||||
type DefaultButtonPropsType = DetailedHTMLProps<
|
||||
ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
HTMLButtonElement
|
||||
>
|
||||
|
||||
type SuperButtonPropsType = DefaultButtonPropsType & {
|
||||
xType?: string
|
||||
}
|
||||
|
||||
const SuperButton: React.FC<SuperButtonPropsType> = (
|
||||
{
|
||||
xType, className,
|
||||
disabled,
|
||||
...restProps// все остальные пропсы попадут в объект restProps, там же будет children
|
||||
}
|
||||
) => {
|
||||
const SuperButton: React.FC<SuperButtonPropsType> = ({
|
||||
xType,
|
||||
className,
|
||||
disabled,
|
||||
...restProps // все остальные пропсы попадут в объект restProps, там же будет children
|
||||
}) => {
|
||||
const finalClassName = `${s.button} ${
|
||||
disabled
|
||||
? s.disabled
|
||||
: xType === 'red'
|
||||
? s.red
|
||||
: s.default
|
||||
disabled ? s.disabled : xType === 'red' ? s.red : s.default
|
||||
} ${className}` // задачка на смешивание классов
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user