Skip to content

Commit

Permalink
setting up faq + detail component (#55)
Browse files Browse the repository at this point in the history
* commands page + detail component

* feat: add faq component

* Update faq.mdx
  • Loading branch information
nermalcat69 authored Sep 30, 2024
1 parent 7352ff2 commit f99580e
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 108 deletions.
16 changes: 9 additions & 7 deletions apps/docs/content/dotnet/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
16 changes: 9 additions & 7 deletions apps/docs/content/go/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
15 changes: 6 additions & 9 deletions apps/docs/content/help/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ Get quick answers to your related questions about Zerops from frequently asked q
### General

<FAQ>
<FAQItem>
<span>Where can I find the Zerops Dashboard GUI?</span>
<span>You can access the Zerops Dashboard GUI directly at <a href="https://app.zerops.io">app.zerops.io</a></span>
<FAQItem question="Where can I find the Zerops Dashboard GUI?">
You can access the Zerops Dashboard GUI directly at <a href="https://app.zerops.io">app.zerops.io</a>
</FAQItem>
<FAQItem>
<span>How much does it cost to get started?</span>
<span>It's free to get started, and no credit card is required! However, we recommend visiting our <a href="https://zerops.io/#pricing">pricing page</a> to explore the options that best suit your needs.</span>
<FAQItem question="How much does it cost to get started?">
It's free to get started, and no credit card is required! However, we recommend visiting our <a href="https://zerops.io/#pricing">pricing page</a> to explore the options that best suit your needs.
</FAQItem>
<FAQItem>
<span>I have more questions. Where can I reach out to get help?</span>
<span>You can reach us on our <a href="https://discord.gg/xxzmJSDKPT" target="_blank">Discord server</a> for support. For additional contact options, please visit our <a href="http://localhost:3001/help/contacts">contacts page</a>.</span>
<FAQItem question="I have more questions. Where can I reach out to get help?">
You can reach us on our <a href="https://discord.gg/xxzmJSDKPT" target="_blank">Discord server</a> for support. For additional contact options, please visit our <a href="http://localhost:3001/help/contacts">contacts page</a>.
</FAQItem>
</FAQ>

Expand Down
16 changes: 9 additions & 7 deletions apps/docs/content/java/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
16 changes: 9 additions & 7 deletions apps/docs/content/keydb/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
16 changes: 9 additions & 7 deletions apps/docs/content/mariadb/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
16 changes: 9 additions & 7 deletions apps/docs/content/nginx/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
16 changes: 9 additions & 7 deletions apps/docs/content/nodejs/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
16 changes: 9 additions & 7 deletions apps/docs/content/php/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
22 changes: 14 additions & 8 deletions apps/docs/content/postgresql/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<FAQ>
<FAQItem question="Why is my connection to PostgreSQL from a 3rd party software failing?">
*One of possible causes*: <br/>The connection string in Zerops always starts with <code>postgresql://</code>.

While the official PostgreSQL documentation states that both <code>postgresql://</code> and <code>postgres://</code> URIs are valid, some softwares require the shorter <code>postgres://</code> version.

To fix that, create your own environment variable with the correct URI, e.g. when your PostgreSQL service is called <code>db</code> - <code>postgres://`${db_user}`:`${db_password}`@`${db_hostname}`:`${db_port}`</code>.
</FAQItem>
</FAQ>

<details>
<summary>1. Connecting to PostgreSQL from a 3rd party software fails.</summary>
<p>
*One of possible causes*: <br/>The connection string in Zerops always starts with <code>postgresql://</code>. While the official PostgreSQL documentation states that both <code>postgresql://</code> and <code>postgres://</code> URIs are valid, some softwares require the shorter <code>postgres://</code> version.
<br/>To fix that, create your own environment variable with the correct URI, e.g. when your PostgreSQL service is called <code>db</code> - <code>postgres://`${db_user}`:`${db_password}`@`${db_hostname}`:`${db_port}`</code>.
</p>
</details>
16 changes: 9 additions & 7 deletions apps/docs/content/python/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
31 changes: 16 additions & 15 deletions apps/docs/content/references/cli/commands.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: zCLI commands
---
import { Detail } from "/src/components/Detail"


```sh
zcli [command]
Expand All @@ -24,8 +26,8 @@ Generate the autocompletion script for the specified shell.
zcli completion [command]
```

<details>
<summary>**Commands**</summary>

<Detail title="Commands">
### bash
Generate the autocompletion script for bash.

Expand Down Expand Up @@ -57,7 +59,8 @@ Generate the autocompletion script for zsh.

*Flags*:
* `--no-descriptions` - disables completion descriptions
</details>
</Detail>

## help
Help about any command
```sh
Expand All @@ -73,8 +76,8 @@ Project commands group.
```sh
zcli project [command]
```
<details>
<summary>**Commands**</summary>

<Detail title="Commands">
### delete
Deletes a project and all of its services.

Expand Down Expand Up @@ -105,7 +108,8 @@ Creates one or more Zerops services in an existing project.

*Flags*:
* `--projectId` *(string)* - if you have access to more than one project, you must specify the project ID for which the command is to be executed
</details>
</Detail>


## push
```sh
Expand All @@ -124,8 +128,7 @@ zcli push [flags]
```sh
zcli scope [command]
```
<details>
<summary>**Commands**</summary>
<Detail title="Commands">
### project
Sets the scope for project. All commands that require project ID will use the selected one.

Expand All @@ -135,14 +138,13 @@ Sets the scope for project. All commands that require project ID will use the se
Resets the scope for project and service.

`zcli scope reset`
</details>
</Detail>

## service
```sh
zcli service [command]
```
<details>
<summary>**Commands**</summary>
<Detail title="Commands">
### delete
Deletes the Zerops service.

Expand Down Expand Up @@ -253,7 +255,7 @@ Starts the Zerops service.
*Flags*:
* `--projectId` - If you have access to more than one project, you must specify the project ID for which the command is to be executed.
* `--serviceId` - If you have access to more than one service, you must specify the service ID for which the command is to be executed.
</details>
</Detail>

## show-debug-logs
```sh
Expand All @@ -268,8 +270,7 @@ zcli version
zcli vpn [command]
```

<details>
<summary>**Commands**</summary>
<Detail title="Commands">
### up
Connects to the Zerops VPN.

Expand All @@ -283,4 +284,4 @@ Connects to the Zerops VPN.
Disconnects from the Zerops VPN.

`zcli vpn down`
</details>
</Detail>
16 changes: 9 additions & 7 deletions apps/docs/content/rust/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# FAQ
---
title: Frequently Asked Questions
---
import { FAQ, FAQItem } from "/src/components/Faq"

<details>
<summary>1. SAMPLE QUESTION</summary>
<p>
sample answer
</p>
</details>
<FAQ>
<FAQItem question="Sample Question">
sample answer
</FAQItem>
</FAQ>
50 changes: 50 additions & 0 deletions apps/docs/src/components/Detail/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { ChevronDownMini, ChevronUpMini } from "@medusajs/icons";
import React, { ReactNode, useState, useRef, useEffect } from "react";

interface DetailProps {
title: string;
children: ReactNode;
}

export function Detail({ title, children }: DetailProps) {
const [isOpen, setIsOpen] = useState(false);
const contentRef = useRef<HTMLDivElement>(null);
const [height, setHeight] = useState<number | undefined>(0);

useEffect(() => {
if (isOpen && contentRef.current) {
setHeight(contentRef.current.scrollHeight); // Set height to the full scroll height when open
} else {
setHeight(0); // Reset height when closed
}
}, [isOpen]);

return (
<div className="py-0.5">
<div className="card bg-medusa-bg-subtle dark:bg-medusa-bg-base shadow-card-rest dark:shadow-card-rest-dark w-full py-1 px-0.5 rounded-md">
<button
className="flex w-full justify-between items-center text-left bg-transparent border-none cursor-pointer"
onClick={() => setIsOpen(!isOpen)}
aria-expanded={isOpen}
>
<span className="text-lg font-medium cursor-pointer">{title}</span>
{isOpen ? (
<ChevronUpMini className="text-gray-500" />
) : (
<ChevronDownMini className="text-gray-500" />
)}
</button>
<div
ref={contentRef}
className={`overflow-hidden transition-all duration-300 ease-in-out`}
style={{ height }}
role="region"
>
<div className={`px-0.75 py-0.75`}>
{children}
</div>
</div>
</div>
</div>
);
}
Loading

0 comments on commit f99580e

Please sign in to comment.