0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

feat: init docs (#503)

* feat: init docs

* refactor: add missing dependencies

* fix: filter out docs for annotations
This commit is contained in:
Gao Sun 2022-04-07 09:45:01 +08:00 committed by GitHub
parent ff925372e5
commit ab50cf1168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 6371 additions and 280 deletions

View file

@ -1,7 +1,10 @@
const fs = require('fs');
const directories = fs.readdirSync('./packages');
const reports = directories.map((dir) => fs.readFileSync(`./packages/${dir}/report.json`, { encoding: 'utf-8' }));
const reports = directories
// Filter out docs temporarily
.filter((dir) => dir !== 'docs')
.map((dir) => fs.readFileSync(`./packages/${dir}/report.json`, { encoding: 'utf-8' }));
const merged = [];
for (const report of reports) {

20
packages/docs/.gitignore vendored Normal file
View file

@ -0,0 +1,20 @@
# Dependencies
/node_modules
# Production
/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*

41
packages/docs/README.md Normal file
View file

@ -0,0 +1,41 @@
# Website
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
### Installation
```
$ yarn
```
### Local Development
```
$ 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
```
$ yarn build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Deployment
Using SSH:
```
$ USE_SSH=true yarn deploy
```
Not using SSH:
```
$ GIT_USER=<Your GitHub username> 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.

View file

@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View file

@ -0,0 +1,7 @@
---
sidebar_position: 1
---
# Introduction
🤘 Logto is an open-source customer identity solution.

View file

@ -0,0 +1,104 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Logto Docs',
tagline: 'Dinosaurs are cool',
url: 'https://your-docusaurus-test-site.com',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'logto-io', // Usually your GitHub org/user name.
projectName: 'logto', // Usually your repo name.
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-cn'],
},
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'Logto Docs',
logo: {
alt: 'Logto Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Tutorial',
},
{
type: 'localeDropdown',
position: 'right',
},
{
href: 'https://github.com/logto-io/logto',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/docs/intro',
},
],
},
{
title: 'Community',
items: [
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/logto-io/logto',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Silverhand Inc. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
module.exports = config;

View file

@ -0,0 +1,7 @@
---
sidebar_position: 1
---
# 简介
🤘 Logto 是一个开源的用户身份解决方案。

View file

@ -0,0 +1,48 @@
{
"name": "docs",
"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",
"typecheck": "tsc"
},
"dependencies": {
"@algolia/client-search": "^4.13.0",
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@docusaurus/theme-classic": "^2.0.0-beta.18",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.18",
"@docusaurus/types": "^2.0.0-beta.18",
"@tsconfig/docusaurus": "^1.0.5",
"@types/node": "^17.0.23",
"@types/react": "^17.0.14",
"typescript": "^4.6.3"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

31
packages/docs/sidebars.js Normal file
View file

@ -0,0 +1,31 @@
/**
* 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.
*/
// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// 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'],
},
],
*/
};
module.exports = sidebars;

View file

@ -0,0 +1,60 @@
import React from 'react';
import clsx from 'clsx';
import styles from './styles.module.css';
type FeatureItem = {
title: string;
Svg: React.ComponentType<React.ComponentProps<'svg'>>;
description: JSX.Element;
};
const FeatureList: FeatureItem[] = [
{
title: 'Some Title',
Svg: require('@site/static/img/logo.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: 'Another Title',
Svg: require('@site/static/img/logo.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.
</>
),
},
];
function Feature({title, Svg, description}: FeatureItem) {
return (
<div className={clsx('col col--6')}>
<div className="text--center">
<Svg className={styles.featureSvg} role="img" />
</div>
<div className="text--center padding-horiz--md">
<h3>{title}</h3>
<p>{description}</p>
</div>
</div>
);
}
export default function HomepageFeatures(): JSX.Element {
return (
<section className={styles.features}>
<div className="container">
<div className="row">
{FeatureList.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
);
}

View file

@ -0,0 +1,11 @@
.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}
.featureSvg {
height: 200px;
width: 200px;
}

View file

@ -0,0 +1,39 @@
/**
* 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: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
}
.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);
}
[data-theme='dark'] .docusaurus-highlight-code-line {
background-color: rgba(0, 0, 0, 0.3);
}

View file

@ -0,0 +1,23 @@
/**
* CSS files with the .module.css suffix will be treated as CSS modules
* and scoped locally.
*/
.heroBanner {
padding: 4rem 0;
text-align: center;
position: relative;
overflow: hidden;
}
@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
}
}
.buttons {
display: flex;
align-items: center;
justify-content: center;
}

View file

@ -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 '@site/src/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">
Docusaurus Tutorial - 5min
</Link>
</div>
</div>
</header>
);
}
export default function Home(): JSX.Element {
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>
);
}

View file

@ -0,0 +1,7 @@
---
title: Markdown page example
---
# Markdown page example
You don't need React to write simple standalone pages.

0
packages/docs/static/.nojekyll vendored Normal file
View file

BIN
packages/docs/static/img/favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

58
packages/docs/static/img/logo.svg vendored Normal file
View file

@ -0,0 +1,58 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_511_3794)">
<path d="M130 141.649C130 129.708 139.68 120.027 151.622 120.027H362.432C374.374 120.027 384.054 129.708 384.054 141.649V368.676C384.054 380.617 374.374 390.298 362.432 390.298H151.622C139.68 390.298 130 380.617 130 368.676V141.649Z" fill="url(#paint0_linear_511_3794)"/>
<path d="M420.541 436.92L173.919 388.271L530 392.326L420.541 436.92Z" fill="url(#paint1_linear_511_3794)"/>
<path d="M130 138.779C130 128.019 137.912 118.897 148.564 117.375L294.51 96.5256C307.535 94.6648 319.189 104.772 319.189 117.93V392.394C319.189 405.552 307.535 415.66 294.51 413.799L148.564 392.949C137.912 391.428 130 382.305 130 371.545V138.779Z" fill="url(#paint2_linear_511_3794)"/>
<g filter="url(#filter0_d_511_3794)">
<circle cx="275.946" cy="255.162" r="16.2162" fill="url(#paint3_linear_511_3794)"/>
</g>
<g filter="url(#filter1_d_511_3794)">
<rect x="267.838" y="248.404" width="16.2162" height="43.2432" rx="8.10811" fill="url(#paint4_linear_511_3794)"/>
</g>
</g>
<defs>
<filter id="filter0_d_511_3794" x="258.378" y="238.945" width="35.1353" height="35.1343" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1.35135"/>
<feGaussianBlur stdDeviation="0.675676"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.104304 0 0 0 0 0.0825 0 0 0 0 0.2 0 0 0 0.02 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_511_3794"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_511_3794" result="shape"/>
</filter>
<filter id="filter1_d_511_3794" x="262.432" y="248.404" width="24.3239" height="52.7036" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="-1.35135" dy="5.40541"/>
<feGaussianBlur stdDeviation="2.02703"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.104304 0 0 0 0 0.0825 0 0 0 0 0.2 0 0 0 0.08 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_511_3794"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_511_3794" result="shape"/>
</filter>
<linearGradient id="paint0_linear_511_3794" x1="136.081" y1="264.622" x2="387.604" y2="184.156" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFF06A"/>
<stop offset="1" stop-color="#EC78FF"/>
</linearGradient>
<linearGradient id="paint1_linear_511_3794" x1="279.324" y1="396.38" x2="432.027" y2="427.461" gradientUnits="userSpaceOnUse">
<stop stop-color="#ECB6FF"/>
<stop offset="1" stop-color="#FFF4F4" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint2_linear_511_3794" x1="114.459" y1="278.811" x2="334.054" y2="231.514" gradientUnits="userSpaceOnUse">
<stop stop-color="#492EF3"/>
<stop offset="1" stop-color="#CF69FF"/>
</linearGradient>
<linearGradient id="paint3_linear_511_3794" x1="275.946" y1="238.945" x2="269.189" y2="271.378" gradientUnits="userSpaceOnUse">
<stop stop-color="#E1BFFF"/>
<stop offset="1" stop-color="#AF68EE"/>
</linearGradient>
<linearGradient id="paint4_linear_511_3794" x1="275.946" y1="248.404" x2="256.791" y2="282.883" gradientUnits="userSpaceOnUse">
<stop stop-color="#F8F2FF"/>
<stop offset="1" stop-color="#D185F5"/>
</linearGradient>
<clipPath id="clip0_511_3794">
<rect width="512" height="512" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,7 @@
{
// Just make IDE happy
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"baseUrl": "."
}
}

File diff suppressed because it is too large Load diff