Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
MelanieSarrouy committed Nov 30, 2021
1 parent 260b568 commit f41a14a
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 53 deletions.
10 changes: 5 additions & 5 deletions src/App.jsx → src/React/App.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BrowserRouter, Routes, Route } from 'react-router-dom'
import Header from './components/Header'
import { GlobalStyle } from './styles/bases/globalStyle'
import { GlobalStyle } from '../styles/bases/globalStyle'
import Homepage from './pages/Homepage'
import EmployeesList from './pages/EmployeesList'
import { Main } from './styles/pages/homepage'
import { Main } from '../styles/pages/homepage'
import { useStore } from 'react-redux'
import { useEffect } from 'react'
import { getEmployees } from './firebase/firebaseServices'
import { NotFound } from 'http-errors'
import { getEmployees } from '../firebase/firebaseServices'
import NotFoundPage from './pages/NotFoundPage'

export const App = () => {
const store = useStore()
Expand All @@ -26,7 +26,7 @@ export const App = () => {
<Routes>
<Route path="/" element={<Homepage />} />
<Route path="/employees-list" element={<EmployeesList />} />
<Route element={<NotFound />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
</Main>
</BrowserRouter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Link } from 'react-router-dom'
import { NavStyled, StyledLink, Title1 } from '../styles/components/header'
import { NavStyled, StyledLink, Title1 } from '../../styles/components/header'

const Header = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Input.jsx → src/React/components/Input.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { capitalizeFirstLetter } from '../helpers/capitalizeFirstLetter'
import { capitalizeFirstLetter } from '../../helpers/capitalizeFirstLetter'
import {
InputLabel,
InputStyle,
InputWrapper,
} from '../styles/components/input'
} from '../../styles/components/input'

/**
* Input component to display input buttons
Expand Down
4 changes: 2 additions & 2 deletions src/components/Modale.jsx → src/React/components/Modale.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import close from '../assets/close.svg'
import { IMG, ModaleContent, ModaleDiv } from '../styles/components/modale'
import close from '../../assets/close.svg'
import { IMG, ModaleContent, ModaleDiv } from '../../styles/components/modale'

const Modale = ({ hideModale }) => {
return (
Expand Down
6 changes: 3 additions & 3 deletions src/components/Select.jsx → src/React/components/Select.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { capitalizeFirstLetter } from '../helpers/capitalizeFirstLetter'
import { InputLabel, InputWrapper } from '../styles/components/input'
import { SelectStyle } from '../styles/components/select'
import { capitalizeFirstLetter } from '../../helpers/capitalizeFirstLetter'
import { InputLabel, InputWrapper } from '../../styles/components/input'
import { SelectStyle } from '../../styles/components/select'

const Select = ({
direction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import {
EntriesText,
EntriesStyle,
} from '../../styles/components/tableWithSortingAndFilters/entries'
} from '../../../styles/components/tableWithSortingAndFilters/entries'
import Select from '../Select'

const Entries = ({ value, onChange, entriesNumber }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Span } from '../../styles/components/tableWithSortingAndFilters/entriesDisplayed'
import { Span } from '../../../styles/components/tableWithSortingAndFilters/entriesDisplayed'

const EntriesDisplayed = ({
page,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react'
import colors from '../../styles/bases/colors'
import colors from '../../../styles/bases/colors'
import {
DivPagination,
ButtonNumber,
ButtonText,
TextNoButton,
} from '../../styles/components/tableWithSortingAndFilters/pagination'
} from '../../../styles/components/tableWithSortingAndFilters/pagination'

const Pagination = ({ setPage, page, pageCount, pageCountRange }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { SearchDiv } from '../../styles/components/tableWithSortingAndFilters/search'
import { SearchDiv } from '../../../styles/components/tableWithSortingAndFilters/search'
import Input from '../Input'

const Search = ({ value, onChange }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import { useDispatch } from 'react-redux'
import { dynamicSortDown } from '../../helpers/dynamicSortDown'
import { dynamicSortUp } from '../../helpers/dynamicSortUp'
import { employeesListSuccess } from '../../Redux/actions/actionGetEmployees'
import { dynamicSortDown } from '../../../helpers/dynamicSortDown'
import { dynamicSortUp } from '../../../helpers/dynamicSortUp'
import { employeesListSuccess } from '../../../Redux/actions/actionGetEmployees'
import {
IconButton,
IconsDiv,
} from '../../styles/components/tableWithSortingAndFilters/sorts'
} from '../../../styles/components/tableWithSortingAndFilters/sorts'

const Sorts = ({ id, list }) => {
const dispatch = useDispatch()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TBody,
TrBody,
TrHead,
} from '../../styles/components/tableWithSortingAndFilters/table'
} from '../../../styles/components/tableWithSortingAndFilters/table'
import TableBodyRow from './TableBodyRow'
import TableHeadRow from './TableHeadRow'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { ThDiv } from '../../styles/components/tableWithSortingAndFilters/tableHeadRow'
import { ThDiv } from '../../../styles/components/tableWithSortingAndFilters/tableHeadRow'
import Sorts from './Sorts'

const TableHeadRow = ({ element, list, employeesToDisplay }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { standardizeAndLowerCase } from '../../helpers/standardizeAndLowerCase';
import { FiltersWrapper, NoData } from '../../styles/components/tableWithSortingAndFilters/tableWithSortingAndFilters';
import { standardizeAndLowerCase } from '../../../helpers/standardizeAndLowerCase';
import { FiltersWrapper, NoData } from '../../../styles/components/tableWithSortingAndFilters/tableWithSortingAndFilters';
import Entries from './Entries';
import EntriesDisplayed from './EntriesDisplayed';
import Pagination from './Pagination';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { useSelector } from 'react-redux'
import TableWithSortingandFilters from '../components/tableWithSortingAndFilters/TableWithSortingandFilters'
import entriesQuantity from '../datas/entriesQuantity'
import keys from '../datas/keys'
import entriesQuantity from '../../datas/entriesQuantity'
import keys from '../../datas/keys'

const EmployeesList = () => {

Expand Down
10 changes: 5 additions & 5 deletions src/pages/Homepage.jsx → src/React/pages/Homepage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import Input from '../components/Input'
import Modale from '../components/Modale'
import departments from '../datas/departments'
import states from '../datas/states'
import departments from '../../datas/departments'
import states from '../../datas/states'
import {
Form,
DivButton,
Expand All @@ -12,11 +12,11 @@ import {
FieldsetStyle,
InputButton,
Legend,
} from '../styles/pages/homepage'
import { addAndGetEmployees } from '../firebase/firebaseServices'
} from '../../styles/pages/homepage'
import { addAndGetEmployees } from '../../firebase/firebaseServices'
import { useStore } from 'react-redux'
import Select from '../components/Select'
import { sortDepartments } from '../helpers/form/sortDepartments'
import { sortDepartments } from '../../helpers/form/sortDepartments'

const Homepage = () => {
const [firstName, setFirstName] = useState('')
Expand Down
13 changes: 13 additions & 0 deletions src/React/pages/NotFoundPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'
import { H3Page404, NotFoundPageSection, Sentence } from '../../styles/pages/notFoundPage'

const NotFoundPage = () => {
return (
<NotFoundPageSection>
<H3Page404>404</H3Page404>
<Sentence>Sorry, page not found</Sentence>
</NotFoundPageSection>
)
}

export default NotFoundPage
10 changes: 3 additions & 7 deletions src/helpers/form/sortDepartments.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export const sortDepartments = (x, y) => {
if (x.label < y.label) {
return -1
}
if (x.label > y.label) {
return 1
}
return 0
let a = x.label
let b = y.label
return a < b ? -1 : a === b ? 0 : 1
}
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { App } from './App.jsx'
import { App } from './React/App.jsx'
import reportWebVitals from './reportWebVitals'
import { Provider } from 'react-redux'
import { store } from './Redux/store/store'
Expand Down
12 changes: 0 additions & 12 deletions src/pages/NotFound.jsx

This file was deleted.

24 changes: 24 additions & 0 deletions src/styles/pages/notFoundPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import styled from "styled-components";

export const NotFoundPageSection = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center:
`
export const H3Page404 = styled.h3`
font-size: 18rem;
font-weight: bold;
padding: 2rem;
@media (max-width: 720px) {
font-size: 8rem;
}
`
export const Sentence = styled.p`
font-size: 1.2rem;
font-weight: bold;
padding: 2rem;
@media (max-width: 720px) {
font-size: 1rem;
}
`

0 comments on commit f41a14a

Please sign in to comment.