From e75f64ef66507e633d7dedc45049098584169d0d Mon Sep 17 00:00:00 2001 From: hutamatr Date: Fri, 18 Aug 2023 14:05:00 +0700 Subject: [PATCH 01/12] feat: create modal-slice --- src/store/modalSlice.ts | 25 +++++++++++++++++++++++++ src/store/store.ts | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 src/store/modalSlice.ts diff --git a/src/store/modalSlice.ts b/src/store/modalSlice.ts new file mode 100644 index 0000000..67c2c2e --- /dev/null +++ b/src/store/modalSlice.ts @@ -0,0 +1,25 @@ +import { createSlice } from '@reduxjs/toolkit'; + +interface IModalState { + isModalShow: boolean; +} + +const initialState: IModalState = { + isModalShow: false, +}; + +export const modalSlice = createSlice({ + name: 'modal', + initialState, + reducers: { + showModalHandler: (state) => { + state.isModalShow = !state.isModalShow; + }, + }, +}); + +const { actions, reducer } = modalSlice; + +export const { showModalHandler } = actions; + +export default reducer; diff --git a/src/store/store.ts b/src/store/store.ts index 8cd882a..95b9951 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -5,6 +5,7 @@ import storage from 'redux-persist/lib/storage'; import authReducer from './authSlice'; import cartReducer from './cartSlice'; +import modalReducer from './modalSlice'; import orderReducer from './orderSlice'; import productsReducer from './productSlice'; import userReducer from './userSlice'; @@ -23,6 +24,7 @@ const reducers = combineReducers({ products: productsReducer, wishlist: wishlistReducer, order: orderReducer, + modal: modalReducer, }); const persistedReducer = persistReducer(rootPersistConfig, reducers); From 36f227d8537f543661f2addd8dffe058f4d1d0ec Mon Sep 17 00:00:00 2001 From: hutamatr Date: Fri, 18 Aug 2023 14:11:53 +0700 Subject: [PATCH 02/12] style: changes classname styles --- src/components/Layout/Layout.tsx | 7 +- src/components/UI/Input/index.tsx | 2 +- src/pages/HomePage/index.tsx | 4 +- src/pages/ProductPage/index.tsx | 2 +- src/pages/SignUpPage/index.tsx | 214 +++++++++++++++--------------- 5 files changed, 112 insertions(+), 117 deletions(-) diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx index 6d7b3e5..467e3a0 100644 --- a/src/components/Layout/Layout.tsx +++ b/src/components/Layout/Layout.tsx @@ -16,12 +16,7 @@ export default function Layout() { > -
+