Skip to content

Commit

Permalink
login config
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavya031 committed Feb 20, 2024
1 parent 1f125ad commit f0b6c4e
Show file tree
Hide file tree
Showing 17 changed files with 191 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="ldiFvWT9pk9xDSZkPHmw7WHSXPQMh6Vp5tOR/+TusrE="

GITHUB_ID="3d419ab419c7f047ff99"
GITHUB_SECRET="506da3ba7af5bb9d77f9db5786349a5cf8d3691d"
Empty file added auth.ts
Empty file.
23 changes: 13 additions & 10 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: 'export',

// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,

// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
// skipTrailingSlashRedirect: true,

// Optional: Change the output directory `out` -> `dist`
// distDir: 'dist',
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'i.imgur.com',
},
],
},
env: {
GITHUB_APP_CLIENT_ID: '3d419ab419c7f047ff99',
GITHUB_APP_CLIENT_SECRET: '506da3ba7af5bb9d77f9db5786349a5cf8d3691d',
NEXTAUTH_SECRET: 'ldiFvWT9pk9xDSZkPHmw7WHSXPQMh6Vp5tOR/+TusrE=',
},
}

module.exports = nextConfig
62 changes: 61 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "20.11.19",
"@types/react": "18.2.56",
"autoprefixer": "^10.0.1",
"daisyui": "^4.7.2",
"postcss": "^8",
"tailwindcss": "^3.4.1"
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
}
}
6 changes: 6 additions & 0 deletions src/app/api/auth/[...nextauth]/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { authOptions } from "../../../lib/nextAuth";
import NextAuth from "next-auth";

const handler = NextAuth(authOptions)

export { handler as GET, handler as POST}
9 changes: 9 additions & 0 deletions src/app/api/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getServerSession } from "next-auth";
import { AuthOptions, authOptions } from "../lib/nextAuth";
import { NextResponse } from "next/server";

export async function GET(request) {
const session = await getServerSession(authOptions)
console.log({session})
return NextResponse.json({id: 1})
}
6 changes: 6 additions & 0 deletions src/app/auth/[...nextauth]/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { authOptions } from "../../lib/nextAuth";
import NextAuth from "next-auth";

const handler = NextAuth(authOptions)

export { handler as GET, handler as POST}
6 changes: 3 additions & 3 deletions src/app/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import React from "react";
import "./components.css";
const Navbar = () => {
return (
<nav className="navstyle">
<nav className="questrial-regular">
<div className="mx-auto flex max-w-screen-xl flex-wrap items-center justify-between p-4">
<a className="flex items-center space-x-3 rtl:space-x-reverse">
<a href="/" className="flex items-center space-x-3 rtl:space-x-reverse">
<img
src="https://raw.githubusercontent.com/Bhavya031/shlper/0d2e9d178319b0132f3832ffbda50602f0063408/public/Asset%203.svg"
className="h-8"
alt="Logo"
/>
</a>
<button className="NavText">Login</button>
<a href="/api/auth/signin" className="Questrial">Login</a>
</div>
</nav>
);
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/SessionProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use client";
import { SessionProvider } from "next-auth/react";
export default SessionProvider;
8 changes: 7 additions & 1 deletion src/app/components/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
}
.navstyle {
border-bottom: solid #353333 1px
};
};
html {
font-family: var(--font-Questrial);
}
nav {
font-family: var(--font-Questrial);
}
5 changes: 5 additions & 0 deletions src/app/fonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Questrial } from 'next/font/google'

export const Questrial = Questrial({
subsets: ['latin'],
})
6 changes: 4 additions & 2 deletions src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import url('https://fonts.googleapis.com/css2?family=Questrial&display=swap');

html {
font-family: 'Questrial', sans-serif;
font-family: var(--font-Questrial);
}
nav {
font-family: var(--font-Questrial);
}
27 changes: 13 additions & 14 deletions src/app/layout.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { Inter } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata = {
title: "Shlper",
description: "Study Utiltes to help you learn better",
};

import { Questrial } from 'next/font/google'

// If loading a variable font, you don't need to specify the font weight
const QuestrialFont = Questrial({
subsets: ['latin'],
display: 'swap',
weight: '400',
})

export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<html lang="en" className={QuestrialFont.className}>
<body>{children}</body>
</html>
);
}
)
}
14 changes: 14 additions & 0 deletions src/app/lib/nextAuth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NextAuthOptions } from "next-auth";
import GithubProvider from "next-auth/providers/github";


export const authOptions = {
secret: process.env.NEXTAUTH_SECRET,
providers: [
GithubProvider({
clientId: process.env.GITHUB_APP_CLIENT_ID,
clientSecret: process.env.GITHUB_APP_CLIENT_SECRET,
}),
],

}
6 changes: 4 additions & 2 deletions src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Navbar from "./components/Navbar";


const Home = () => {

return (
<div>
<Navbar />
<video src="./BG.mp4 " autoPlay loop muted />
<video src="./BG.mp4" autoPlay loop muted style={{ width: '100%', height: '100%' }} />
</div>

);
};

Expand Down
34 changes: 34 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
".next/types/**/*.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}

0 comments on commit f0b6c4e

Please sign in to comment.