This commit is contained in:
Andres
2022-06-23 23:20:18 +02:00
parent b590d5b197
commit dcc5cf08a7
7 changed files with 167 additions and 116 deletions

View File

@@ -1,67 +1,70 @@
body { body {
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
'Helvetica Neue', sans-serif; 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
box-sizing: border-box;
} }
code { code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace; monospace;
} }
[data-theme='1']{ [data-theme='1'] {
--primary: #0066CC; --primary: #06c;
--primary-content: #ffffff; --primary-content: #fff;
--secondary: #f000b8, --secondary: #f000b8;
--secondary-content: #ffffff; --secondary-content: #fff;
--accent: #37cdbe; --accent: #37cdbe;
--accent-content: #163835; --accent-content: #163835;
--neutral: #3d4451; --neutral: #3d4451;
--neutral-content: #ffffff; --neutral-content: #fff;
--base-100: #ffffff; --base-100: #fff;
--base-200: #F2F2F2; --base-200: #f2f2f2;
--base-300: #E5E6E6; --base-300: #e5e6e6;
--base-content: #1f2937; --base-content: #1f2937;
} }
[data-theme='2'] { [data-theme='2'] {
--primary: #661AE6; --primary: #661ae6;
--primary-content: #ffffff; --primary-content: #fff;
--secondary: #D926AA; --secondary: #d926aa;
--secondary-content: #ffffff; --secondary-content: #fff;
--accent: #1FB2A5; --accent: #1fb2a5;
--accent-content: #ffffff; --accent-content: #fff;
--neutral: #191D24; --neutral: #191d24;
--neutral-focus: #111318; --neutral-focus: #111318;
--neutral-content: #A6ADBB; --neutral-content: #a6adbb;
--base-100: #2A303C; --base-100: #2a303c;
--base-200: #242933; --base-200: #242933;
--base-300: #20252E; --base-300: #20252e;
--base-content: #A6ADBB; --base-content: #a6adbb;
} }
[data-theme='3'] { [data-theme='3'] {
--primary : #ef9995; --primary: #ef9995;
--primary-content: #282425; --primary-content: #282425;
--secondary : #a4cbb4; --secondary: #a4cbb4;
--secondary-content: #282425; --secondary-content: #282425;
--accent : #ebdc99; --accent: #ebdc99;
--accent-content: #282425; --accent-content: #282425;
--neutral : #7d7259; --neutral: #7d7259;
--neutral-content: #e4d8b4; --neutral-content: #e4d8b4;
--base-100: #e4d8b4; --base-100: #e4d8b4;
--base-200: #d2c59d; --base-200: #d2c59d;
--base-300: #c6b386; --base-300: #c6b386;
--base-content: #282425; --base-content: #282425;
--info: #2563eb; --info: #2563eb;
--success: #16a34a; --success: #16a34a;
--warning: #d97706; --warning: #d97706;
--error: #dc2626; --error: #dc2626;
} }
html { html {
background-color: var(--base-100); background-color: var(--base-100);
color: var(--base-content); color: var(--base-content);
} }

View File

@@ -1,4 +1,5 @@
import React from 'react' import React from 'react'
import HW2 from '../s2-homeworks/hw02/HW2'
import s from './App.module.css' import s from './App.module.css'
import HW1 from '../s2-homeworks/hw01/HW1' import HW1 from '../s2-homeworks/hw01/HW1'
// import HW2 from '../s2-homeworks/hw02/HW2' // import HW2 from '../s2-homeworks/hw02/HW2'
@@ -9,22 +10,22 @@ import { useSelector } from 'react-redux'
import { useEffect } from 'react' import { useEffect } from 'react'
const App = () => { const App = () => {
const themeId = useSelector((state: any) => state.theme.themeId) const themeId = useSelector((state: any) => state.theme.themeId)
useEffect(() => { useEffect(() => {
document.documentElement.dataset.theme = themeId document.documentElement.dataset.theme = themeId
}, [themeId]) }, [themeId])
return ( return (
<div className={s.App} data-theme={themeId}> <div className={s.App} data-theme={themeId}>
{/*<div>react homeworks:</div>*/} {/*<div>react homeworks:</div>*/}
<HW1/> {/*<HW1/>*/}
{/*<HW2/>*/} <HW2/>
{/*<HW3/>*/} {/*<HW3/>*/}
{/*<HW4/>*/} {/*<HW4/>*/}
{/*<HW5 />*/} {/*<HW5/>*/}
</div> </div>
) )
} }
export default App export default App

View File

@@ -55,9 +55,9 @@ const HW1 = () => {
</div> </div>
<hr/> {/*<hr/>*/}
{/*можно убрать этот тег*/} {/*можно убрать этот тег*/}
<hr/> {/*<hr/>*/}
{/*можно убрать этот тег*/} {/*можно убрать этот тег*/}
</div> </div>
) )

View File

@@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import {AffairType} from './HW2' import { AffairType } from './HW2'
import s from './Affairs.module.css' import s from './Affairs.module.css'
type AffairPropsType = { type AffairPropsType = {
@@ -14,24 +14,24 @@ function Affair(props: AffairPropsType) {
const priorityClass = s.item + ' ' + s[props.affair.priority] const priorityClass = s.item + ' ' + s[props.affair.priority]
return ( return (
<div id={'hw2-affair-' + props.affair._id} className={s.affair}> <div id={'hw2-affair-' + props.affair._id} className={s.affair + ' ' + s[props.affair.priority]}>
<div id={'hw2-name-' + props.affair._id} className={s.item}> <div id={'hw2-name-' + props.affair._id} className={priorityClass}>
{/*создаёт студент*/} {/*создаёт студент*/}
{props.affair.name} {props.affair.name}
{/**/} {/**/}
</div> </div>
[ {/*[*/}
<div id={'hw2-priority-' + props.affair._id} className={priorityClass}> {/*<div id={'hw2-priority-' + props.affair._id} className={priorityClass}>*/}
{/*создаёт студент*/} {/* /!*создаёт студент*!/*/}
{props.affair.priority} {/* {props.affair.priority}*/}
{/**/} {/* /!**!/*/}
</div> {/*</div>*/}
] {/*]*/}
<button <button
id={'hw2-button-delete-' + props.affair._id} id={'hw2-button-delete-' + props.affair._id}
onClick={deleteCallback} // создаёт студент onClick={deleteCallback} // создаёт студент
className={s.item + ' ' + s.button} className={priorityClass + ' ' + s.closeButton}
> >
{/*текст кнопки могут изменить студенты*/} {/*текст кнопки могут изменить студенты*/}
X X

View File

@@ -1,41 +1,86 @@
.button { .all {
margin: 10px; --color: #06c;
width: 60px;
background: #003300;
color: #99ff99;
outline: none;
} }
.button:focus {
outline: #99ff99 solid 1px; .low {
--color: #0c2;
}
.high {
--color: #c00;
}
.middle {
--color: #cc9c00;
}
.button {
background: transparent;
border: 1px solid var(--color);
border-radius: 15px;
color: var(--color);
outline: none;
padding: 5px 15px;
font-family: 'Montserrat', sans-serif;
font-weight: 600;
font-size: 14px;
line-height: 20px;
cursor: pointer;
} }
.button:active { .button:active {
background: #99ff99; background: var(--color);
color: white;
} }
.active { .active {
background: #335533; background: var(--color);
color: white;
} }
.affair { .affair {
display: flex; display: flex;
align-items: center; align-items: center;
border: 1.5px solid var(--color);
width: 185px;
border-radius: 5px;
}
.affairs {
display: flex;
gap: 17px;
flex-wrap: wrap;
max-width: 450px;
} }
.item { .item {
margin: 10px; width: 145px;
width: 100px; height: 37px;
display: flex;
justify-content: center;
align-items: center;
} }
.high { .container {
color: red; padding: 32px 0 73px 70px;
} }
.middle { .buttonContainer {
color: orange; display: flex;
gap: 24px;
margin-bottom: 32px;
} }
.low { .closeButton {
color: lime; border: none;
border-left: 1.5px solid var(--color);
display: flex;
align-items: center;
justify-content: center;
background-color: transparent;
width: 40px;
height: 37px;
font-weight: 900;
cursor: pointer;
} }

View File

@@ -1,6 +1,6 @@
import React, { SetStateAction, Dispatch } from 'react' import React, { SetStateAction, Dispatch } from 'react'
import Affair from './Affair' import Affair from './Affair'
import {AffairType, FilterType} from './HW2' import { AffairType, FilterType } from './HW2'
import s from './Affairs.module.css' import s from './Affairs.module.css'
type AffairsPropsType = { // need to fix any type AffairsPropsType = { // need to fix any
@@ -36,24 +36,25 @@ function Affairs(props: AffairsPropsType) {
// props.setFilter(e.currentTarget.value as FilterType) // props.setFilter(e.currentTarget.value as FilterType)
// } // }
const cnAll = s.button + ' ' + (props.filter === 'all' ? s.active : '') const cnAll = s.button + ' ' + s.all + ' ' + (props.filter === 'all' ? s.active : '')
const cnHigh = s.button + ' ' + (props.filter === 'high' ? s.active : '') const cnHigh = s.button + ' ' + s.high + ' ' + (props.filter === 'high' ? s.active : '')
const cnMiddle = s.button + ' ' + (props.filter === 'middle' ? s.active : '') const cnMiddle = s.button + ' ' + s.middle + ' ' + (props.filter === 'middle' ? s.active : '')
const cnLow = s.button + ' ' + (props.filter === 'low' ? s.active : '') const cnLow = s.button + ' ' + s.low + ' ' + (props.filter === 'low' ? s.active : '')
// const setClass = (filter: FilterType) => { // const setClass = (filter: FilterType) => {
// return s.button + (props.filter === filter ? ' ' + s.active : '') // return s.button + (props.filter === filter ? ' ' + s.active : '')
// } // }
return ( return (
<div> <div className={s.container}>
<div className={s.buttonContainer}>
{mappedAffairs} <button id={'hw2-button-all'} onClick={setAll} className={cnAll}>All</button>
<button id={'hw2-button-high'} onClick={setHigh} className={cnHigh}>High</button>
<button id={'hw2-button-all'} onClick={setAll} className={cnAll}>All</button> <button id={'hw2-button-middle'} onClick={setMiddle} className={cnMiddle}>Middle</button>
<button id={'hw2-button-high'} onClick={setHigh} className={cnHigh}>High</button> <button id={'hw2-button-low'} onClick={setLow} className={cnLow}>Low</button>
<button id={'hw2-button-middle'} onClick={setMiddle} className={cnMiddle}>Middle</button> </div>
<button id={'hw2-button-low'} onClick={setLow} className={cnLow}>Low</button> <div className={s.affairs}>
{mappedAffairs}
</div>
{/*<button onClick={set} className={setClass('all')} value={'all'}>All</button>*/} {/*<button onClick={set} className={setClass('all')} value={'all'}>All</button>*/}
{/*<button onClick={set} className={setClass('high')} value={'high'}>High</button>*/} {/*<button onClick={set} className={setClass('high')} value={'high'}>High</button>*/}
{/*<button onClick={set} className={setClass('middle')} value={'middle'}>Middle</button>*/} {/*<button onClick={set} className={setClass('middle')} value={'middle'}>Middle</button>*/}

View File

@@ -1,4 +1,4 @@
import React, {useState} from 'react' import React, { useState } from 'react'
import Affairs from './Affairs' import Affairs from './Affairs'
import s from './Affairs.module.css' import s from './Affairs.module.css'
import s2 from '../../s1-main/App.module.css' import s2 from '../../s1-main/App.module.css'
@@ -45,10 +45,11 @@ function HW2() {
return ( return (
<div id={'hw2'} className={s2.hw}> <div id={'hw2'} className={s2.hw}>
<hr/> {/*<hr/>*/}
{/*можно убрать этот тег*/} {/*можно убрать этот тег*/}
<div className={s2.hwTitle}>homeworks 2</div> <div className={s2.hwTitle}>Homework #2</div>
<hr/>
{/*не менять*/} {/*не менять*/}
<Affairs <Affairs
@@ -58,7 +59,7 @@ function HW2() {
filter={filter} filter={filter}
/> />
<hr/> {/*<hr/>*/}
{/*можно убрать этот тег*/} {/*можно убрать этот тег*/}
<hr/> <hr/>
{/*можно убрать этот тег*/} {/*можно убрать этот тег*/}