Skip to content

Commit

Permalink
feat: homepage hero scaffolded
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSage committed Sep 21, 2023
1 parent a93e01a commit 9bdba69
Show file tree
Hide file tree
Showing 12 changed files with 412 additions and 103 deletions.
19 changes: 19 additions & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ const config = {
},

// Plugins we added
plugins: [
async function myPlugin(context, options) {
return {
name: "docusaurus-tailwindcss",
configurePostCss(postcssOptions) {
// Appends TailwindCSS and AutoPrefixer.
postcssOptions.plugins.push(require("tailwindcss"));
postcssOptions.plugins.push(require("autoprefixer"));
return postcssOptions;
},
};
},
],

// Only for react live
themes: ["@docusaurus/theme-live-codeblock"],

Expand Down Expand Up @@ -225,6 +239,11 @@ const config = {
darkTheme: darkCodeTheme,
additionalLanguages: ["python"],
},
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false,
},
}),
};

Expand Down
6 changes: 5 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
"@docusaurus/core": "2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@docusaurus/theme-live-codeblock": "^2.4.1",
"@heroicons/react": "^2.0.18",
"@mdx-js/react": "^1.6.22",
"autoprefixer": "^10.4.16",
"clsx": "^1.2.1",
"postcss": "^8.4.30",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"redocusaurus": "^1.6.3"
"redocusaurus": "^1.6.3",
"tailwindcss": "^3.3.3"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.1"
Expand Down
8 changes: 8 additions & 0 deletions docs/src/components/Homepage/homepageFeatures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { useColorMode } from "@docusaurus/theme-common";

export default function HomepageFeatures() {
const { isDarkTheme } = useColorMode();

return <div>hi</div>;
}
143 changes: 143 additions & 0 deletions docs/src/components/Homepage/homepageHero.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import React from "react";
import { ChevronRightIcon } from "@heroicons/react/20/solid";
import { useColorMode } from "@docusaurus/theme-common";

export default function HomepageHero() {
const { isDarkTheme } = useColorMode();

return (
<div className="relative isolate overflow-hidden bg-white dark:bg-gray-900">
{/* Background grid pattern */}
{isDarkTheme ? (
<svg
className="absolute inset-0 -z-10 h-full w-full stroke-white/10 [mask-image:radial-gradient(100%_100%_at_top_right,white,transparent)]"
aria-hidden="true"
>
<defs>
<pattern
id="983e3e4c-de6d-4c3f-8d64-b9761d1534cc"
width={200}
height={200}
x="50%"
y={-1}
patternUnits="userSpaceOnUse"
>
<path d="M.5 200V.5H200" fill="none" />
</pattern>
</defs>
<svg x="50%" y={-1} className="overflow-visible fill-gray-800/20">
<path
d="M-200 0h201v201h-201Z M600 0h201v201h-201Z M-400 600h201v201h-201Z M200 800h201v201h-201Z"
strokeWidth={0}
/>
</svg>
<rect
width="100%"
height="100%"
strokeWidth={0}
fill="url(#983e3e4c-de6d-4c3f-8d64-b9761d1534cc)"
/>
</svg>
) : (
<svg
className="absolute inset-0 -z-10 h-full w-full stroke-gray-200 [mask-image:radial-gradient(100%_100%_at_top_right,white,transparent)]"
aria-hidden="true"
>
<defs>
<pattern
id="0787a7c5-978c-4f66-83c7-11c213f99cb7"
width={200}
height={200}
x="50%"
y={-1}
patternUnits="userSpaceOnUse"
>
<path d="M.5 200V.5H200" fill="none" />
</pattern>
</defs>
<rect
width="100%"
height="100%"
strokeWidth={0}
fill="url(#0787a7c5-978c-4f66-83c7-11c213f99cb7)"
/>
</svg>
)}
{/* Background subtle gradient effect */}
{isDarkTheme && (
<div
className="absolute left-[calc(50%-4rem)] top-10 -z-10 transform-gpu blur-3xl sm:left-[calc(50%-18rem)] lg:left-48 lg:top-[calc(50%-30rem)] xl:left-[calc(50%-24rem)]"
aria-hidden="true"
>
<div
className="aspect-[1108/632] w-[69.25rem] bg-gradient-to-r from-[#80caff] to-[#4f46e5] opacity-20"
style={{
clipPath:
"polygon(73.6% 51.7%, 91.7% 11.8%, 100% 46.4%, 97.4% 82.2%, 92.5% 84.9%, 75.7% 64%, 55.3% 47.5%, 46.5% 49.4%, 45% 62.9%, 50.3% 87.2%, 21.3% 64.1%, 0.1% 100%, 5.4% 51.1%, 21.4% 63.9%, 58.9% 0.2%, 73.6% 51.7%)",
}}
/>
</div>
)}

{/* Main hero content */}
<div className="mx-auto max-w-7xl px-6 pb-24 pt-10 sm:pb-32 lg:flex lg:px-8 lg:py-40">
<div className="mx-auto max-w-2xl flex-shrink-0 lg:mx-0 lg:max-w-xl lg:pt-8">
{/* App logo */}
<span role="img" aria-label="waving hand" className="h-11 text-4xl">
👋
</span>
{/* What's new */}
<div className="mt-24 sm:mt-32 lg:mt-16">
<a href="#" className="inline-flex space-x-6">
<span className="rounded-full bg-indigo-600/10 px-3 py-1 text-sm font-semibold leading-6 text-indigo-600 ring-1 ring-inset ring-indigo-600/10 dark:bg-indigo-500/10 dark:text-indigo-400 dark:ring-indigo-500/20">
What's new
</span>
<span className="inline-flex items-center space-x-2 text-sm font-medium leading-6 text-gray-600 dark:text-gray-300">
<span>Just shipped v0.1</span>
<ChevronRightIcon
className="h-5 w-5 text-gray-400 dark:text-gray-500"
aria-hidden="true"
/>
</span>
</a>
</div>
{/* Hero Title */}
<h1 className="mt-10 text-4xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-6xl">
Run your own AI
</h1>
{/* Hero Subtitle */}
<p className="mt-6 text-lg leading-8 text-gray-600 dark:text-gray-300">
Jan is the private and flexible way to run your own AI. Jan is the
private and flexible way to run your own AI.
</p>
{/* Download CTAs */}
<div className="mt-10 flex items-center gap-x-6">
<a
href="#"
className="rounded-md bg-indigo-600 dark:bg-indigo-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:text-white hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-400"
>
Download on Mac
</a>
<a
href="#"
className="text-sm font-semibold leading-6 text-gray-900 dark:text-white hover:text-current"
>
Other Platforms <span aria-hidden="true"></span>
</a>
</div>
</div>
{/* App Screenshot */}
<div className="mx-auto mt-16 flex max-w-2xl sm:mt-24 lg:ml-10 lg:mr-0 lg:mt-0 lg:max-w-none lg:flex-none xl:ml-32">
<div className="max-w-3xl flex-none sm:max-w-5xl lg:max-w-none">
<img
src={require("@site/static/img/jan-app-screenshot.png").default}
alt="App screenshot"
width={2432}
className="w-[76rem] rounded-3xl shadow-2xl"
/>
</div>
</div>
</div>
</div>
);
}
2 changes: 2 additions & 0 deletions docs/src/components/Homepage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as HomepageFeatures } from "./homepageFeatures";
export { default as HomepageHero } from "./homepageHero";
64 changes: 0 additions & 64 deletions docs/src/components/HomepageFeatures/index.js

This file was deleted.

6 changes: 5 additions & 1 deletion docs/src/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
Expand All @@ -18,7 +22,7 @@
}

/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
[data-theme="dark"] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
Expand Down
32 changes: 4 additions & 28 deletions docs/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,19 @@
import React from "react";
import clsx from "clsx";
import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
import HomepageFeatures from "@site/src/components/HomepageFeatures";
import { HomepageFeatures, HomepageHero } from "@site/src/components/Homepage";

import styles from "./index.module.css";

function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
return (
<header className={clsx("hero hero--primary", styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/intro"
>
Docusaurus Tutorial - 5min ⏱️
</Link>
</div>
</div>
</header>
);
}

export default function Home() {
const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}
title={`${siteConfig.tagline}`}
description="Description will go into a meta tag in <head />"
>
<HomepageHeader />
<main>
<HomepageFeatures />
</main>
<HomepageHero />
<HomepageFeatures />
</Layout>
);
}
Binary file added docs/static/img/jan-app-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
corePlugins: {
preflight: false, // disable Tailwind's reset
},
content: ["./src/**/*.{js,jsx,ts,tsx}"], // Only affects code in /src; can also add ./docs/**/*.mdx to use tailwind in docs
darkMode: ["class", '[data-theme="dark"]'], // hooks into docusaurus' dark mode settings
theme: {
extend: {},
},
plugins: [],
};
Loading

0 comments on commit 9bdba69

Please sign in to comment.