diff --git a/src/s1-main/App.tsx b/src/s1-main/App.tsx index 9d943eb..fc9b704 100644 --- a/src/s1-main/App.tsx +++ b/src/s1-main/App.tsx @@ -1,5 +1,7 @@ import React from 'react' import HW2 from '../s2-homeworks/hw02/HW2' +import HW3 from '../s2-homeworks/hw03/HW3' +import HW4 from '../s2-homeworks/hw04/HW4' import s from './App.module.css' import HW1 from '../s2-homeworks/hw01/HW1' // import HW2 from '../s2-homeworks/hw02/HW2' @@ -19,9 +21,9 @@ const App = () => { {/*
react homeworks:
*/} {/**/} - + {/**/} {/**/} - {/**/} + {/**/} diff --git a/src/s2-homeworks/hw01/HW1.tsx b/src/s2-homeworks/hw01/HW1.tsx index 0f4e9ca..24b2f27 100644 --- a/src/s2-homeworks/hw01/HW1.tsx +++ b/src/s2-homeworks/hw01/HW1.tsx @@ -57,7 +57,7 @@ const HW1 = () => { {/*
*/} {/*можно убрать этот тег*/} - {/*
*/} +
{/*можно убрать этот тег*/} ) diff --git a/src/s2-homeworks/hw02/HW2.tsx b/src/s2-homeworks/hw02/HW2.tsx index 8220dac..07816d1 100644 --- a/src/s2-homeworks/hw02/HW2.tsx +++ b/src/s2-homeworks/hw02/HW2.tsx @@ -24,11 +24,11 @@ const defaultAffairs: any = [ // need to fix any // AffairType[] // pure helper functions export const filterAffairs = (affairs: any, filter: any): any => { // need to fix any // (affairs: AffairType[], filter: FilterType): AffairType[] if (filter === 'all') return affairs // создаёт студент - // else if (filter === 'low') return affairs.filter(a => a.priority === 'low') - // else if (filter === 'middle') return affairs.filter(a => a.priority === 'middle') - // else if (filter === 'high') return affairs.filter(a => a.priority === 'high') - // else { - // } + // else if (filter === 'low') return affairs.filter(a => a.priority === 'low') + // else if (filter === 'middle') return affairs.filter(a => a.priority === 'middle') + // else if (filter === 'high') return affairs.filter(a => a.priority === 'high') + // else { + // } // return [] else return affairs.filter((a: any) => a.priority === filter) // need to fix // создаёт студент } @@ -44,7 +44,7 @@ function HW2() { const deleteAffairCallback = (_id: any) => setAffairs(deleteAffair(affairs, _id)) // need to fix any // number return ( -
+
{/*
*/} {/*можно убрать этот тег*/} diff --git a/src/s2-homeworks/hw03/Greeting.module.css b/src/s2-homeworks/hw03/Greeting.module.css index 1f9d5cf..fcfec60 100644 --- a/src/s2-homeworks/hw03/Greeting.module.css +++ b/src/s2-homeworks/hw03/Greeting.module.css @@ -1,61 +1,80 @@ .greetingForm { display: flex; - align-items: center; + flex-direction: column; + padding: 31px 0 0 70px; + height: 336px; +} + +.inputAndButtonContainer { + display: flex; + gap: 24px; + margin-bottom: 22px; } .error { position: absolute; color: red; - margin-left: 10px; - margin-top: -14px; + margin-left: 14px; + margin-top: -28px; } .input { - margin: 10px; - - background: #003300; - color: #99ff99; + border: 1px solid #d1d1d1; + border-radius: 5px; + width: 370px; + font-family: 'Montserrat', sans-serif; + font-style: normal; + font-weight: 500; + font-size: 16px; + line-height: 20px; + padding: 8px 0 8px 12px; + color: #000; } .input:focus { outline: none; - border: #99ff99 solid 2px; + border: 1px solid #06c; } .errorInput { - margin: 10px; - - background: #003300; - color: #99ff99; - - border: 2px solid red; - outline: none; + border: 1px solid red; } .button { - margin: 10px; - width: 60px; - - background: #003300; - color: #99ff99; + margin-left: 12px; + background: #06c; + color: white; + border: none; + border-radius: 15px; outline: none; + padding: 8px 24px; + font-family: 'Montserrat', sans-serif; + font-weight: 600; + font-size: 14px; + line-height: 20px; + cursor: pointer; } + .button:focus { - outline: #99ff99 solid 1px; + } .button:active { - background: #99ff99; + } .button:disabled { - color: #005500; + opacity: 0.6; + cursor: default; } .count { - margin: 10px; + font-family: 'Montserrat', sans-serif; + font-weight: 400; + font-size: 14px; + line-height: 17px; + margin-bottom: 9px; } .greeting { - margin-left: 10px; } \ No newline at end of file diff --git a/src/s2-homeworks/hw03/Greeting.tsx b/src/s2-homeworks/hw03/Greeting.tsx index e80d7eb..091ef6f 100644 --- a/src/s2-homeworks/hw03/Greeting.tsx +++ b/src/s2-homeworks/hw03/Greeting.tsx @@ -1,4 +1,4 @@ -import React, {ChangeEvent, KeyboardEvent} from 'react' +import React, { ChangeEvent, KeyboardEvent } from 'react' import s from './Greeting.module.css' type GreetingPropsType = { @@ -16,24 +16,28 @@ type GreetingPropsType = { const Greeting: React.FC = ( {name, setNameCallback, addUser, onEnter, error, totalUsers, lastUser, onBlur} // деструктуризация пропсов ) => { - const inputClass = error ? s.errorInput : s.input // need to fix with (?:) + const inputClass = error ? `${s.input} ${s.errorInput}` : s.input // need to fix with (?:) return (
-
- -
{error}
+
{totalUsers}
+
+
+ +
{error}
+
+ + +
- -
{totalUsers}
{lastUser && (
hello{' '} diff --git a/src/s2-homeworks/hw03/GreetingContainer.tsx b/src/s2-homeworks/hw03/GreetingContainer.tsx index fb1a5e4..d1f6439 100644 --- a/src/s2-homeworks/hw03/GreetingContainer.tsx +++ b/src/s2-homeworks/hw03/GreetingContainer.tsx @@ -1,6 +1,6 @@ -import React, {ChangeEvent, KeyboardEvent, useState} from 'react' +import React, { ChangeEvent, KeyboardEvent, useState } from 'react' import Greeting from './Greeting' -import {UserType} from './HW3' +import { UserType } from './HW3' type GreetingContainerPropsType = { users: UserType[] // need to fix any @@ -28,7 +28,7 @@ const GreetingContainer: React.FC = ({users, addUser const trimmedName = name.trim() if (!trimmedName) { - setError('name is require!') + setError('name is required!') } setName(trimmedName) // need to fix } @@ -39,7 +39,7 @@ const GreetingContainer: React.FC = ({users, addUser if (!trimmedName) { setName('') - setError('name is require!') + setError('name is required!') } else { addUserCallback(trimmedName) setName('') diff --git a/src/s2-homeworks/hw03/HW3.tsx b/src/s2-homeworks/hw03/HW3.tsx index 493838d..3130aa2 100644 --- a/src/s2-homeworks/hw03/HW3.tsx +++ b/src/s2-homeworks/hw03/HW3.tsx @@ -1,5 +1,5 @@ -import React, {useState} from 'react' -import {v1} from 'uuid' +import React, { useState } from 'react' +import { v1 } from 'uuid' import s from './Greeting.module.css' import s2 from '../../s1-main/App.module.css' import GreetingContainer from './GreetingContainer' @@ -23,16 +23,17 @@ const HW3 = () => { return (
-
+ {/*
*/} {/*можно убрать этот тег*/} -
homeworks 3
+
Homework #3
{/*для автоматической проверки дз (не менять)*/} - +
{/*можно убрать этот тег*/} +
{/*можно убрать этот тег*/}
diff --git a/src/s2-homeworks/hw04/HW4.tsx b/src/s2-homeworks/hw04/HW4.tsx index d9b7af3..67595d6 100644 --- a/src/s2-homeworks/hw04/HW4.tsx +++ b/src/s2-homeworks/hw04/HW4.tsx @@ -5,18 +5,17 @@ import Stand from './Stand' const HW4 = () => { return (
-
{/*можно убрать этот тег*/} -
homeworks 4
- +
Homework #4
+
{/*проверка отображения*/} - демострация возможностей компонент: + {/*демонстрация возможностей компонент:*/}
{/*можно убрать этот тег*/} -
+ {/*
*/} {/*можно убрать этот тег*/}
) diff --git a/src/s2-homeworks/hw04/Stand.module.css b/src/s2-homeworks/hw04/Stand.module.css index f0e083a..732004c 100644 --- a/src/s2-homeworks/hw04/Stand.module.css +++ b/src/s2-homeworks/hw04/Stand.module.css @@ -1,16 +1,25 @@ .stand { display: flex; - justify-content: space-around; + justify-content: space-between; + height: 336px; + align-items: center; + padding: 0 70px; } .inputs { - + display: flex; + flex-direction: column; + gap: 48px; } .buttons { - + display: flex; + flex-direction: column; + gap: 24px; } .checkboxes { - + display: flex; + flex-direction: column; + gap: 36px; } \ No newline at end of file diff --git a/src/s2-homeworks/hw04/Stand.tsx b/src/s2-homeworks/hw04/Stand.tsx index 360384c..fcb9e93 100644 --- a/src/s2-homeworks/hw04/Stand.tsx +++ b/src/s2-homeworks/hw04/Stand.tsx @@ -13,7 +13,7 @@ const Stand = () => { return (
- инпут с ошибкой: + {/*инпут с ошибкой:*/}
{ }} />
- совместим со старым кодом + {/*совместим со старым кодом*/}
{
- обычная кнопка: + {/*обычная кнопка:*/}
default
- красная кнопка: + {/*красная кнопка:*/}
red
- задизэйбленная кнопка: + {/*задизэйбленная кнопка:*/}
disabled
@@ -53,7 +53,7 @@ const Stand = () => {
- чекбокс с текстом: + {/*чекбокс с текстом:*/}
{ some text
- совместим со старым кодом + {/*совместим со старым кодом*/}
= ( const finalInputClassName = `${s.input} ${error ? s.errorInput : s.superInput} ${className}` // задача на смешивание классов return ( - <> +
= ( {...restProps} // отдаём инпуту остальные пропсы если они есть (value например там внутри) /> - {error} - + {error} +
) } 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 5d5a3db..f26a0c3 100644 --- a/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.module.css +++ b/src/s2-homeworks/hw04/common/c2-SuperButton/SuperButton.module.css @@ -8,24 +8,30 @@ } .default { - background: #003300; - color: #99ff99; - outline: none; + background: #06c; } .red { - background: #dd3355; + background: #cc1439; } .disabled { - color: #005500; + background: #004d99; + opacity: 0.5; } .button { position: relative; - margin: 10px; overflow: hidden; cursor: pointer; + border-radius: 15px; + border: none; + color: white; + padding: 5px 24px; + font-family: 'Montserrat', sans-serif; + font-weight: 600; + font-size: 14px; + line-height: 20px; } .button::after { @@ -40,7 +46,7 @@ transform: skew(45deg); - background-color: #ffffff; + background-color: #fff; opacity: 0.7; z-index: 14; @@ -60,19 +66,30 @@ height: 100vh; width: 300vw; - background-color: #ffffff; + background-color: #fff; opacity: 0.2; z-index: 7; } -.button:focus { - outline: #99ff99 solid 1px; +.default:hover { + background: #0080ff; } -.button:active { - background: #99ff99; - color: #003300; +.red:hover { + background: #ff1a47; +} + +.button:focus { + +} + +.default:active { + background: #0059b3; +} + +.red:active { + background: #b31232; } .button:disabled { diff --git a/src/s2-homeworks/hw04/common/c3-SuperCheckbox/SuperCheckbox.module.css b/src/s2-homeworks/hw04/common/c3-SuperCheckbox/SuperCheckbox.module.css index 970a784..dc83274 100644 --- a/src/s2-homeworks/hw04/common/c3-SuperCheckbox/SuperCheckbox.module.css +++ b/src/s2-homeworks/hw04/common/c3-SuperCheckbox/SuperCheckbox.module.css @@ -8,35 +8,37 @@ /*input[type="checkbox"] - no*/ .checkbox { - appearance: none; /*Свойство appearance изменяет внешний вид элемента интерфейса, при сохранении его функции. - Если задать значение none, то чекбокс пропадет, но по нему, тем не менее, - можно щелкать и состояние чекбокса будет меняться*/ + appearance: none; + /*Свойство appearance изменяет внешний вид элемента интерфейса, при сохранении его функции. + Если задать значение none, то чекбокс пропадет, но по нему, тем не менее, + можно щелкать и состояние чекбокса будет меняться*/ - width: 20px; - height: 20px; + width: 18px; + height: 18px; - /*background-repeat: no-repeat;*/ - /*background-position: center center;*/ + background-repeat: no-repeat; + background-position: center center; - /*background-size: 90% 90%;*/ - /*vertical-align: middle;*/ - margin-right: 10px; - - background: #335533; + /* background-size: 90% 90%; */ + vertical-align: middle; + margin-right: 8px; + border-radius: 3px; + border: 2px solid #06c; cursor: pointer; } .checkbox:checked { appearance: none; - background-image: url("checked.png"); + background-image: url("checked.svg"); /*background: #99ff99;*/ } .checkbox:focus { - outline: #99ff99 solid 1px; + border-color: #0059b3; } .spanClassName { - + font-family: 'Montserrat', sans-serif; + color: #06c; } \ No newline at end of file diff --git a/src/s2-homeworks/hw04/common/c3-SuperCheckbox/checked.svg b/src/s2-homeworks/hw04/common/c3-SuperCheckbox/checked.svg new file mode 100644 index 0000000..19d18d7 --- /dev/null +++ b/src/s2-homeworks/hw04/common/c3-SuperCheckbox/checked.svg @@ -0,0 +1,3 @@ + + +