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 type { ReactNode } from "react";
import Header from './Header'
export default function Layout({ children }) { type LayoutProps = {
children: ReactNode;
};
export default function Layout({ children }: LayoutProps) {
return ( return (
<> <>
<Navbar /> <header className="py-5 px-20">
<h1 className="text-2xl">Mock SAML IdP</h1>
</header>
<main>{children}</main> <main>{children}</main>
<Header />
</> </>
) );
} }

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

@ -6,9 +6,9 @@ module.exports = {
config.resolve.fallback = { config.resolve.fallback = {
fs: false, fs: false,
zlib: false, zlib: false,
} };
} }
return config; return config;
} },
} };

View File

@ -1,10 +1,13 @@
import '../styles/globals.css' import "styles/globals.css";
import type { AppProps } from 'next/app' import type { AppProps } from "next/app";
import Layout from "components/Layout";
function MyApp({ Component, pageProps }: AppProps) { function MyApp({ Component, pageProps }: AppProps) {
return ( return (
<Layout>
<Component {...pageProps} /> <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 { GetServerSideProps } from 'next'; import { IdPMetadata } from "../types";
import { IdPMetadata } from '../types' import config from "../lib/env";
import config from '../lib/env'; import { createCertificate } from "../utils";
import {createCertificate} from '../utils' import React from "react";
import React from 'react'; import Link from "next/link";
import Link from 'next/link' import Layout from "components/Layout";
import Head from "next/head";
export const getServerSideProps: GetServerSideProps = async () => { export const getServerSideProps: GetServerSideProps = async () => {
const metadata: IdPMetadata = { const metadata: IdPMetadata = {
ssoUrl: config.ssoUrl, ssoUrl: config.ssoUrl,
entityId: config.entityId, entityId: config.entityId,
certificate: await createCertificate(), certificate: await createCertificate(),
} };
return { return {
props: { props: {
metadata metadata,
}, },
}; };
}; };
const Home: React.FC<{ metadata: IdPMetadata }> = ({ metadata }) => { const Home: React.FC<{ metadata: IdPMetadata }> = ({ metadata }) => {
return ( return (
<div> <>
<strong>Mock IdP Metadata</strong> <Head>
<p>SSO URL: {metadata.ssoUrl}</p> <title>Mock SAML IdP - Metadata</title>
<p>Entity ID: {metadata.entityId}</p> </Head>
<p>Certificate: {metadata.certificate}</p> <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> <br></br>
<p><Link href="/api/saml/metadata/download">Download Metadata</Link></p> <p>
<Link href="/api/saml/metadata/download">Download Metadata</Link>
</p>
</div> </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 components;
@tailwind utilities; @tailwind utilities;
:root {
color-scheme: dark light;
}
.theme-default {
--color-primary: 37 194 160;
--color-secondary: 48 56 70;
}
html, html,
body { body {
padding: 0; padding: 0;
margin: 0; margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, font-family: "Manrope", sans-serif;
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
} }
a { 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 = { module.exports = {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', "./pages/**/*.{js,ts,jsx,tsx}",
'./components/**/*.{js,ts,jsx,tsx}', "./components/**/*.{js,ts,jsx,tsx}",
], ],
theme: { theme: {
colors: {
...colors,
primary: withOpacityValue("--color-primary"),
secondary: withOpacityValue("--color-secondary"),
},
extend: {}, extend: {},
}, },
plugins: [], plugins: [],