diff --git a/src/s2-homeworks/hw05/pages/JuniorPlus.tsx b/src/s2-homeworks/hw05/pages/JuniorPlus.tsx
index 12e626c..434f7f2 100644
--- a/src/s2-homeworks/hw05/pages/JuniorPlus.tsx
+++ b/src/s2-homeworks/hw05/pages/JuniorPlus.tsx
@@ -1,6 +1,7 @@
import React from 'react'
import HW10 from '../../hw10/HW10'
import HW11 from '../../hw11/HW11'
+import HW12 from '../../hw12/HW12'
function JuniorPlus() {
return (
@@ -8,7 +9,7 @@ function JuniorPlus() {
junior plus page
- {/**/}
+
{/**/}
)
diff --git a/src/s2-homeworks/hw09/HW9.tsx b/src/s2-homeworks/hw09/HW9.tsx
index 431ef8a..192f268 100644
--- a/src/s2-homeworks/hw09/HW9.tsx
+++ b/src/s2-homeworks/hw09/HW9.tsx
@@ -8,6 +8,8 @@ const HW9 = () => {
{value1}
diff --git a/src/s2-homeworks/hw12/HW12.module.css b/src/s2-homeworks/hw12/HW12.module.css
new file mode 100644
index 0000000..5affedc
--- /dev/null
+++ b/src/s2-homeworks/hw12/HW12.module.css
@@ -0,0 +1,23 @@
+.dark {
+ background: dimgrey;
+}
+
+.dark-text {
+ color: aliceblue;
+}
+
+.red {
+ background: lightcoral;
+}
+
+.red-text {
+ color: aqua;
+}
+
+.some {
+ background: lightgreen;
+}
+
+.some-text {
+ color: darkslateblue;
+}
\ No newline at end of file
diff --git a/src/s2-homeworks/hw12/HW12.tsx b/src/s2-homeworks/hw12/HW12.tsx
new file mode 100644
index 0000000..f521236
--- /dev/null
+++ b/src/s2-homeworks/hw12/HW12.tsx
@@ -0,0 +1,44 @@
+import React from 'react'
+import s from './HW12.module.css'
+import s2 from '../../s1-main/App.module.css'
+import SuperSelect from '../hw07/common/c5-SuperSelect/SuperSelect'
+import {useDispatch, useSelector} from 'react-redux'
+import {changeThemeId} from './bll/themeReducer'
+
+const themes = [
+ {id: 1, value: 'dark'},
+ {id: 2, value: 'red'},
+ {id: 3, value: 'some'},
+]
+
+const HW12 = () => {
+ const themeId = useSelector((state: any) => state.theme.themeId)
+ const theme = themes.find(t => t.id === themeId)!.value
+
+ const dispatch = useDispatch()
+ const change = (id: number) => {
+ dispatch(changeThemeId(id))
+ }
+
+ return (
+
+
+ {/*можно убрать этот тег*/}
+
+
homeworks 12
+
+
+
+ {/*можно убрать этот тег*/}
+
+ {/*можно убрать этот тег*/}
+
+ )
+}
+
+export default HW12
diff --git a/src/s2-homeworks/hw12/bll/themeReducer.ts b/src/s2-homeworks/hw12/bll/themeReducer.ts
new file mode 100644
index 0000000..69cda7e
--- /dev/null
+++ b/src/s2-homeworks/hw12/bll/themeReducer.ts
@@ -0,0 +1,17 @@
+const initState = {
+ themeId: 1
+}
+
+export const themeReducer = (state = initState, action: any): any => { // fix any
+ switch (action.type) {
+ case 'SET_THEME_ID': {
+ return {
+ ...state,
+ themeId: action.id,
+ }
+ }
+ default: return state
+ }
+}
+
+export const changeThemeId = (id: number): any => ({type: 'SET_THEME_ID', id}) // fix any
\ No newline at end of file