From fedcfbedabf41dbd41ecdc6dcda65da6d969c942 Mon Sep 17 00:00:00 2001 From: rayzhou-bit Date: Sat, 23 Mar 2024 15:31:22 -0700 Subject: [PATCH] refactor: separate library files --- src/App.jsx | 2 +- src/App.scss | 18 +---- src/{ => assets}/fonts/Roboto-Black.ttf | Bin src/{ => assets}/fonts/Roboto-BlackItalic.ttf | Bin src/{ => assets}/fonts/Roboto-Bold.ttf | Bin src/{ => assets}/fonts/Roboto-BoldItalic.ttf | Bin src/{ => assets}/fonts/Roboto-Italic.ttf | Bin src/{ => assets}/fonts/Roboto-Light.ttf | Bin src/{ => assets}/fonts/Roboto-LightItalic.ttf | Bin src/{ => assets}/fonts/Roboto-Medium.ttf | Bin .../fonts/Roboto-MediumItalic.ttf | Bin src/{ => assets}/fonts/Roboto-Regular.ttf | Bin src/{ => assets}/fonts/Roboto-Thin.ttf | Bin src/{ => assets}/fonts/Roboto-ThinItalic.ttf | Bin src/assets/icons/book.svg | 19 +++++ src/assets/icons/library.png | Bin 703 -> 0 bytes src/assets/icons/library.svg | 20 +---- .../Dropdowns/ColorDropdown.scss | 2 +- src/components/Canvas/hooks.js | 2 +- src/components/Canvas/index.jsx | 6 +- src/components/Card/Card.jsx | 2 +- src/components/Library/Library.jsx | 38 ---------- src/components/Library/Library.scss | 63 ---------------- src/components/Library/hooks.js | 69 ++++++++++++++++++ src/components/Library/index.jsx | 55 ++++++++++++++ src/components/Library/index.scss | 54 ++++++++++++++ src/data/campaign/reducers.js | 2 +- src/shared/utilityFunctions.js | 69 ------------------ src/store/firestoreAPI/authTransactions.js | 16 +++- src/store/firestoreAPI/storeTransactions.js | 4 +- src/store/reducer/campaignData.js | 4 +- src/store/reducer/sessionManager.js | 2 +- src/store/reducer/userData.js | 2 +- src/{shared => styles}/constants.js | 0 src/utils/updateObject.js | 6 ++ 35 files changed, 236 insertions(+), 219 deletions(-) rename src/{ => assets}/fonts/Roboto-Black.ttf (100%) rename src/{ => assets}/fonts/Roboto-BlackItalic.ttf (100%) rename src/{ => assets}/fonts/Roboto-Bold.ttf (100%) rename src/{ => assets}/fonts/Roboto-BoldItalic.ttf (100%) rename src/{ => assets}/fonts/Roboto-Italic.ttf (100%) rename src/{ => assets}/fonts/Roboto-Light.ttf (100%) rename src/{ => assets}/fonts/Roboto-LightItalic.ttf (100%) rename src/{ => assets}/fonts/Roboto-Medium.ttf (100%) rename src/{ => assets}/fonts/Roboto-MediumItalic.ttf (100%) rename src/{ => assets}/fonts/Roboto-Regular.ttf (100%) rename src/{ => assets}/fonts/Roboto-Thin.ttf (100%) rename src/{ => assets}/fonts/Roboto-ThinItalic.ttf (100%) create mode 100644 src/assets/icons/book.svg delete mode 100644 src/assets/icons/library.png delete mode 100644 src/components/Library/Library.jsx delete mode 100644 src/components/Library/Library.scss create mode 100644 src/components/Library/hooks.js create mode 100644 src/components/Library/index.jsx create mode 100644 src/components/Library/index.scss delete mode 100644 src/shared/utilityFunctions.js rename src/{shared => styles}/constants.js (100%) create mode 100644 src/utils/updateObject.js diff --git a/src/App.jsx b/src/App.jsx index 369aa36..4746b45 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,7 +4,7 @@ import { useSelector } from 'react-redux'; import './App.scss'; import HeaderMenu from './components/HeaderMenu'; import ToolMenu from './components/ToolMenu'; -import Library from './components/Library/Library'; +import Library from './components/Library'; import TabBar from './components/TabBar'; import Canvas from './components/Canvas'; import Popup from './components/Popup'; diff --git a/src/App.scss b/src/App.scss index 27f0326..d5d8961 100644 --- a/src/App.scss +++ b/src/App.scss @@ -27,20 +27,6 @@ button:focus { outline: none; } -.btn-24 { - // button for an img of 24px x 24px - height: 24px; - width: 24px; - padding: 3px; -} - -.btn-32 { - // button for an img of 32px x 32px - height: 32px; - width: 32px; - padding: 4px; -} - button { box-sizing: content-box; position: relative; @@ -62,7 +48,7 @@ button { // top: 130%; right: 50%; <-- tooltip is to the bottom // bottom: 150%; left: 25%; <-- tooltip is to the top padding: 3px 8px; - border-radius: 12px; + border-radius: 6px; background-color: #363B4E; visibility: hidden; z-index: 10000; @@ -102,5 +88,5 @@ button { @font-face { font-family: "Roboto"; src: local("Roboto-Regular"), - url("./fonts/Roboto-Regular.ttf") format("truetype"); + url("./assets/fonts/Roboto-Regular.ttf") format("truetype"); } diff --git a/src/fonts/Roboto-Black.ttf b/src/assets/fonts/Roboto-Black.ttf similarity index 100% rename from src/fonts/Roboto-Black.ttf rename to src/assets/fonts/Roboto-Black.ttf diff --git a/src/fonts/Roboto-BlackItalic.ttf b/src/assets/fonts/Roboto-BlackItalic.ttf similarity index 100% rename from src/fonts/Roboto-BlackItalic.ttf rename to src/assets/fonts/Roboto-BlackItalic.ttf diff --git a/src/fonts/Roboto-Bold.ttf b/src/assets/fonts/Roboto-Bold.ttf similarity index 100% rename from src/fonts/Roboto-Bold.ttf rename to src/assets/fonts/Roboto-Bold.ttf diff --git a/src/fonts/Roboto-BoldItalic.ttf b/src/assets/fonts/Roboto-BoldItalic.ttf similarity index 100% rename from src/fonts/Roboto-BoldItalic.ttf rename to src/assets/fonts/Roboto-BoldItalic.ttf diff --git a/src/fonts/Roboto-Italic.ttf b/src/assets/fonts/Roboto-Italic.ttf similarity index 100% rename from src/fonts/Roboto-Italic.ttf rename to src/assets/fonts/Roboto-Italic.ttf diff --git a/src/fonts/Roboto-Light.ttf b/src/assets/fonts/Roboto-Light.ttf similarity index 100% rename from src/fonts/Roboto-Light.ttf rename to src/assets/fonts/Roboto-Light.ttf diff --git a/src/fonts/Roboto-LightItalic.ttf b/src/assets/fonts/Roboto-LightItalic.ttf similarity index 100% rename from src/fonts/Roboto-LightItalic.ttf rename to src/assets/fonts/Roboto-LightItalic.ttf diff --git a/src/fonts/Roboto-Medium.ttf b/src/assets/fonts/Roboto-Medium.ttf similarity index 100% rename from src/fonts/Roboto-Medium.ttf rename to src/assets/fonts/Roboto-Medium.ttf diff --git a/src/fonts/Roboto-MediumItalic.ttf b/src/assets/fonts/Roboto-MediumItalic.ttf similarity index 100% rename from src/fonts/Roboto-MediumItalic.ttf rename to src/assets/fonts/Roboto-MediumItalic.ttf diff --git a/src/fonts/Roboto-Regular.ttf b/src/assets/fonts/Roboto-Regular.ttf similarity index 100% rename from src/fonts/Roboto-Regular.ttf rename to src/assets/fonts/Roboto-Regular.ttf diff --git a/src/fonts/Roboto-Thin.ttf b/src/assets/fonts/Roboto-Thin.ttf similarity index 100% rename from src/fonts/Roboto-Thin.ttf rename to src/assets/fonts/Roboto-Thin.ttf diff --git a/src/fonts/Roboto-ThinItalic.ttf b/src/assets/fonts/Roboto-ThinItalic.ttf similarity index 100% rename from src/fonts/Roboto-ThinItalic.ttf rename to src/assets/fonts/Roboto-ThinItalic.ttf diff --git a/src/assets/icons/book.svg b/src/assets/icons/book.svg new file mode 100644 index 0000000..5f1a08f --- /dev/null +++ b/src/assets/icons/book.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icons/library.png b/src/assets/icons/library.png deleted file mode 100644 index 2c28f699a3bd25a2fd105d51cfe63032b3c4808c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 703 zcmV;w0zmzVP)Zhsj7kopVk1}>EX7L2 z*jU9*lFlX&5F0HN>_ovLDn3BLLWl;murLTwQHX*se1o8vfF#D8#qM#(<-1GbU6Lk$ zSoY)Fo!S5H%0<(K$99kk#921Pderl}xF z$YvU8irZ{fFi&8fz&wFDCs19Y{N=eOaH~`TECcixc4iP1jgv;}X_kDB;zRU}w4ffWA6#fxDbexfUXpi}}E zgriTiaUQzxU5@jY!v|V%L(K1!;5wGdd3}|GKm*=SaqipLHu3&%MYb@XA4P}ICGu=tfYo|5$igxl!^P7AkJv*J0T zGLp&H(Jve4O+ppaC=@Zz1z#CQXA#{cp++{&(>ZMvSFu(o{nCOdW(-wAxwjWPO^lFP lAu$;`1#@)FC5a9^`v*6Ofb0tvz?1+0002ovPDHLkV1m+>FjoKo diff --git a/src/assets/icons/library.svg b/src/assets/icons/library.svg index 5f1a08f..8c8a331 100644 --- a/src/assets/icons/library.svg +++ b/src/assets/icons/library.svg @@ -1,19 +1,3 @@ - - - - - - - - - - - - - - - - - - + + diff --git a/src/components-shared/Dropdowns/ColorDropdown.scss b/src/components-shared/Dropdowns/ColorDropdown.scss index 61e71be..f0e63df 100644 --- a/src/components-shared/Dropdowns/ColorDropdown.scss +++ b/src/components-shared/Dropdowns/ColorDropdown.scss @@ -1,4 +1,4 @@ -@use "../../components/Card/index.scss" as card; +@use "../../components/Card/Card.scss" as card; .color-dropdown { position: absolute; diff --git a/src/components/Canvas/hooks.js b/src/components/Canvas/hooks.js index bc3a8f1..466a06f 100644 --- a/src/components/Canvas/hooks.js +++ b/src/components/Canvas/hooks.js @@ -6,7 +6,7 @@ import * as actions from '../../store/actionIndex'; import * as fireactions from '../../store/firestoreIndex'; import { manageUser } from "../../store/firestoreAPI/authTransactions"; -import { GRID } from '../../shared/constants'; +import { GRID } from '../../styles/constants'; import { ANIMATION } from '../Card/hooks'; // TODO separate out the network code into functions data/request or something diff --git a/src/components/Canvas/index.jsx b/src/components/Canvas/index.jsx index 629ae82..e5b1d96 100644 --- a/src/components/Canvas/index.jsx +++ b/src/components/Canvas/index.jsx @@ -4,16 +4,16 @@ import { Rnd } from 'react-rnd'; import { CANVAS_STATES, CANVAS_DIMENSIONS, useCanvasHooks } from './hooks'; import Card from '../Card/Card'; -import { GRID } from '../../shared/constants'; +import { GRID } from '../../styles/constants'; import './index.scss'; -import LibraryIcon from '../../assets/icons/library.svg'; +import BookIcon from '../../assets/icons/book.svg'; import PlusIcon from '../../assets/icons/plus.svg' // Canvas is the main portion the user is looking at. This is located in the center of the screen. const Empty = (createNewProject) => (
- +
No projects open
diff --git a/src/components/Card/Card.jsx b/src/components/Card/Card.jsx index c546b40..739570b 100644 --- a/src/components/Card/Card.jsx +++ b/src/components/Card/Card.jsx @@ -7,7 +7,7 @@ import Title from './Title'; import Content from './Content'; import './Card.scss'; -import { GRID } from '../../shared/constants'; +import { GRID } from '../../styles/constants'; export const Card = ({ cardId, diff --git a/src/components/Library/Library.jsx b/src/components/Library/Library.jsx deleted file mode 100644 index 343f841..0000000 --- a/src/components/Library/Library.jsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useState } from 'react'; - -import './Library.scss'; -import LibrarySearch from './LibrarySearch'; - -import LibBtnImg from '../../assets/icons/library.png'; -import ExpandImg from '../../assets/icons/left-arrow-32.png'; -import ShrinkImg from '../../assets/icons/right-arrow-32.png'; - -const Library = props => { - // STATES - const [showLibrary, setShowLibrary] = useState(false); - const [expandedView, setExpandedView] = useState(false); - - const libraryCallbackRef = (node) => { - if (!node) return; - node.style.right = showLibrary ? 0 : expandedView ? "-80vw" : "-40vw" - }; - - return ( -
-
- -
- - -
- ); -}; - -export default Library; \ No newline at end of file diff --git a/src/components/Library/Library.scss b/src/components/Library/Library.scss deleted file mode 100644 index 4fd19fc..0000000 --- a/src/components/Library/Library.scss +++ /dev/null @@ -1,63 +0,0 @@ -$menu-size: 42px; -$btn-divider-height: 8px; - -.library { - position: fixed; - top: $menu-size; - bottom: $menu-size; - z-index: 80; - - -webkit-transition: 0.4s; - transition: 0.4s; - - .library-search-container { - height: 100%; - border-left: 1px solid black; - background-color: white; - - -webkit-transition: 0.4s; - transition: 0.4s; - } - - .show-library { - top: $btn-divider-height; - height: 64px; - .tooltip { - top: 20%; - right: 130%; - } - .tooltip::after { - top: 50%; - left: 100%; - border-left-color: black; - } - } - - .expand-shrink { - top: 3 * $btn-divider-height + 64px; - .tooltip { - top: 18%; - right: 130%; - } - .tooltip::after { - top: 50%; - left: 100%; - border-left-color: black; - } - } -} - -.library-menu-btn { - position: absolute; - left: -41px; - height: 32px; - width: 32px; - padding: 4px; - - background-color: lightgray; - - border: 1px solid black; - border-right: 0px; - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; -} diff --git a/src/components/Library/hooks.js b/src/components/Library/hooks.js new file mode 100644 index 0000000..794a82c --- /dev/null +++ b/src/components/Library/hooks.js @@ -0,0 +1,69 @@ +import { useState } from 'react'; +import { useSelector } from 'react-redux'; + +export const FILTER_OPTIONS = { + all: 'all', + thisTab: 'thisTab', + unsorted: 'unsorted', +}; + +export const SORT_OPTIONS = { + abc: 'abc', + zxy: 'zxy', + color: 'color', + newest: 'newest', + oldest: 'oldest', +}; + +export const VIEW_OPTIONS = { + condensed: 'condensed', + expanded: 'expanded', +}; + +export const useLibraryHooks = () => { + const activeTab = useSelector(state => state.campaignData.present.activeViewId); + const tabOrder = useSelector(state => state.campaignData.present.viewOrder); + const cardCollection = useSelector(state => state.campaignData.present.cards); + + const [isOpen, setIsOpen] = useState(false); + const [searchString, setSearchString] = useState(''); + const [filterOption, setFilterOption] = useState(FILTER_OPTIONS.all); + const [sortOption, setSortOption] = useState(SORT_OPTIONS.abc); + const [viewOption, setViewOption] = useState(VIEW_OPTIONS.condensed); + + let libraryCards = []; + const search = searchString.toLowerCase(); + for (let id in cardCollection) { + const title = cardCollection[id].title ?? ''; + const text = cardCollection[id].content?.text ?? ''; + if (title.toLowerCase().includes(search) || text.toLowerCase().includes(search)) { + switch (filterOption) { + case FILTER_OPTIONS.all: + libraryCards = [ ...libraryCards, id ]; + break; + case FILTER_OPTIONS.thisTab: + if (cardCollection[id].views?.[activeTab]) { + libraryCards = [ ...libraryCards, id ]; + } + break; + case FILTER_OPTIONS.unsorted: + const tabsOfCard = Object.keys(cardCollection[id].views); + const intersection = tabOrder.filter(tab => tabsOfCard.includes(tab)) + if (intersection.length === 0) { + libraryCards = [ ...libraryCards, id ]; + } + break; + } + } + } + + return { + isOpen, + toggleLibrary: () => setIsOpen(!isOpen), + setSearchString, + setFilterOption, + setSortOption, + setViewOption, + libraryCards, + }; +}; diff --git a/src/components/Library/index.jsx b/src/components/Library/index.jsx new file mode 100644 index 0000000..8ef413c --- /dev/null +++ b/src/components/Library/index.jsx @@ -0,0 +1,55 @@ +import React from 'react'; + +import LibraryCard from '../Card/LibraryCard'; +import LibrarySearch from './LibrarySearch'; + +import { useLibraryHooks } from './hooks'; + +import './index.scss'; +import LibraryIcon from '../../assets/icons/library.svg'; + +const Library = () => { + const { + isOpen, + toggleLibrary, + setSearchString, + setFilterOption, + setSortOption, + setViewOption, + libraryCards, + } = useLibraryHooks(); + + let cardComponents = []; + for (let id in libraryCards) { + cardComponents = [ + ...cardComponents, + , + ]; + } + + return ( +
+
+ + {/* + TODO remove LibrarySearch and expand out its functionality to the following. + Make changes to the hooks file to change filtering and sorting + Change names of components if need be + */} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
+ {cardComponents} +
*/} +
+ +
+ ); +}; + +export default Library; diff --git a/src/components/Library/index.scss b/src/components/Library/index.scss new file mode 100644 index 0000000..55d96e3 --- /dev/null +++ b/src/components/Library/index.scss @@ -0,0 +1,54 @@ +$library-width: 35vw; + +.open { right: 0 } +.close { right: -$library-width } +.library { + position: fixed; + top: 48px; + bottom: 43px; + z-index: 80; + + -webkit-transition: 0.4s; + transition: 0.4s; +} + +.library-panel { + height: 100%; + width: $library-width; + background-color: #FFFFFF; + border: 1px solid #F4F4F4; + padding: 25px; + + display: flex; + flex-flow: column nowrap; + gap: 13px; +} + +.libary-card-container { + display: flex; + flex-flow: column nowrap; + gap: 20px; +} + +.library-btn { + position: absolute; + top: 3%; + right: 102%; + height: 50px; + width: 50px; + padding: 4px; + background-color: #FFFFFF; + border: 1px solid #F4F4F4; + border-radius: 12px; + box-shadow: 2px 2px 8px -3px #D7D6D6; + + .tooltip { + top: 30%; + right: 115%; + } + .tooltip::after { + top: 50%; + left: 100%; + border-left-color: #363B4E; + } +} diff --git a/src/data/campaign/reducers.js b/src/data/campaign/reducers.js index 4e8131a..1e718c9 100644 --- a/src/data/campaign/reducers.js +++ b/src/data/campaign/reducers.js @@ -1,5 +1,5 @@ import { createSlice } from '@reduxjs/toolkit'; -import { GRID } from '../../shared/constants'; +import { GRID } from '../../styles/constants'; // The campaignData reducer mirrors the campaign data structure on firebase diff --git a/src/shared/utilityFunctions.js b/src/shared/utilityFunctions.js deleted file mode 100644 index 1dbe511..0000000 --- a/src/shared/utilityFunctions.js +++ /dev/null @@ -1,69 +0,0 @@ -import {useEffect} from 'react'; - -//TODO REMOVE THIS FILE - -export const updateObject = (oldObject, updatedProperties) => { - return { - ...oldObject, - ...updatedProperties, - }; -}; - -// export const useOutsideClick = (refs, condition, handler) => { -// // Props: -// // refs: of useRefs that the user can click without triggering the handler -// // condition: that determines if the handler should be run -// // handler: that runs onclick if condition and refs are met -// useEffect(() => { -// const handleClickOutside = (event) => { -// let runHandler = true; -// refs.forEach(ref => { -// if (ref.current && ref.current.contains(event.target)) { -// runHandler = false; -// } -// }); -// // for (let i = 0; i < refs.length && runHandler; i++) { -// // const ref = refs[i]; -// // if (ref.current && ref.current.contains(event.target)) { -// // console.log('test', ref) -// // runHandler = false; -// // } -// // } - -// if (runHandler && refs.length > 0) { -// handler(); -// } -// }; - -// if (condition) { -// document.addEventListener("mousedown", handleClickOutside); -// } -// return () => { -// document.removeEventListener("mousedown", handleClickOutside); -// }; - -// // adding refs and handler as dependencies below causes an issue with re-renders -// // these re-renders keep other useOutsideClicks from completing their run -// // TODO figure out a way around this for exhaustive-deps -// }, [condition]); -// }; - -export const getParameterByName = (name) => { - // Sample action handle URL: - // https://example.com/usermgmt?mode=resetPassword&oobCode=ABC123&apiKey=AIzaSy...&lang=fr - - let value = window.location.href; - if (value) { - value = value.split(name+"=")[1]; - } - if (value) { - value = value.split('&')[0]; - } - - return value; -}; - -export const statBlockParser = (text) => { - let statBlock; - return statBlock; -}; \ No newline at end of file diff --git a/src/store/firestoreAPI/authTransactions.js b/src/store/firestoreAPI/authTransactions.js index 18364f7..cc397f8 100644 --- a/src/store/firestoreAPI/authTransactions.js +++ b/src/store/firestoreAPI/authTransactions.js @@ -19,7 +19,21 @@ import { import { auth } from './firebase'; import * as actions from '../actionIndex'; import * as fireactions from '../firestoreIndex'; -import { getParameterByName } from '../../shared/utilityFunctions'; + +export const getParameterByName = (name) => { + // Sample action handle URL: + // https://example.com/usermgmt?mode=resetPassword&oobCode=ABC123&apiKey=AIzaSy...&lang=fr + + let value = window.location.href; + if (value) { + value = value.split(name+"=")[1]; + } + if (value) { + value = value.split('&')[0]; + } + + return value; +}; // const auth = getAuth(); const googleProvider = new GoogleAuthProvider(); diff --git a/src/store/firestoreAPI/storeTransactions.js b/src/store/firestoreAPI/storeTransactions.js index a7e34be..7451281 100644 --- a/src/store/firestoreAPI/storeTransactions.js +++ b/src/store/firestoreAPI/storeTransactions.js @@ -14,8 +14,8 @@ import { import { auth, db } from './firebase'; import * as actions from '../actionIndex'; -import { updateObject } from '../../shared/utilityFunctions'; -import { GRID } from '../../shared/constants'; +import { updateObject } from '../../utils/updateObject'; +import { GRID } from '../../styles/constants'; // User contains uid, email, emailVerified (check firebase for more) const getUser = () => auth.currentUser ? auth.currentUser : null; diff --git a/src/store/reducer/campaignData.js b/src/store/reducer/campaignData.js index c33424e..1870df4 100644 --- a/src/store/reducer/campaignData.js +++ b/src/store/reducer/campaignData.js @@ -1,6 +1,6 @@ import * as actionTypes from '../actionTypes'; -import { GRID } from '../../shared/constants'; -import { updateObject } from '../../shared/utilityFunctions'; +import { GRID } from '../../styles/constants'; +import { updateObject } from '../../utils/updateObject'; // The campaignData reducer mirrors the campaign data structure on firebase diff --git a/src/store/reducer/sessionManager.js b/src/store/reducer/sessionManager.js index 5231b02..3a18d36 100644 --- a/src/store/reducer/sessionManager.js +++ b/src/store/reducer/sessionManager.js @@ -1,5 +1,5 @@ import * as actionTypes from '../actionTypes'; -import { updateObject } from '../../shared/utilityFunctions'; +import { updateObject } from '../../utils/updateObject'; const initialState = { campaignList: { diff --git a/src/store/reducer/userData.js b/src/store/reducer/userData.js index 2122376..0765f27 100644 --- a/src/store/reducer/userData.js +++ b/src/store/reducer/userData.js @@ -1,5 +1,5 @@ import * as actionTypes from '../actionTypes'; -import { updateObject } from '../../shared/utilityFunctions'; +import { updateObject } from '../../utils/updateObject'; const initialState = { userId: null, diff --git a/src/shared/constants.js b/src/styles/constants.js similarity index 100% rename from src/shared/constants.js rename to src/styles/constants.js diff --git a/src/utils/updateObject.js b/src/utils/updateObject.js new file mode 100644 index 0000000..400d43c --- /dev/null +++ b/src/utils/updateObject.js @@ -0,0 +1,6 @@ +export const updateObject = (oldObject, updatedProperties) => { + return { + ...oldObject, + ...updatedProperties, + }; +};