diff --git a/src/s2-homeworks/hw05/layout/Layout.tsx b/src/s2-homeworks/hw05/layout/Layout.tsx index ca09dcd..263c2ef 100644 --- a/src/s2-homeworks/hw05/layout/Layout.tsx +++ b/src/s2-homeworks/hw05/layout/Layout.tsx @@ -19,7 +19,7 @@ export const Layout: FC = ({ children }) => { <>
- {children} +
{children}
) } diff --git a/src/s2-homeworks/hw13/HW13.module.css b/src/s2-homeworks/hw13/HW13.module.css new file mode 100644 index 0000000..cbd9cde --- /dev/null +++ b/src/s2-homeworks/hw13/HW13.module.css @@ -0,0 +1,28 @@ +.buttonsContainer { + display: flex; + flex-direction: row; + gap: 24px; +} + +.responseContainer { + display: flex; + padding: 90px 0 20px 92px; + gap: 87px; + justify-content: center; + align-items: center; +} + +.answer { + font-family: 'Montserrat', sans-serif; + font-weight: 500; + font-size: 30px; + line-height: 37px; +} + +.info { + font-family: 'Montserrat', sans-serif; + font-weight: 500; + font-size: 16px; + line-height: 20px; + +} \ No newline at end of file diff --git a/src/s2-homeworks/hw13/HW13.tsx b/src/s2-homeworks/hw13/HW13.tsx index d694bff..05141f0 100644 --- a/src/s2-homeworks/hw13/HW13.tsx +++ b/src/s2-homeworks/hw13/HW13.tsx @@ -1,7 +1,12 @@ -import React, { useState } from 'react' +import React, {useState} from 'react' import s2 from '../../s1-main/App.module.css' +import s from './HW13.module.css' import SuperButton from '../hw04/common/c2-SuperButton/SuperButton' import axios from 'axios' +import success200 from './images/200.svg' +import error400 from './images/400.svg' +import error500 from './images/500.svg' +import errorUnknown from './images/error.svg' axios.interceptors.response.use( (response) => response, @@ -16,7 +21,7 @@ axios.interceptors.response.use( const HW13 = () => { const [answer, setAnswer] = useState('') const [info, setInfo] = useState('') - + const [image, setImage] = useState('') const send = (x?: boolean | null) => () => { const url = x === null @@ -26,54 +31,76 @@ const HW13 = () => { setAnswer('...loading') setInfo('...loading') axios - .post(url, { success: x }) + .post(url, {success: x}) .then((res) => { setAnswer(res.data.errorText) setInfo(res.data.info) + res.status === 200 && setImage(success200) }) .catch((e) => { console.log(e) setAnswer(e.response?.data?.errorText || e.message) setInfo(e.response?.data?.info || e.name) + e.response?.status === 400 && setImage(error400) + e.response?.status === 500 && setImage(error500) + e.response?.status === 0 && setImage(errorUnknown) }) } return ( -
-
homeworks 13
+
+
Homework #13
+
+ {/*для автоматической проверки дз (не менять)*/} +
+ + Send true + + + Send false + + + Send undefined + + + Send null + +
+
+
+ {image !== '' && status} +
+
+
+ {answer} +
+
+ {info} +
+
- {/*для автоматической проверки дз (не менять)*/} - - send true - - - send false - - - send undefined - - - send null - - -
{answer}
-
{info}
+
+
) } diff --git a/src/s2-homeworks/hw13/images/200.svg b/src/s2-homeworks/hw13/images/200.svg new file mode 100644 index 0000000..6e34333 --- /dev/null +++ b/src/s2-homeworks/hw13/images/200.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/s2-homeworks/hw13/images/400.svg b/src/s2-homeworks/hw13/images/400.svg new file mode 100644 index 0000000..a1ca001 --- /dev/null +++ b/src/s2-homeworks/hw13/images/400.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/s2-homeworks/hw13/images/500.svg b/src/s2-homeworks/hw13/images/500.svg new file mode 100644 index 0000000..1f24f9e --- /dev/null +++ b/src/s2-homeworks/hw13/images/500.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/s2-homeworks/hw13/images/error.svg b/src/s2-homeworks/hw13/images/error.svg new file mode 100644 index 0000000..8749d2e --- /dev/null +++ b/src/s2-homeworks/hw13/images/error.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +