Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
bogutskii committed May 31, 2024
1 parent 3dd6885 commit 137dc58
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './styles.css';
import Field from './components/Field.js';
import Field from './components/Field/Field.js';
import { connect } from 'react-redux';
import { Header } from './components/Header';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/components/Field.js → src/components/Field/Field.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React, { useState } from 'react';
import { connect } from 'react-redux';
import './Field.css';
import Brush from './Brush';
import ColorHistory from './ColorHistory';
import Brush from '../Tools/Brush';
import ColorHistory from '../Tools/ColorHistory';
import FieldSize from './FieldSize';
import DrawHistory from './DrawHistory';
import DrawHistory from '../DrawHistory';
import domtoimage from 'dom-to-image';
import ColorChanger from './ColorChanger';
import CurrentColor from './CurrentColor';
import ColorChanger from '../Tools/ColorChanger';
import CurrentColor from '../Tools/CurrentColor';

const Field = (props) => {
const [continueToDraw, setContinueToDraw] = useState(false);
const [gridMap, setGridMap] = useState(true);
const [fieldSize, setFieldSize] = useState('800');

const { field, currentColor, changeColor, changePixelColor, clearField, pixelSize } = props;
const { field, changePixelColor, clearField, pixelSize } = props;

const onKeyPressed = (e) => {
if (e.code === 'Space' || e.type === 'mousedown') {
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Header.js
import React, { useState } from 'react';
import { useAuth } from './AuthContext';
import LoginModal from './LoginModal';
import RegisterModal from './RegisterModal';
import { useAuth } from './Auth/AuthContext';
import LoginModal from './Auth/LoginModal';
import RegisterModal from './Auth/RegisterModal';

export const Header = () => {
const { user, logout } = useAuth();
Expand Down
6 changes: 3 additions & 3 deletions src/components/Brush.js → src/components/Tools/Brush.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { connect } from 'react-redux';
import classnames from 'classnames';
import fill from './icons/fill.png';
import random from './icons/random.jpeg';
import colorpicker from './icons/colorpicker.png';
import fill from '../icons/fill.png';
import random from '../icons/random.jpeg';
import colorpicker from '../icons/colorpicker.png';

const Brush = ({ changeBrush, fieldRandomBrush, brush }) => {
const brushTypes = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import React from 'react';
import { connect } from 'react-redux';

const ColorChanger = (props) => {
const ColorChanger = () => {
return (
<div className="mg-10">
<br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import history_del from './icons/history_del.png';
import history_del from '../icons/history_del.png';

const HistoryColor = ({ historyColor, changeColor, deleteColorHistory }) => {
return (
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import App from './App';
import { Provider } from 'react-redux';
import store from './components/redux/store';
import { AuthProvider } from './components/AuthContext'
import { AuthProvider } from './components/Auth/AuthContext'

ReactDOM.render(
<React.StrictMode>
Expand Down
37 changes: 8 additions & 29 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
font-family: sans-serif;
text-align: center;
}
/* checkbox square slider start */
.switch {
position: relative;
display: inline-block;
Expand Down Expand Up @@ -47,8 +46,6 @@ input:checked + .slider:before {
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* checkbox square slider end */
/*list history */
.drawHistory {
margin-left: 10px;
width: 56%;
Expand Down Expand Up @@ -107,7 +104,7 @@ input:checked + .slider:before {
vertical-align: middle;
}
.btn-reg {
box-shadow: inset 0px 1px 0px 0px #dcecfb;
box-shadow: inset 0 1px 0 0 #dcecfb;
background: linear-gradient(to bottom, #ddf2fc 5%, rgba(179, 214, 255, 0.65) 100%);
background-color: #d5eaff;
border-radius: 6px;
Expand Down Expand Up @@ -167,7 +164,6 @@ input:checked + .slider:before {
top: 50%;
margin: auto;
}
/* HEADER */
@import url(https://fonts.googleapis.com/css?family=Baumans);
html {
background: #ecf0f1;
Expand All @@ -184,7 +180,6 @@ input {
text-transform: uppercase;
cursor: pointer;
}
/* ----------- */
header {
position: relative;
height: 50px;
Expand All @@ -198,7 +193,6 @@ h1 {
font-family: 'Arial', sans-serif;
text-align: center;
}
/* Switch button styling */
.switch {
position: relative;
display: inline-block;
Expand Down Expand Up @@ -239,7 +233,6 @@ h1 {
input:checked + .slider:before {
transform: translateX(26px);
}
/* Styling for list items */
.list-li {
background: #f1fdff;
border: 1px solid #abcdbd;
Expand All @@ -258,7 +251,6 @@ h1 {
background: #e6f8ff;
border: 1px solid #06acd5;
}
/* General button styling */
.btn {
color: #000;
background-color: rgba(239, 115, 115, .87);
Expand All @@ -274,7 +266,6 @@ h1 {
.btn:active {
background-color: rgba(195, 75, 75, .95);
}
/* Input styling */
.input-save {
width: 100%;
padding: 5px;
Expand All @@ -284,7 +275,6 @@ h1 {
color: black;
border-radius: 5px;
}
/* Header styling */
.header {
background-color: #2c3e50;
color: white;
Expand Down Expand Up @@ -325,7 +315,7 @@ header input:focus {
header input[type='submit'] {
font-weight: bold;
}
input[type="text"]:focus::placeholder,input[type="password"]:focus::placeholder,input[type="email"]:focus::placeholder {
input[type="text"]:focus::placeholder, input[type="password"]:focus::placeholder, input[type="email"]:focus::placeholder {
color: #b2f8f2;
opacity: 1;
}
Expand All @@ -334,12 +324,10 @@ input[type="text"]:focus::placeholder,input[type="password"]:focus::placeholder,
display: none;
}
}
/* ------END HEADER----- */
.draw-history-wrap {
display: flex;
width: 450px;
}
/* input type color */
input[type='color'] {
-webkit-appearance: none;
border: none;
Expand All @@ -352,11 +340,9 @@ input[type='color']::-webkit-color-swatch-wrapper {
input[type='color']::-webkit-color-swatch {
border: none;
}
/*range field size*/
.range-field-size {
width: 300px;
}
/*preloader*/
:root {
--fg: #17181c;
--c1: #f42f25;
Expand All @@ -368,11 +354,11 @@ input[type='color']::-webkit-color-swatch {
.pl3 {
justify-content: space-between;
}
.pl3__a,.pl3__b,.pl3__c,.pl3__d {
.pl3__a, .pl3__b, .pl3__c, .pl3__d {
width: 0.75em;
height: 0.75em;
}
.pl3__a,.pl3__b,.pl3__c,.pl3__d {
.pl3__a, .pl3__b, .pl3__c, .pl3__d {
animation: bounce3 2s ease-in-out infinite;
transform-origin: 50% 0;
}
Expand All @@ -397,35 +383,32 @@ input[type='color']::-webkit-color-swatch {
background: var(--c4);
animation-delay: 0.3s;
}
/* Animations */
@keyframes bounce3 {
from,5%,95%,to {
from, 5%, 95%, to {
transform: translateY(0) scaleY(1);
}
16.7% {
transform: translateY(0) scaleY(8);
}
28.3%,38.3% {
28.3%, 38.3% {
transform: translateY(5.25em) scaleY(1);
}
50% {
transform: translateY(2.625em) scaleY(4.5);
}
61.7%,71.7% {
61.7%, 71.7% {
transform: translateY(2.625em) scaleY(1);
}
83.3% {
transform: translateY(0) scaleY(4.5);
}
}
/*color picker*/
/* Custom poiners */
.custom-pointers .react-colorful__saturation-pointer {
width: 16px;
height: 16px;
border-radius: 3px;
}
.custom-pointers .react-colorful__hue-pointer,.custom-pointers .react-colorful__alpha-pointer {
.custom-pointers .react-colorful__hue-pointer, .custom-pointers .react-colorful__alpha-pointer {
width: 16px;
border-radius: 3px;
}
Expand Down Expand Up @@ -490,7 +473,6 @@ input[type='color']::-webkit-color-swatch {
max-width: 500px;
width: 100%;
}

.header {
background-color: #2c3e50;
color: white;
Expand Down Expand Up @@ -637,7 +619,6 @@ input[type="text"], input[type="password"], input[type="email"] {
max-width: 500px;
width: 100%;
}

html, body {
background: #ecf0f1;
font-family: 'Arial', sans-serif;
Expand Down Expand Up @@ -707,7 +688,6 @@ input[type="text"], input[type="password"], input[type="email"] {
max-width: 500px;
width: 100%;
}

html, body {
background: #ecf0f1;
font-family: 'Arial', sans-serif;
Expand Down Expand Up @@ -778,7 +758,6 @@ input[type="text"], input[type="password"], input[type="email"] {
max-width: 400px;
width: 100%;
}

.register-form {
flex-direction: column;
align-items: center;
Expand Down

0 comments on commit 137dc58

Please sign in to comment.