Skip to content
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

Create author.mdx #384

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/author/author.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
To author a page using MDX in Mosaic and showcase commonly used components such as Callout and Tile, follow these steps:

1. Install dependencies: Ensure you have Node.js and npm installed on your machine. Then, navigate to the root directory of the cloned `mosaic` repository and run the following command to install the necessary dependencies:

```bash
npm install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use yarn as the package manager not npm

```

2. Create a new MDX page: In the `docs` directory of the `mosaic` repository, create a new MDX file with a `.mdx` extension. For example, `my-page.mdx`.

3. Author the page using MDX syntax: Open the newly created `.mdx` file in a text editor and use MDX syntax to write the content. You can include Markdown and Mosaic components in the document. Here's an example:

```mdx
import { Callout, Tile } from '@jpmorganchase/mosaic';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be from @jpmorganchase/mosaic-components


# My Page

This is an example page written in MDX using Mosaic components.

## Callout Component

<Callout variant="info">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no "info" variant for the Callout component

This is an informational callout.
</Callout>

## Tile Component

<Tile title="Tile 1">
This is the content of Tile 1.
</Tile>

<Tile title="Tile 2">
This is the content of Tile 2.
</Tile>
```

In this example, the `Callout` and `Tile` components are imported from `@jpmorganchase/mosaic` and used within the MDX document. You can include any other commonly used components in a similar manner.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong package name again, should be from @jpmorganchase/mosaic-components


4. Add the page to the sidebar: To display the newly created page in the sidebar navigation, you need to update the `sidebars.js` file located in the `.vuepress` directory. Open the `sidebars.js` file and add an entry for your page, specifying the title and file path. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of this is required....the page will be found by the SidebarPlugn.

Also not clear why you mention .vuepress directory?


```javascript
module.exports = {
// other sidebar entries
'Guide': [
// other guide entries
'docs/my-page'
],
};
```

5. Start the development server: Run the following command in the root directory of the `mosaic` repository to start the development server:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be targeting how you would write a doc for this repo but it should be targeted at people who have generated a new mosaic site.


```bash
npm run dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mosaic sites should be run locally using yarn serve as this starts up both the site and the mosaic filesystem

```

This command will start the server and generate the static site. You can then view the site in your browser by navigating to `http://localhost:8080`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • does not generate a static site.
  • localhost:8080 is the filesystem instance url
  • the site is available at http://localhost:3000

Might want to direct people to the page they just authored as it is likely to be want they most want to see.


6. View the authored page: Once the development server is running, you can access the page you created by clicking on the sidebar navigation link. The MDX content will be rendered with the specified Mosaic components.

Note: The example provided assumes that the `mosaic` repository uses MDX2 for creating documents. Please refer to the repository's documentation or the specific project requirements to ensure the correct version and usage of MDX.