Skip to content

Commit

Permalink
Bring back the default homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
basicthinker committed Aug 9, 2024
1 parent d78c135 commit cade279
Show file tree
Hide file tree
Showing 11 changed files with 539 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Website

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

### Installation

Expand Down
83 changes: 34 additions & 49 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

const {themes} = require('prism-react-renderer');
const lightTheme = themes.github;
const darkTheme = themes.dracula;

const organizationName = "devchat-ai";
const projectName = "devchat-website";
import {themes as prismThemes} from 'prism-react-renderer';

/** @type {import('@docusaurus/types').Config} */
const config = {

organizationName,
projectName,

title: 'Devchat',
title: 'DevChat',
favicon: 'img/favicon.ico',

// Set the production url of your site here
Expand All @@ -23,6 +17,11 @@ const config = {
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: `/`,

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'devchat-ai', // Usually your GitHub org/user name.
projectName: 'devchat-website', // Usually your repo name.

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

Expand All @@ -45,12 +44,11 @@ const config = {

presets: [
[
'@docusaurus/preset-classic',
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
sidebarPath: './sidebars.js',
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
Expand All @@ -73,73 +71,60 @@ const config = {
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'Devchat',
title: 'DevChat',
logo: {
alt: 'Devchat Logo',
alt: 'DevChat Logo',
src: 'img/logo.svg',
},
items: [
// {
// type: 'docSidebar',
// sidebarId: 'docSidebar',
// position: 'left',
// label: 'Document',
// },
// {to: '/blog', label: 'Blog', position: 'left'},
{
type: 'docSidebar',
sidebarId: 'docSidebar',
position: 'left',
label: 'Document',
},
{
href: 'https://github.com/devchat-ai',
label: 'GitHub',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
}
],
},
/* footer: {
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/intro',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
href: 'https://discord.com/invite/9t3yrbBUXD',
},
{
label: 'Twitter',
href: 'https://twitter.com/docusaurus',
href: 'https://twitter.com/DevChatAI',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/facebook/docusaurus',
href: 'https://github.com/devchat-ai',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
},*/
copyright: `Copyright © ${new Date().getFullYear()} Merico, Inc.`,
},
prism: {
theme: lightTheme,
darkTheme: darkTheme,
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),
};
Expand Down
4 changes: 2 additions & 2 deletions i18n/en/docusaurus-theme-classic/navbar.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"title": {
"message": "Devchat",
"message": "DevChat",
"description": "The title in the navbar"
},
"logo.alt": {
"message": "Devchat Logo",
"message": "DevChat Logo",
"description": "The alt text of navbar logo"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ TODO: 引用example
## ChatMark: 在消息中进行用户交互的标记语法
语法介绍:
- [chatmark](https://github.com/devchat-ai/devchat-docs/blob/main/docs/specs/chatmark.md)
- [chatmark](https://github.com/devchat-ai/devchat-website/blob/main/docs/specs/chatmark.md)
### Python 封装
Expand Down
4 changes: 2 additions & 2 deletions i18n/zh/docusaurus-theme-classic/navbar.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"title": {
"message": "Devchat",
"message": "DevChat",
"description": "The title in the navbar"
},
"logo.alt": {
"message": "Devchat Logo",
"message": "DevChat Logo",
"description": "The alt text of navbar logo"
}
}
64 changes: 64 additions & 0 deletions src/components/HomepageFeatures/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import clsx from 'clsx';
import Heading from '@theme/Heading';
import styles from './styles.module.css';

const FeatureList = [
{
title: 'Easy to Use',
Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
description: (
<>
Docusaurus was designed from the ground up to be easily installed and
used to get your website up and running quickly.
</>
),
},
{
title: 'Focus on What Matters',
Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
description: (
<>
Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
ahead and move your docs into the <code>docs</code> directory.
</>
),
},
{
title: 'Powered by React',
Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
description: (
<>
Extend or customize your website layout by reusing React. Docusaurus can
be extended while reusing the same header and footer.
</>
),
},
];

function Feature({Svg, title, description}) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">
<Svg className={styles.featureSvg} role="img" />
</div>
<div className="text--center padding-horiz--md">
<Heading as="h3">{title}</Heading>
<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>
);
}
11 changes: 11 additions & 0 deletions src/components/HomepageFeatures/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}

.featureSvg {
height: 200px;
width: 200px;
}
43 changes: 43 additions & 0 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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 Heading from '@theme/Heading';
import styles from './index.module.css';

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

0 comments on commit cade279

Please sign in to comment.