diff --git a/components/FileListing.tsx b/components/FileListing.tsx new file mode 100644 index 0000000..f32b470 --- /dev/null +++ b/components/FileListing.tsx @@ -0,0 +1,25 @@ +import { FunctionComponent } from 'react' +import { ParsedUrlQuery } from 'querystring' + +const FileListing: FunctionComponent<{ query: ParsedUrlQuery }> = ({ query }) => { + const { path } = query + + // Multiple levels of path + if (Array.isArray(path)) { + return ( + <> + {path.map((p: any, i: number) => ( +
{p}
+ ))} + + ) + } + + // Only one level of path + if (path) { + return
{path}
+ } + return
index page
+} + +export default FileListing diff --git a/components/Footer.tsx b/components/Footer.tsx new file mode 100644 index 0000000..e716db5 --- /dev/null +++ b/components/Footer.tsx @@ -0,0 +1,5 @@ +const Footer = () => { + return
Powered by onedrive-vercel-index. Made with ❤ by SpencerWoo.
+} + +export default Footer diff --git a/components/Navbar.tsx b/components/Navbar.tsx new file mode 100644 index 0000000..7ef9a11 --- /dev/null +++ b/components/Navbar.tsx @@ -0,0 +1,13 @@ +import siteConfig from '../config/site.json' + +const Navbar = () => { + return ( +
+
+

{siteConfig.title}

+
+
+ ) +} + +export default Navbar diff --git a/config/site.json b/config/site.json new file mode 100644 index 0000000..f1a93a1 --- /dev/null +++ b/config/site.json @@ -0,0 +1,3 @@ +{ + "title": "Spencer's OneDrive Index" +} diff --git a/pages/[...path].tsx b/pages/[...path].tsx new file mode 100644 index 0000000..162f75e --- /dev/null +++ b/pages/[...path].tsx @@ -0,0 +1,29 @@ +import Head from 'next/head' +import Image from 'next/image' +import { useRouter } from 'next/router' + +import siteConfig from '../config/site.json' +import Navbar from '../components/Navbar' +import FileListing from '../components/FileListing' +import Footer from '../components/Footer' + +export default function Folders() { + const { query } = useRouter() + + return ( +
+ + {siteConfig.title} + + +
+ +
+ +
+
+ +
+ ) +} diff --git a/pages/_document.tsx b/pages/_document.tsx new file mode 100644 index 0000000..8491adb --- /dev/null +++ b/pages/_document.tsx @@ -0,0 +1,20 @@ +import Document, { Head, Html, Main, NextScript } from 'next/document' + +class MyDocument extends Document { + render() { + return ( + + + + + + +
+ + + + ) + } +} + +export default MyDocument diff --git a/pages/index.tsx b/pages/index.tsx index 80a795d..3826243 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,20 +1,29 @@ import Head from 'next/head' import Image from 'next/image' +import { useRouter } from 'next/router' + +import siteConfig from '../config/site.json' +import Navbar from '../components/Navbar' +import FileListing from '../components/FileListing' +import Footer from '../components/Footer' export default function Home() { + const { query } = useRouter() + return ( -
+
- Create Next App - - + {siteConfig.title} -
- OneDrive Vercel Index +
+ +
+ +
-
+
) } diff --git a/styles/globals.css b/styles/globals.css index b5c61c9..e66d6dc 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -1,3 +1,4 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap'); @tailwind base; @tailwind components; @tailwind utilities; diff --git a/tailwind.config.js b/tailwind.config.js index 62dfdaf..57e59e8 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,8 +1,15 @@ +const defaultTheme = require('tailwindcss/defaultTheme') + module.exports = { - purge: [], - darkMode: false, // or 'media' or 'class' + mode: 'jit', + purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], + darkMode: 'media', // or 'media' or 'class' theme: { - extend: {}, + extend: { + fontFamily: { + sans: ['Inter', '"Noto Sans SC"', ...defaultTheme.fontFamily.sans] + } + } }, variants: { extend: {},