-
Notifications
You must be signed in to change notification settings - Fork 214
Components pages docs offsite overhaul #633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
801eda7
update accordions examples and add new page for custom components info
lawreka 637d90b
update callouts boxes examples
lawreka bc1f234
cards and callouts
lawreka cb6dcc4
update icons and tabs
lawreka 92bdbc1
fix tab example syntax
lawreka 02f5075
add response fields and move reusable snippets components to componen…
lawreka 7878ca6
Update content/components/cards.mdx
lawreka 2e62c00
Update content/components/responses.mdx
lawreka 0f87822
Update content/components/responses.mdx
lawreka fb1487f
move accordiongroups link below props
lawreka 4465d06
add props header for accordion groups
lawreka aa796bd
nits
hahnbeelee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,37 @@ | ||
| --- | ||
| title: "Accordions" | ||
| description: "A dropdown component to toggle content" | ||
| description: "A dropdown component to toggle content visibility" | ||
| icon: "square-caret-down" | ||
| --- | ||
|
|
||
| <Accordion title="I am an Accordion."> | ||
| You can put any content in here. Check out | ||
| [AccordionGroup](/content/components/accordion-groups) if you want to group | ||
| multiple Accordions into a single display. | ||
| You can put any content in here, including other components, like code: | ||
| ```java HelloWorld.java | ||
| class HelloWorld { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello, World!"); | ||
| } | ||
| } | ||
| ``` | ||
| </Accordion> | ||
|
|
||
| Check out [AccordionGroup](/content/components/accordion-groups) if you want to group multiple Accordions into a single display. | ||
|
||
|
|
||
| <RequestExample> | ||
|
|
||
| ```jsx Accordion Example | ||
| ````jsx Accordion Example | ||
| <Accordion title="I am an Accordion."> | ||
| You can put any content in here. | ||
| You can put any content in here, including other components, like code: | ||
|
|
||
| ```java HelloWorld.java | ||
| class HelloWorld { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello, World!"); | ||
| } | ||
| } | ||
| ``` | ||
| </Accordion> | ||
| ``` | ||
| ```` | ||
|
|
||
| </RequestExample> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: "Reusable Components" | ||
| description: "Reusable, custom component snippets" | ||
| icon: "recycle" | ||
| --- | ||
|
|
||
| Much like custom content [snippets](/reusable-snippets) that can be added in MDX files, you can add reusable components as snippets. | ||
|
|
||
| ## Creating a reusable React component | ||
|
|
||
| 1. Inside your snippet file, create a component that takes in props by exporting your component in the form of an arrow function. | ||
|
|
||
| ```typescript snippets/custom-component.mdx | ||
| export const MyComponent = ({ title }) => ( | ||
| <div> | ||
| <h1>{title}</h1> | ||
| <p>... snippet content ...</p> | ||
| </div> | ||
| ); | ||
| ``` | ||
|
|
||
| <Warning> | ||
| MDX does not compile inside the body of an arrow function. Stick to HTML | ||
| syntax when you can or use a default export if you need to use MDX inside of your component. | ||
| </Warning> | ||
|
|
||
| 2. Import the snippet into your destination file and pass in the props | ||
|
|
||
| ```typescript destination-file.mdx | ||
| --- | ||
| title: My title | ||
| description: My Description | ||
| --- | ||
|
|
||
| import { MyComponent } from '/snippets/custom-component.mdx'; | ||
|
|
||
| Lorem ipsum dolor sit amet. | ||
|
|
||
| <MyComponent title={'Custom title'} /> | ||
| ``` | ||
|
|
||
|
|
||
| ## Client-Side Content | ||
|
|
||
| By default, Mintlify employs server-side rendering, generating content | ||
| at build time. For client-side content loading, ensure to verify the | ||
| `document` object's availability before initiating the rendering process. | ||
|
|
||
| ```typescript snippets/client-component.mdx | ||
| {/* `setTimeout` simulates a React.useEffect, which is called after the component is mounted. */} | ||
| export const ClientComponent = () => { | ||
| if (typeof document === "undefined") { | ||
| return null; | ||
| } else { | ||
| setTimeout(() => { | ||
| const clientComponent = document.getElementById("client-component"); | ||
| if (clientComponent) { | ||
| clientComponent.innerHTML = "Hello, client-side component!"; | ||
| } | ||
| }, 1); | ||
|
|
||
| return <div id="client-component"></div> | ||
| } | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the
## Propsheader above "AccordionGroup does not have props" just so it's all aligned in terms of how it's structured?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 4465d06