Improve documentation (#82)
* Propose new doc architecture * Many improvements to documentation (styling, structure...) * Remove modules added inadvertently + continue improving styling * Swizzle navbar item to add support for custom icon * Additional doc styling * Setup docs for API and redirect homepage for docs
This commit is contained in:
1
docs/docs/dev-docs/data/README.mdx
Normal file
1
docs/docs/dev-docs/data/README.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Data layer
|
||||
4
docs/docs/dev-docs/data/_category_.json
Normal file
4
docs/docs/dev-docs/data/_category_.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Data layer",
|
||||
"position": 3
|
||||
}
|
||||
1
docs/docs/dev-docs/data/connect.mdx
Normal file
1
docs/docs/dev-docs/data/connect.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Connecting to data sources
|
||||
1
docs/docs/dev-docs/data/mapping.mdx
Normal file
1
docs/docs/dev-docs/data/mapping.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Mapping entities
|
||||
1
docs/docs/dev-docs/data/optimization.mdx
Normal file
1
docs/docs/dev-docs/data/optimization.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Caching and optimization
|
||||
4
docs/docs/dev-docs/development/README.mdx
Normal file
4
docs/docs/dev-docs/development/README.mdx
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
# Translate your site
|
||||
|
||||
Let's translate `docs/intro.md` to French.
|
||||
4
docs/docs/dev-docs/development/_category_.json
Normal file
4
docs/docs/dev-docs/development/_category_.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Development",
|
||||
"position": 2
|
||||
}
|
||||
1
docs/docs/dev-docs/development/architecture.mdx
Normal file
1
docs/docs/dev-docs/development/architecture.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Architecture
|
||||
1
docs/docs/dev-docs/development/core-entities.mdx
Normal file
1
docs/docs/dev-docs/development/core-entities.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Core entities
|
||||
@ -1,8 +1,4 @@
|
||||
{
|
||||
"label": "Tutorial - Basics",
|
||||
"position": 2,
|
||||
"link": {
|
||||
"type": "generated-index",
|
||||
"description": "5 minutes to learn the most important Docusaurus concepts."
|
||||
}
|
||||
"label": "Getting started",
|
||||
"position": 1
|
||||
}
|
||||
|
||||
1
docs/docs/dev-docs/getting-started/cloud-setup.mdx
Normal file
1
docs/docs/dev-docs/getting-started/cloud-setup.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Cloud setup
|
||||
@ -1,23 +0,0 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# Congratulations!
|
||||
|
||||
You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.
|
||||
|
||||
Docusaurus has **much more to offer**!
|
||||
|
||||
Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**.
|
||||
|
||||
Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610)
|
||||
|
||||
## What's next?
|
||||
|
||||
- Read the [official documentation](https://docusaurus.io/)
|
||||
- Modify your site configuration with [`docusaurus.config.js`](https://docusaurus.io/docs/api/docusaurus-config)
|
||||
- Add navbar and footer items with [`themeConfig`](https://docusaurus.io/docs/api/themes/configuration)
|
||||
- Add a custom [Design and Layout](https://docusaurus.io/docs/styling-layout)
|
||||
- Add a [search bar](https://docusaurus.io/docs/search)
|
||||
- Find inspirations in the [Docusaurus showcase](https://docusaurus.io/showcase)
|
||||
- Get involved in the [Docusaurus Community](https://docusaurus.io/community/support)
|
||||
@ -1,34 +0,0 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Create a Blog Post
|
||||
|
||||
Docusaurus creates a **page for each blog post**, but also a **blog index page**, a **tag system**, an **RSS** feed...
|
||||
|
||||
## Create your first Post
|
||||
|
||||
Create a file at `blog/2021-02-28-greetings.md`:
|
||||
|
||||
```md title="blog/2021-02-28-greetings.md"
|
||||
---
|
||||
slug: greetings
|
||||
title: Greetings!
|
||||
authors:
|
||||
- name: Joel Marcey
|
||||
title: Co-creator of Docusaurus 1
|
||||
url: https://github.com/JoelMarcey
|
||||
image_url: https://github.com/JoelMarcey.png
|
||||
- name: Sébastien Lorber
|
||||
title: Docusaurus maintainer
|
||||
url: https://sebastienlorber.com
|
||||
image_url: https://github.com/slorber.png
|
||||
tags: [greetings]
|
||||
---
|
||||
|
||||
Congratulations, you have made your first post!
|
||||
|
||||
Feel free to play around and edit this post as much you like.
|
||||
```
|
||||
|
||||
A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings).
|
||||
@ -1,57 +0,0 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Create a Document
|
||||
|
||||
Documents are **groups of pages** connected through:
|
||||
|
||||
- a **sidebar**
|
||||
- **previous/next navigation**
|
||||
- **versioning**
|
||||
|
||||
## Create your first Doc
|
||||
|
||||
Create a Markdown file at `docs/hello.md`:
|
||||
|
||||
```md title="docs/hello.md"
|
||||
# Hello
|
||||
|
||||
This is my **first Docusaurus document**!
|
||||
```
|
||||
|
||||
A new document is now available at [http://localhost:3000/docs/hello](http://localhost:3000/docs/hello).
|
||||
|
||||
## Configure the Sidebar
|
||||
|
||||
Docusaurus automatically **creates a sidebar** from the `docs` folder.
|
||||
|
||||
Add metadata to customize the sidebar label and position:
|
||||
|
||||
```md title="docs/hello.md" {1-4}
|
||||
---
|
||||
sidebar_label: 'Hi!'
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Hello
|
||||
|
||||
This is my **first Docusaurus document**!
|
||||
```
|
||||
|
||||
It is also possible to create your sidebar explicitly in `sidebars.js`:
|
||||
|
||||
```js title="sidebars.js"
|
||||
module.exports = {
|
||||
tutorialSidebar: [
|
||||
'intro',
|
||||
// highlight-next-line
|
||||
'hello',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Tutorial',
|
||||
items: ['tutorial-basics/create-a-document'],
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
@ -1,43 +0,0 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Create a Page
|
||||
|
||||
Add **Markdown or React** files to `src/pages` to create a **standalone page**:
|
||||
|
||||
- `src/pages/index.js` → `localhost:3000/`
|
||||
- `src/pages/foo.md` → `localhost:3000/foo`
|
||||
- `src/pages/foo/bar.js` → `localhost:3000/foo/bar`
|
||||
|
||||
## Create your first React Page
|
||||
|
||||
Create a file at `src/pages/my-react-page.js`:
|
||||
|
||||
```jsx title="src/pages/my-react-page.js"
|
||||
import React from 'react';
|
||||
import Layout from '@theme/Layout';
|
||||
|
||||
export default function MyReactPage() {
|
||||
return (
|
||||
<Layout>
|
||||
<h1>My React page</h1>
|
||||
<p>This is a React page</p>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
A new page is now available at [http://localhost:3000/my-react-page](http://localhost:3000/my-react-page).
|
||||
|
||||
## Create your first Markdown Page
|
||||
|
||||
Create a file at `src/pages/my-markdown-page.md`:
|
||||
|
||||
```mdx title="src/pages/my-markdown-page.md"
|
||||
# My Markdown page
|
||||
|
||||
This is a Markdown page
|
||||
```
|
||||
|
||||
A new page is now available at [http://localhost:3000/my-markdown-page](http://localhost:3000/my-markdown-page).
|
||||
@ -1,31 +0,0 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# Deploy your site
|
||||
|
||||
Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**).
|
||||
|
||||
It builds your site as simple **static HTML, JavaScript and CSS files**.
|
||||
|
||||
## Build your site
|
||||
|
||||
Build your site **for production**:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
The static files are generated in the `build` folder.
|
||||
|
||||
## Deploy your site
|
||||
|
||||
Test your production build locally:
|
||||
|
||||
```bash
|
||||
npm run serve
|
||||
```
|
||||
|
||||
The `build` folder is now served at [http://localhost:3000/](http://localhost:3000/).
|
||||
|
||||
You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**).
|
||||
74
docs/docs/dev-docs/getting-started/local-setup.mdx
Normal file
74
docs/docs/dev-docs/getting-started/local-setup.mdx
Normal file
@ -0,0 +1,74 @@
|
||||
---
|
||||
sidebar_position: 0
|
||||
slug: '/'
|
||||
---
|
||||
|
||||
# Twenty
|
||||
|
||||
Welcome to Twenty documentation!
|
||||
|
||||
## High Level Overview
|
||||
|
||||
Twenty development stack is composed of 3 different layers
|
||||
|
||||
- front: our frontend React app
|
||||
- hasura: our graphql engine exposing our database and server
|
||||
- server: our backend that contain endpoint, crm logic, scripts, jobs...
|
||||
- storages: postgres
|
||||
|
||||
## Setup env variables and npmrc variables
|
||||
|
||||
1. `cp ./infra/dev/.env.example ./infra/dev/.env` and fill with values
|
||||
2. `cp ./front/.npmrc.example ./front/.npmrc` and fill with values
|
||||
|
||||
## Development environment setup with docker-compose (Recommended)
|
||||
|
||||
We also provide a containerized environment with Docker and orchestrated with docker-compose in case it is easier for you. This install will also provision a postgres container out of the box.
|
||||
|
||||
### Step 1: pre-requesites
|
||||
|
||||
Make sure to have the latest Docker and Docker-compose versions installed on your computer. You can run `docker-compose --version` to check if you have docker-compose installed and `docker --version` to check if you have docker installed.
|
||||
|
||||
### Step 2: docker build
|
||||
|
||||
Build docker containers.
|
||||
|
||||
The whole setup experience is happening in `infra/dev` folder. Make sure to be in this folder:
|
||||
|
||||
```
|
||||
cd infra/dev
|
||||
```
|
||||
|
||||
```
|
||||
make build
|
||||
make up
|
||||
```
|
||||
|
||||
Once this is completed you should have:
|
||||
|
||||
- front available on: http://localhost:3001
|
||||
- hasura available on: http://localhost:8080
|
||||
- server available on: http://localhost:3000/health
|
||||
- postgres: available on http://localhost:5432 that should contain `twenty` database
|
||||
|
||||
### Step 3: IDE setup
|
||||
|
||||
If you are using VSCode, please use the `Dev Containers` extension to open the project in a container. This will allow you to run Visual Studio on top of the docker container. This will allow you to run the project without having to install node on your machine.
|
||||
|
||||
### Note
|
||||
|
||||
If you are using Docker install, make sure to ssh in the docker container during development to execute commands. You can also use `Makefile` to help you
|
||||
|
||||
## Development workflow
|
||||
|
||||
### Front tests
|
||||
|
||||
Run tests: `make front-test`
|
||||
Run coverage: `make front-coverage`
|
||||
Run storybook: `make front-storybook`
|
||||
|
||||
### Hasura development
|
||||
|
||||
Open hasura console: `make hasura-console`
|
||||
Do your changes in hasura console on http://localhost:9695
|
||||
Commit your changes in git
|
||||
@ -1,150 +0,0 @@
|
||||
---
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# Markdown Features
|
||||
|
||||
Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**.
|
||||
|
||||
## Front Matter
|
||||
|
||||
Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/):
|
||||
|
||||
```text title="my-doc.md"
|
||||
// highlight-start
|
||||
---
|
||||
id: my-doc-id
|
||||
title: My document title
|
||||
description: My document description
|
||||
slug: /my-custom-url
|
||||
---
|
||||
// highlight-end
|
||||
|
||||
## Markdown heading
|
||||
|
||||
Markdown text with [links](./hello.md)
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
Regular Markdown links are supported, using url paths or relative file paths.
|
||||
|
||||
```md
|
||||
Let's see how to [Create a page](/create-a-page).
|
||||
```
|
||||
|
||||
```md
|
||||
Let's see how to [Create a page](./create-a-page.md).
|
||||
```
|
||||
|
||||
**Result:** Let's see how to [Create a page](./create-a-page.md).
|
||||
|
||||
## Images
|
||||
|
||||
Regular Markdown images are supported.
|
||||
|
||||
You can use absolute paths to reference images in the static directory (`static/img/docusaurus.png`):
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||

|
||||
|
||||
You can reference images relative to the current file as well. This is particularly useful to colocate images close to the Markdown files using them:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
## Code Blocks
|
||||
|
||||
Markdown code blocks are supported with Syntax highlighting.
|
||||
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
return (
|
||||
<h1>Hello, Docusaurus!</h1>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
```jsx title="src/components/HelloDocusaurus.js"
|
||||
function HelloDocusaurus() {
|
||||
return <h1>Hello, Docusaurus!</h1>;
|
||||
}
|
||||
```
|
||||
|
||||
## Admonitions
|
||||
|
||||
Docusaurus has a special syntax to create admonitions and callouts:
|
||||
|
||||
:::tip My tip
|
||||
|
||||
Use this awesome feature option
|
||||
|
||||
:::
|
||||
|
||||
:::danger Take care
|
||||
|
||||
This action is dangerous
|
||||
|
||||
:::
|
||||
|
||||
:::tip My tip
|
||||
|
||||
Use this awesome feature option
|
||||
|
||||
:::
|
||||
|
||||
:::danger Take care
|
||||
|
||||
This action is dangerous
|
||||
|
||||
:::
|
||||
|
||||
## MDX and React Components
|
||||
|
||||
[MDX](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**:
|
||||
|
||||
```jsx
|
||||
export const Highlight = ({children, color}) => (
|
||||
<span
|
||||
style={{
|
||||
backgroundColor: color,
|
||||
borderRadius: '20px',
|
||||
color: '#fff',
|
||||
padding: '10px',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
onClick={() => {
|
||||
alert(`You clicked the color ${color} with label ${children}`)
|
||||
}}>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
|
||||
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
|
||||
|
||||
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
|
||||
```
|
||||
|
||||
export const Highlight = ({children, color}) => (
|
||||
<span
|
||||
style={{
|
||||
backgroundColor: color,
|
||||
borderRadius: '20px',
|
||||
color: '#fff',
|
||||
padding: '10px',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
onClick={() => {
|
||||
alert(`You clicked the color ${color} with label ${children}`);
|
||||
}}>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
|
||||
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
|
||||
|
||||
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
|
||||
1
docs/docs/dev-docs/getting-started/self-hosting.mdx
Normal file
1
docs/docs/dev-docs/getting-started/self-hosting.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Self hosting
|
||||
@ -1,47 +0,0 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Tutorial Intro
|
||||
|
||||
Let's discover **Docusaurus in less than 5 minutes**.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Get started by **creating a new site**.
|
||||
|
||||
Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.
|
||||
|
||||
### What you'll need
|
||||
|
||||
- [Node.js](https://nodejs.org/en/download/) version 16.14 or above:
|
||||
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
|
||||
|
||||
## Generate a new site
|
||||
|
||||
Generate a new Docusaurus site using the **classic template**.
|
||||
|
||||
The classic template will automatically be added to your project after you run the command:
|
||||
|
||||
```bash
|
||||
npm init docusaurus@latest my-website classic
|
||||
```
|
||||
|
||||
You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.
|
||||
|
||||
The command also installs all necessary dependencies you need to run Docusaurus.
|
||||
|
||||
## Start your site
|
||||
|
||||
Run the development server:
|
||||
|
||||
```bash
|
||||
cd my-website
|
||||
npm run start
|
||||
```
|
||||
|
||||
The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there.
|
||||
|
||||
The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.
|
||||
|
||||
Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
|
||||
1
docs/docs/dev-docs/modules/README.mdx
Normal file
1
docs/docs/dev-docs/modules/README.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Modules
|
||||
4
docs/docs/dev-docs/modules/_category_.json
Normal file
4
docs/docs/dev-docs/modules/_category_.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Modules",
|
||||
"position": 4
|
||||
}
|
||||
1
docs/docs/dev-docs/modules/analytics.mdx
Normal file
1
docs/docs/dev-docs/modules/analytics.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Analytics
|
||||
1
docs/docs/dev-docs/modules/sales.mdx
Normal file
1
docs/docs/dev-docs/modules/sales.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Sales
|
||||
1
docs/docs/dev-docs/modules/third-party.mdx
Normal file
1
docs/docs/dev-docs/modules/third-party.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Third party
|
||||
1
docs/docs/dev-docs/modules/upcoming.mdx
Normal file
1
docs/docs/dev-docs/modules/upcoming.mdx
Normal file
@ -0,0 +1 @@
|
||||
# Upcoming
|
||||
5
docs/docs/dev-docs/others/CLI.mdx
Normal file
5
docs/docs/dev-docs/others/CLI.mdx
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
sidebar_class_name: coming-soon
|
||||
sidebar_custom_props:
|
||||
icon: terminal
|
||||
---
|
||||
5
docs/docs/dev-docs/others/SDKs.mdx
Normal file
5
docs/docs/dev-docs/others/SDKs.mdx
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
sidebar_class_name: coming-soon
|
||||
---
|
||||
|
||||
# SDKs
|
||||
4
docs/docs/dev-docs/others/_category_.json
Normal file
4
docs/docs/dev-docs/others/_category_.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Others",
|
||||
"position": 5
|
||||
}
|
||||
10
docs/docs/dev-docs/others/telemetry.mdx
Normal file
10
docs/docs/dev-docs/others/telemetry.mdx
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
sidebar_class_name: coming-soon
|
||||
---
|
||||
|
||||
|
||||
# Data collected
|
||||
...
|
||||
|
||||
# Opting-out of telemetry
|
||||
...
|
||||
7
docs/docs/dev-docs/others/troubleshooting.mdx
Normal file
7
docs/docs/dev-docs/others/troubleshooting.mdx
Normal file
@ -0,0 +1,7 @@
|
||||
# Troubleshotting
|
||||
|
||||
## Common issues and solutions
|
||||
...
|
||||
|
||||
## Reporting bugs
|
||||
...
|
||||
5
docs/docs/dev-docs/others/upgrade-guide.mdx
Normal file
5
docs/docs/dev-docs/others/upgrade-guide.mdx
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
sidebar_class_name: coming-soon
|
||||
---
|
||||
|
||||
# Upgrade guide
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"label": "Tutorial - Extras",
|
||||
"position": 3,
|
||||
"link": {
|
||||
"type": "generated-index"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB |
@ -1,55 +0,0 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Manage Docs Versions
|
||||
|
||||
Docusaurus can manage multiple versions of your docs.
|
||||
|
||||
## Create a docs version
|
||||
|
||||
Release a version 1.0 of your project:
|
||||
|
||||
```bash
|
||||
npm run docusaurus docs:version 1.0
|
||||
```
|
||||
|
||||
The `docs` folder is copied into `versioned_docs/version-1.0` and `versions.json` is created.
|
||||
|
||||
Your docs now have 2 versions:
|
||||
|
||||
- `1.0` at `http://localhost:3000/docs/` for the version 1.0 docs
|
||||
- `current` at `http://localhost:3000/docs/next/` for the **upcoming, unreleased docs**
|
||||
|
||||
## Add a Version Dropdown
|
||||
|
||||
To navigate seamlessly across versions, add a version dropdown.
|
||||
|
||||
Modify the `docusaurus.config.js` file:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
// highlight-start
|
||||
{
|
||||
type: 'docsVersionDropdown',
|
||||
},
|
||||
// highlight-end
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
The docs version dropdown appears in your navbar:
|
||||
|
||||

|
||||
|
||||
## Update an existing version
|
||||
|
||||
It is possible to edit versioned docs in their respective folder:
|
||||
|
||||
- `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello`
|
||||
- `docs/hello.md` updates `http://localhost:3000/docs/next/hello`
|
||||
@ -1,88 +0,0 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Translate your site
|
||||
|
||||
Let's translate `docs/intro.md` to French.
|
||||
|
||||
## Configure i18n
|
||||
|
||||
Modify `docusaurus.config.js` to add support for the `fr` locale:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
locales: ['en', 'fr'],
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Translate a doc
|
||||
|
||||
Copy the `docs/intro.md` file to the `i18n/fr` folder:
|
||||
|
||||
```bash
|
||||
mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/
|
||||
|
||||
cp docs/intro.md i18n/fr/docusaurus-plugin-content-docs/current/intro.md
|
||||
```
|
||||
|
||||
Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.md` in French.
|
||||
|
||||
## Start your localized site
|
||||
|
||||
Start your site on the French locale:
|
||||
|
||||
```bash
|
||||
npm run start -- --locale fr
|
||||
```
|
||||
|
||||
Your localized site is accessible at [http://localhost:3000/fr/](http://localhost:3000/fr/) and the `Getting Started` page is translated.
|
||||
|
||||
:::caution
|
||||
|
||||
In development, you can only use one locale at a same time.
|
||||
|
||||
:::
|
||||
|
||||
## Add a Locale Dropdown
|
||||
|
||||
To navigate seamlessly across languages, add a locale dropdown.
|
||||
|
||||
Modify the `docusaurus.config.js` file:
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
themeConfig: {
|
||||
navbar: {
|
||||
items: [
|
||||
// highlight-start
|
||||
{
|
||||
type: 'localeDropdown',
|
||||
},
|
||||
// highlight-end
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
The locale dropdown now appears in your navbar:
|
||||
|
||||

|
||||
|
||||
## Build your localized site
|
||||
|
||||
Build your site for a specific locale:
|
||||
|
||||
```bash
|
||||
npm run build -- --locale fr
|
||||
```
|
||||
|
||||
Or build your site to include all the locales at once:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
1205
docs/docs/open-api/openapi.yaml
Normal file
1205
docs/docs/open-api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
#test
|
||||
# Test
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
// @ts-check
|
||||
// Note: type annotations allow type checking and IDEs autocompletion
|
||||
|
||||
@ -19,6 +20,17 @@ const config = {
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'warn',
|
||||
|
||||
headTags: [
|
||||
{
|
||||
tagName: 'link',
|
||||
attributes: {
|
||||
rel: 'stylesheet',
|
||||
href: 'https://kit.fontawesome.com/c4eca3d765.css',
|
||||
crossorigin: 'anonymous'
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
// Even if you don't use internalization, you can use this field to set useful
|
||||
// metadata like html lang. For example, if your site is Chinese, you may want
|
||||
// to replace "en" with "zh-Hans".
|
||||
@ -33,16 +45,35 @@ const config = {
|
||||
({
|
||||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
// Please change this to your repo.
|
||||
// Remove this to remove the "edit this page" links.
|
||||
sidebarCollapsible: false,
|
||||
routeBasePath: '/',
|
||||
editUrl:
|
||||
'https://github.com/twentyhq/twenty/edit/main/docs/docs/',
|
||||
},
|
||||
blog: false,
|
||||
theme: {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
},
|
||||
}),
|
||||
|
||||
],
|
||||
[
|
||||
'redocusaurus',
|
||||
{
|
||||
// Plugin Options for loading OpenAPI files
|
||||
specs: [
|
||||
{
|
||||
spec: 'docs/open-api/openapi.yaml',
|
||||
route: '/api/',
|
||||
},
|
||||
],
|
||||
// Theme Options for modifying how redoc renders them
|
||||
theme: {
|
||||
// Change with your site colors
|
||||
primaryColor: '#1890ff',
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
|
||||
themeConfig:
|
||||
@ -74,10 +105,9 @@ const config = {
|
||||
label: 'User guide',
|
||||
},
|
||||
{
|
||||
type: 'docSidebar',
|
||||
sidebarId: 'APISidebar',
|
||||
position: 'right',
|
||||
to: '/api/',
|
||||
label: 'API',
|
||||
position: 'right'
|
||||
},
|
||||
{
|
||||
to: 'https://github.com/twentyhq/twenty/releases',
|
||||
|
||||
1033
docs/package-lock.json
generated
1033
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,8 @@
|
||||
"clsx": "^1.2.1",
|
||||
"prism-react-renderer": "^1.3.5",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
"react-dom": "^17.0.2",
|
||||
"redocusaurus": "^1.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.4.0",
|
||||
|
||||
@ -14,8 +14,7 @@
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
docsSidebar: [{type: 'autogenerated', dirName: 'dev-docs'}],
|
||||
userGuideSidebar: [{type: 'autogenerated', dirName: 'user-guide'}],
|
||||
APISidebar: [{type: 'autogenerated', dirName: 'api'}],
|
||||
userGuideSidebar: [{type: 'autogenerated', dirName: 'user-guide'}]
|
||||
};
|
||||
|
||||
module.exports = sidebars;
|
||||
|
||||
@ -10,11 +10,11 @@
|
||||
/* You can override the default Infima variables here. */
|
||||
:root {
|
||||
--ifm-global-radius: 8px;
|
||||
--ifm-code-font-size: var(14px);
|
||||
--ifm-code-font-size: 14px;
|
||||
--ifm-font-family-base: "Inter",BlinkMacSystemFont,-apple-system,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","Helvetica","Arial",sans-serif;
|
||||
--ifm-font-family-monospace: 'Roboto Mono',SFMono-Regular, Menlo, Monaco, Consolas,'Liberation Mono', 'Courier New', monospace;
|
||||
--ifm-font-size-base: var(14px);
|
||||
--ifm-base-spacing: 16px;
|
||||
--ifm-font-size-base: 14px;
|
||||
--ifm-base-spacing: 14px;
|
||||
--ifm-line-height-base: var(--twenty-body-regular-line-height);
|
||||
--ifm-font-weight-base: var(--twenty-body-regular-font-weight);
|
||||
--ifm-color-primary: #11181c;
|
||||
@ -25,6 +25,35 @@
|
||||
--ifm-toc-padding-vertical: 0.5rem;
|
||||
--ifm-breadcrumb-border-radius: 8px;
|
||||
--ifm-navbar-link-color: #687076;
|
||||
|
||||
|
||||
--ifm-heading-font-weight: 600;
|
||||
|
||||
--ifm-h1-font-size: 1.7rem !important;
|
||||
--ifm-h2-font-size: 1.25rem !important;
|
||||
--ifm-h3-font-size: 1rem !important;
|
||||
--ifm-h4-font-size: 0.875rem !important;
|
||||
--ifm-h5-font-size: 0.85rem !important;
|
||||
|
||||
--ifm-spacing-horizontal: 2rem;
|
||||
|
||||
--ifm-menu-link-padding-vertical: 0.2rem;
|
||||
}
|
||||
|
||||
.markdown > h1 {
|
||||
--ifm-h1-font-size: 1.7rem !important;
|
||||
}
|
||||
.markdown > h2 {
|
||||
--ifm-h2-font-size: 1.25rem;
|
||||
}
|
||||
.markdown > h3 {
|
||||
--ifm-h3-font-size: 1rem;
|
||||
}
|
||||
.markdown > h4 {
|
||||
--ifm-h4-font-size: 0.875rem;
|
||||
}
|
||||
.markdown > h5 {
|
||||
--ifm-h5-font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
||||
@ -41,7 +70,7 @@ body {
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.DocSearch-Button {
|
||||
@ -54,4 +83,49 @@ html {
|
||||
|
||||
.DocSearch-Button-Placeholder {
|
||||
padding: 0 100px 0 6px !important;
|
||||
}
|
||||
|
||||
.theme-edit-this-page {
|
||||
font-size: 70%;
|
||||
}
|
||||
.theme-edit-this-page svg {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
|
||||
li.coming-soon {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
li.coming-soon a {
|
||||
display: inline-block;
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
li.coming-soon a::after {
|
||||
float: right;
|
||||
content: "soon";
|
||||
border-color: #373737;
|
||||
border: 1px solid;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
float:right;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
padding-bottom: 2px;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
.menu__list-item-collapsible > a {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.theme-doc-sidebar-item-category {
|
||||
padding-top: 1.5rem;
|
||||
}
|
||||
|
||||
.sidebar-item-icon {
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
BIN
docs/src/img/mockup.png
Normal file
BIN
docs/src/img/mockup.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 666 KiB |
@ -1,23 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
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 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}>
|
||||
</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>
|
||||
);
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Markdown page example
|
||||
---
|
||||
|
||||
# Markdown page example
|
||||
|
||||
You don't need React to write simple standalone pages.
|
||||
50
docs/src/theme/DocSidebarItem/Link/index.js
Normal file
50
docs/src/theme/DocSidebarItem/Link/index.js
Normal file
@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import {ThemeClassNames} from '@docusaurus/theme-common';
|
||||
import {isActiveSidebarItem} from '@docusaurus/theme-common/internal';
|
||||
import Link from '@docusaurus/Link';
|
||||
import isInternalUrl from '@docusaurus/isInternalUrl';
|
||||
import IconExternalLink from '@theme/Icon/ExternalLink';
|
||||
import styles from './styles.module.css';
|
||||
export default function DocSidebarItemLink({
|
||||
item,
|
||||
onItemClick,
|
||||
activePath,
|
||||
level,
|
||||
index,
|
||||
...props
|
||||
}) {
|
||||
const {href, label, className, autoAddBaseUrl, customProps = {}} = item;
|
||||
const isActive = isActiveSidebarItem(item, activePath);
|
||||
const isInternalLink = isInternalUrl(href);
|
||||
return (
|
||||
<li
|
||||
className={clsx(
|
||||
ThemeClassNames.docs.docSidebarItemLink,
|
||||
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
||||
'menu__list-item',
|
||||
className,
|
||||
)}
|
||||
key={label}>
|
||||
<Link
|
||||
className={clsx(
|
||||
'menu__link',
|
||||
!isInternalLink && styles.menuExternalLink,
|
||||
{
|
||||
'menu__link--active': isActive,
|
||||
},
|
||||
)}
|
||||
autoAddBaseUrl={autoAddBaseUrl}
|
||||
aria-current={isActive ? 'page' : undefined}
|
||||
to={href}
|
||||
{...(isInternalLink && {
|
||||
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
||||
})}
|
||||
{...props}>
|
||||
<i className={"sidebar-item-icon fa-light " + (customProps && customProps.icon ? ("fa-"+customProps.icon) : "fa-notdef")}></i>
|
||||
{label}
|
||||
{!isInternalLink && <IconExternalLink />}
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
3
docs/src/theme/DocSidebarItem/Link/styles.module.css
Normal file
3
docs/src/theme/DocSidebarItem/Link/styles.module.css
Normal file
@ -0,0 +1,3 @@
|
||||
.menuExternalLink {
|
||||
align-items: center;
|
||||
}
|
||||
Reference in New Issue
Block a user