Landing page and other changes

This commit is contained in:
Aswin V 2022-02-18 14:26:42 +05:30
parent 6b63cc2ea8
commit 16543a832c
10 changed files with 108 additions and 183 deletions

View File

@ -1,7 +0,0 @@
export default function Header() {
return (
<>
<div>Header</div>
</>
)
}

View File

@ -1,12 +1,15 @@
import Navbar from './NavBar'
import Header from './Header'
import type { ReactNode } from "react";
export default function Layout({ children }) {
type LayoutProps = {
children: ReactNode;
};
export default function Layout({ children }: LayoutProps) {
return (
<>
<Navbar />
<main>{children}</main>
<Header />
<header className="py-5 px-20">
<h1 className="text-2xl">Mock SAML IdP</h1>
</header>
<main>{children}</main>
</>
)
}
);
}

View File

@ -1,16 +0,0 @@
import { Sidenav, Nav, Dropdown } from 'rsuite';
export default function Navbar() {
return (
<div style={{ width: 240 }}>
<Sidenav defaultOpenKeys={['3', '4']} activeKey="1">
<Sidenav.Body>
<Nav>
<Nav.Item eventKey="1">Dashboard</Nav.Item>
<Nav.Item eventKey="2">Apps</Nav.Item>
</Nav>
</Sidenav.Body>
</Sidenav>
</div>
)
}

View File

@ -3,12 +3,12 @@ module.exports = {
reactStrictMode: true,
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback = {
fs: false,
zlib: false,
}
config.resolve.fallback = {
fs: false,
zlib: false,
};
}
return config;
}
}
},
};

View File

@ -1,10 +1,13 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import "styles/globals.css";
import type { AppProps } from "next/app";
import Layout from "components/Layout";
function MyApp({ Component, pageProps }: AppProps) {
return (
<Component {...pageProps} />
)
<Layout>
<Component {...pageProps} />
</Layout>
);
}
export default MyApp
export default MyApp;

22
pages/_document.tsx Normal file
View File

@ -0,0 +1,22 @@
import Document, { Html, Head, Main, NextScript } from "next/document";
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<link
href="https://fonts.googleapis.com/css?family=Manrope&display=optional"
rel="stylesheet"
/>
</Head>
<body className="theme-default">
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;

View File

@ -1,36 +1,48 @@
import type { NextPage } from 'next'
import { GetServerSideProps } from 'next';
import { IdPMetadata } from '../types'
import config from '../lib/env';
import {createCertificate} from '../utils'
import React from 'react';
import Link from 'next/link'
import { GetServerSideProps } from "next";
import { IdPMetadata } from "../types";
import config from "../lib/env";
import { createCertificate } from "../utils";
import React from "react";
import Link from "next/link";
import Layout from "components/Layout";
import Head from "next/head";
export const getServerSideProps: GetServerSideProps = async () => {
const metadata: IdPMetadata = {
ssoUrl: config.ssoUrl,
entityId: config.entityId,
certificate: await createCertificate(),
}
};
return {
props: {
metadata
metadata,
},
};
};
const Home: React.FC<{metadata: IdPMetadata}> = ({ metadata }) => {
const Home: React.FC<{ metadata: IdPMetadata }> = ({ metadata }) => {
return (
<div>
<strong>Mock IdP Metadata</strong>
<p>SSO URL: {metadata.ssoUrl}</p>
<p>Entity ID: {metadata.entityId}</p>
<p>Certificate: {metadata.certificate}</p>
<br></br>
<p><Link href="/api/saml/metadata/download">Download Metadata</Link></p>
</div>
)
}
<>
<Head>
<title>Mock SAML IdP - Metadata</title>
</Head>
<div className="w-3/5 mx-auto relative top-10 bg-blue-50 p-5 rounded-xl grid gap-6 grid-cols-3 shadow-lg shadow-blueGray-50 text-[#145698]">
<p className="font-bold">SSO URL</p>
<p className="col-span-2">{metadata.ssoUrl}</p>
<p className="font-bold">Entity ID</p>
<p className="col-span-2">{metadata.entityId}</p>
<p className="font-bold">Certificate</p>
<p className="min-w-0 overflow-auto text-sm col-span-2">
{metadata.certificate}
</p>
<br></br>
<p>
<Link href="/api/saml/metadata/download">Download Metadata</Link>
</p>
</div>
</>
);
};
export default Home
export default Home;

View File

@ -1,116 +0,0 @@
.container {
padding: 0 2rem;
}
.main {
min-height: 100vh;
padding: 4rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.footer {
display: flex;
flex: 1;
padding: 2rem 0;
border-top: 1px solid #eaeaea;
justify-content: center;
align-items: center;
}
.footer a {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.title a {
color: #0070f3;
text-decoration: none;
}
.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}
.title {
margin: 0;
line-height: 1.15;
font-size: 4rem;
}
.title,
.description {
text-align: center;
}
.description {
margin: 4rem 0;
line-height: 1.5;
font-size: 1.5rem;
}
.code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}
.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 800px;
}
.card {
margin: 1rem;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;
max-width: 300px;
}
.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}
.card h2 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}
.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}
.logo {
height: 1em;
margin-left: 0.5rem;
}
@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
}

View File

@ -2,12 +2,20 @@
@tailwind components;
@tailwind utilities;
:root {
color-scheme: dark light;
}
.theme-default {
--color-primary: 37 194 160;
--color-secondary: 48 56 70;
}
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
font-family: "Manrope", sans-serif;
}
a {

View File

@ -1,9 +1,25 @@
const colors = require("tailwindcss/colors");
function withOpacityValue(variable) {
return ({ opacityValue }) => {
if (opacityValue === undefined) {
return `rgb(var(${variable}))`;
}
return `rgb(var(${variable}) / ${opacityValue})`;
};
}
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
colors: {
...colors,
primary: withOpacityValue("--color-primary"),
secondary: withOpacityValue("--color-secondary"),
},
extend: {},
},
plugins: [],