Skip to content

Commit

Permalink
[website][upgrade] feat: initial framework (apache#11770)
Browse files Browse the repository at this point in the history
### Motivation

website upgrade

### Modifications

Initial framework for website upgrade
  • Loading branch information
urfreespace authored and ciaocloud committed Oct 16, 2021
1 parent 95c56bb commit 8ffae4e
Show file tree
Hide file tree
Showing 18 changed files with 398 additions and 0 deletions.
2 changes: 2 additions & 0 deletions site2/.gitignore
Expand Up @@ -14,3 +14,5 @@ website/static/swagger/master/*

website/static/swagger/restApiVersions.json
website/static/swagger/*/v*/*.json

website-tmp*/
22 changes: 22 additions & 0 deletions site2/website-next/.gitignore
@@ -0,0 +1,22 @@
# Dependencies
/node_modules

# Production
/build
build/
# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

bak/
33 changes: 33 additions & 0 deletions site2/website-next/README.md
@@ -0,0 +1,33 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

## Installation

```console
yarn install
```

## Local Development

```console
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Build

```console
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

```console
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions site2/website-next/babel.config.js
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
7 changes: 7 additions & 0 deletions site2/website-next/blog/2021-08-25-welcome.md
@@ -0,0 +1,7 @@
---
slug: welcome
title: Welcome
tags: [welcome, apache, pulsar]
---

Welcome to Apache Pulsar.
5 changes: 5 additions & 0 deletions site2/website-next/docs/intro.md
@@ -0,0 +1,5 @@
---
sidebar_position: 1
---

Welcome to Apache Pulsar.
86 changes: 86 additions & 0 deletions site2/website-next/docusaurus.config.js
@@ -0,0 +1,86 @@
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
title: "Apache Pulsar",
tagline:
"Apache Pulsar is a cloud-native, distributed messaging and streaming platform originally created at Yahoo! and now a top-level Apache Software Foundation project",
url: "https://your-docusaurus-test-site.com",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
organizationName: "facebook", // Usually your GitHub org/user name.
projectName: "docusaurus", // Usually your repo name.
themeConfig: {
navbar: {
title: "",
logo: {
alt: "",
src: "img/logo.svg",
},
items: [
{
type: "doc",
docId: "intro",
position: "left",
label: "Docs",
},
{ to: "/blog", label: "Blog", position: "left" },
{
href: "https://github.com/apache/pulsar",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "More",
items: [
{
label: "Docs",
to: "/docs/intro",
},
{
label: "Blog",
to: "/blog",
},
{
label: "GitHub",
href: "https://github.com/apache/pulsar",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Apache Pulsar, Inc.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
},
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
editUrl: "https://github.com/apache/pulsar",
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl: "https://github.com/apache/pulsar",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
},
],
],
};
40 changes: 40 additions & 0 deletions site2/website-next/package.json
@@ -0,0 +1,40 @@
{
"name": "website-next",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.4",
"@docusaurus/preset-classic": "2.0.0-beta.4",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.1.1",
"file-loader": "^6.2.0",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"url-loader": "^4.1.1"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
26 changes: 26 additions & 0 deletions site2/website-next/sidebars.js
@@ -0,0 +1,26 @@
/**
* Creating a sidebar enables you to:
- create an ordered group of docs
- render a sidebar for each doc of that group
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/

module.exports = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],

// But you can create a sidebar manually
/*
tutorialSidebar: [
{
type: 'category',
label: 'Tutorial',
items: ['hello'],
},
],
*/
};
59 changes: 59 additions & 0 deletions site2/website-next/src/components/HomepageFeatures.js
@@ -0,0 +1,59 @@
import React from "react";
import clsx from "clsx";
import styles from "./HomepageFeatures.module.css";

const FeatureList = [
{
title: "Pulsar Functions",
// Svg: require("../../static/img/undraw_docusaurus_mountain.svg").default,
description: (
<>
Easy to deploy, lightweight compute process, developer-friendly APIs, no
need to run your own stream processing engine.
</>
),
},
{
title: "Proven in production",
// Svg: require("../../static/img/undraw_docusaurus_tree.svg").default,
description: (
<>
Run in production at Yahoo! scale for over 5 years, with millions of
messages per second across millions of topics.
</>
),
},
{
title: "Horizontally scalable",
// Svg: require("../../static/img/undraw_docusaurus_react.svg").default,
description: <>Expand capacity seamlessly to hundreds of nodes.</>,
},
];

function Feature({ Svg, title, description }) {
return (
<div className={clsx("col col--4")}>
{/* <div className="text--center">
<Svg className={styles.featureSvg} alt={title} />
</div> */}
<div className="text--center padding-horiz--md">
<h3>{title}</h3>
<p>{description}</p>
</div>
</div>
);
}

export default function HomepageFeatures() {
return (
<section className={styles.features}>
<div className="container">
<div className="row">
{FeatureList.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
);
}
13 changes: 13 additions & 0 deletions site2/website-next/src/components/HomepageFeatures.module.css
@@ -0,0 +1,13 @@
/* stylelint-disable docusaurus/copyright-header */

.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}

.featureSvg {
height: 200px;
width: 200px;
}
29 changes: 29 additions & 0 deletions site2/website-next/src/css/custom.css
@@ -0,0 +1,29 @@
/* stylelint-disable docusaurus/copyright-header */
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/

/* You can override the default Infima variables here. */
:root {
--ifm-color-primary: #198fff;
--ifm-color-primary-dark: rgb(33, 175, 144);
--ifm-color-primary-darker: rgb(31, 165, 136);
--ifm-color-primary-darkest: rgb(26, 136, 112);
--ifm-color-primary-light: rgb(70, 203, 174);
--ifm-color-primary-lighter: rgb(102, 212, 189);
--ifm-color-primary-lightest: rgb(146, 224, 208);
--ifm-code-font-size: 95%;
}

.docusaurus-highlight-code-line {
background-color: rgba(0, 0, 0, 0.1);
display: block;
margin: 0 calc(-1 * var(--ifm-pre-padding));
padding: 0 var(--ifm-pre-padding);
}

html[data-theme='dark'] .docusaurus-highlight-code-line {
background-color: rgba(0, 0, 0, 0.3);
}
40 changes: 40 additions & 0 deletions site2/website-next/src/pages/index.js
@@ -0,0 +1,40 @@
import React from 'react';
import clsx from 'clsx';
import Layout from '@theme/Layout';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import styles from './index.module.css';
import HomepageFeatures from '../components/HomepageFeatures';

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">
Read️ the Docs
</Link>
</div>
</div>
</header>
);
}

export default function Home() {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />">
<HomepageHeader />
<main>
<HomepageFeatures />
</main>
</Layout>
);
}

0 comments on commit 8ffae4e

Please sign in to comment.