Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Workflow added #1

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches:
- main
- feature/workflow
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

# - name: Test
# run: npm test
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#87bfb5",
"activityBar.background": "#87bfb5",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#9859a6",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#15202b99",
"sash.hoverBorder": "#87bfb5",
"statusBar.background": "#66ada0",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#4e9285",
"statusBarItem.remoteBackground": "#66ada0",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#66ada0",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#66ada099",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#66ada0"
}
14 changes: 11 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// "use client"
import type { Metadata } from 'next';

import './globals.css'
import Navbar from '@/components/Navbar';
import Footer from '@/components/Footer';
// import { store } from '@/redux/store';
import { Provider } from 'react-redux';
import { Provider, useSelector } from 'react-redux';
import { RootState } from '@/redux/store';

export const metadata: Metadata = {
title: 'Travel',
Expand All @@ -13,11 +15,17 @@ export const metadata: Metadata = {

export default function RootLayout({
children,
DarkMode
}: {
children: React.ReactNode
children: React.ReactNode,
DarkMode:RootState
}) {

// const DarkMode = useSelector((state:RootState)=>state)
console.log(DarkMode)

return (
<html lang="en">
<html lang="en" className="dark">
{/* <Provider store={store}> */}
<body>
<Navbar />
Expand Down
38 changes: 20 additions & 18 deletions redux/reducers/DarkReducer.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
// import { createSlice } from '@reduxjs/toolkit';
const TOGGLE__DARKMODE = "TOGGLE__DARKMODE"

// const initialState = {
// counter: 0,
// };
const toggleDarkMode=()=>({
type:TOGGLE__DARKMODE
})

// export const counterSlice = createSlice({
// name: 'counter',
// initialState,
// reducers: {
// increment: (state) => {
// state.counter += 1;
// },
// decrement: (state) => {
// state.counter -= 1;
// },
// },
// });
const initialState:{isEnabled:boolean} = {
isEnabled:false
}

// export const { increment, decrement } = counterSlice.actions;
const DarkReducer=(state=initialState , action:{type:string})=>{
switch (action.type) {
case TOGGLE__DARKMODE:
return {
...state, isEnabled: !state.isEnabled
}

default:
return state
}

}

// export default counterSlice.reducer;
export default DarkReducer
30 changes: 12 additions & 18 deletions redux/store.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
// // store.ts
// import { configureStore } from '@reduxjs/toolkit';
// import rootReducer from './reducers/DarkReducer'; // Import your reducers
import { combineReducers, configureStore } from "@reduxjs/toolkit";
import DarkReducer from "./reducers/DarkReducer";

// export interface RootState {
// // Define your RootState interface here
// dark: ReturnType<typeof rootReducer>;
// }
export type DarkState = ReturnType<typeof DarkReducer>;

// let store: any = null;
export type RootState = {
dark: DarkState;
};

// if (typeof window !== 'undefined') {
// // This check ensures that the store is only created in the client-side context
// store = configureStore({
// reducer: rootReducer,
// });
// } else {
// // In server-side or during pre-rendering, set store to an empty or default value
// store = {}; // Or any default value you want to assign for server-side rendering
// }
const RootReducer = combineReducers({
dark: DarkReducer,
});

// export { store };
export const store = configureStore({
reducer: RootReducer,
});
Loading