= ({
onKeyPress?.(e)
onEnter && // если есть пропс onEnter
- e.key === 'Enter' && // и если нажата кнопка Enter
- onEnter() // то вызвать его
+ e.key === 'Enter' && // и если нажата кнопка Enter
+ onEnter() // то вызвать его
}
- const finalSpanClassName = `${s.error} ${
- spanClassName ? spanClassName : ''
- }`
- const finalInputClassName = `${s.input} ${
- error ? s.errorInput : s.superInput
- } ${className}` // задача на смешивание классов
+ const finalSpanClassName = s.error
+ + (spanClassName ? ' ' + spanClassName : '')
+ const finalInputClassName = s.input
+ + (error ? ' ' + s.errorInput : ' ' + s.superInput)
+ + (className ? ' ' + s.className : '') // задача на смешивание классов
return (
diff --git a/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.module.css b/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.module.css
index b11b31d..06dba34 100644
--- a/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.module.css
+++ b/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.module.css
@@ -1,38 +1,29 @@
-@keyframes blink {
- 0% {
- left: -130%;
- }
- 100% {
- left: 130%;
- }
-}
-
-
-.disabled {
- background: #004d99;
- opacity: 0.5;
- color: #002e5c;
-}
-
-
.button {
overflow: hidden;
- cursor: pointer;
- border-radius: 3px;
- border: 1px solid #0066CC;
- color: white;
padding: 5px 24px;
+
+ border-radius: 3px;
+ border: none;
+
+ color: white;
font-family: 'Montserrat', sans-serif;
font-weight: 600;
font-size: 14px;
line-height: 20px;
+ cursor: pointer;
+}
+
+.disabled {
+ color: #002e5c;
+ background: #004d99;
+ opacity: 0.5;
}
.secondary {
+ color: #0066CC;
background: transparent;
border: 1px solid #0066CC;
border-radius: 3px;
- color: #0066CC;
}
.default {
@@ -43,24 +34,6 @@
background: #cc1439;
}
-.button::after {
- display: block;
- content: '';
- position: absolute;
-
- left: -130%;
- top: 0;
- height: 100%;
- width: 20%;
-
- transform: skew(45deg);
-
- background-color: #fff;
- opacity: 0.7;
-
- z-index: 14;
-}
-
.default:hover {
background: #0080ff;
}
diff --git a/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.tsx b/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.tsx
index ccea9d8..19e5db0 100644
--- a/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.tsx
+++ b/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.tsx
@@ -1,31 +1,31 @@
-import React, { ButtonHTMLAttributes, DetailedHTMLProps } from 'react'
+import React, {ButtonHTMLAttributes, DetailedHTMLProps} from 'react'
import s from './SuperButton.module.css'
// тип пропсов обычной кнопки, children в котором храниться название кнопки там уже описан
-type DefaultButtonPropsType = DetailedHTMLProps<
- ButtonHTMLAttributes,
- HTMLButtonElement
->
+type DefaultButtonPropsType = DetailedHTMLProps,
+ HTMLButtonElement>
type SuperButtonPropsType = DefaultButtonPropsType & {
xType?: string
}
-const SuperButton: React.FC = ({
- xType,
- className,
- disabled,
- ...restProps // все остальные пропсы попадут в объект restProps, там же будет children
-}) => {
- const finalClassName = `${s.button} ${
- disabled
- ? s.disabled
- : xType === 'red'
- ? s.red
- : xType === 'secondary'
- ? s.secondary
- : s.default
- } ${className}` // задачка на смешивание классов
+const SuperButton: React.FC = (
+ {
+ xType,
+ className,
+ disabled,
+ ...restProps // все остальные пропсы попадут в объект restProps, там же будет children
+ }
+) => {
+ const finalClassName = s.button
+ + (disabled
+ ? ' ' + s.disabled
+ : xType === 'red'
+ ? ' ' + s.red
+ : xType === 'secondary'
+ ? ' ' + s.secondary
+ : ' ' + s.default)
+ + (className ? ' ' + className : '') // задачка на смешивание классов
return (
,
- HTMLInputElement
->
+type DefaultInputPropsType = DetailedHTMLProps,
+ HTMLInputElement>
type SuperCheckboxPropsType = Omit & {
onChangeChecked?: (checked: boolean) => void
spanClassName?: string
}
-const SuperCheckbox: React.FC = ({
- onChange,
- onChangeChecked,
- className,
- spanClassName,
- children, // в эту переменную попадёт текст, типизировать не нужно так как он затипизирован в React.FC
- id,
+const SuperCheckbox: React.FC = (
+ {
+ onChange,
+ onChangeChecked,
+ className,
+ spanClassName,
+ children, // в эту переменную попадёт текст, типизировать не нужно так как он затипизирован в React.FC
+ id,
- ...restProps // все остальные пропсы попадут в объект restProps
-}) => {
+ ...restProps // все остальные пропсы попадут в объект restProps
+ }
+) => {
const onChangeCallback = (e: ChangeEvent) => {
// задачка на написание онченджа
onChange?.(e)
@@ -33,7 +33,8 @@ const SuperCheckbox: React.FC = ({
onChangeChecked?.(e.currentTarget.checked)
}
- const finalInputClassName = `${s.checkbox} ${className ? className : ''}`
+ const finalInputClassName = s.checkbox
+ + (className ? ' ' + className : '')
return (