-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Implemented MDX component management for enhanced documentation capabilities. #22
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
08fac75
feat: Enable writing articles using MDX files
junkisai 99638e3
feat: Add mdx-components package
junkisai ba4829a
feat: Enable calling mdx-components in MDX files
junkisai acd6ee7
fix: clean debug code
junkisai 01b2b69
refactor: Integrate MDX components into service-site and remove separ…
junkisai 6fdf675
Merge branch 'main' into 2710/mdx-doc
junkisai 87ed714
chore: run pnpm gen before build
junkisai 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 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,3 +1,17 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "next/typescript"] | ||
"extends": ["next/core-web-vitals", "next/typescript"], | ||
"rules": { | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
"paths": [ | ||
{ | ||
"name": "next-contentlayer/hooks", | ||
"importNames": ["useMDXComponent"], | ||
"message": "Please use `import { MDXContent } from \"@/libs/contentlayer\"`" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -39,4 +39,7 @@ next-env.d.ts | |
.contentlayer | ||
|
||
# Storybook | ||
storybook-static | ||
storybook-static | ||
|
||
# typed-css-modules | ||
*.css.d.ts |
This file contains 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 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 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 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 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 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 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 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
11 changes: 11 additions & 0 deletions
11
frontend/apps/service-site/src/contents/components/Callout/Callout.module.css
This file contains 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,11 @@ | ||
.wrapper { | ||
width: 100%; | ||
padding: var(--spacing-4, 1rem); | ||
color: var(--callout-default-text, #bebfc1); | ||
background: var(--callout-default-background, rgba(255, 255, 255, 0.05)); | ||
} | ||
|
||
.danger { | ||
color: var(--callout-danger-text, #ea928e); | ||
background: var(--callout-danger-background, rgba(247, 80, 73, 0.1)); | ||
} |
22 changes: 22 additions & 0 deletions
22
frontend/apps/service-site/src/contents/components/Callout/Callout.stories.tsx
This file contains 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,22 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { Callout } from './' | ||
|
||
const StoryComponent = () => { | ||
return ( | ||
<Callout> | ||
No-code platforms are breaking down the barriers to innovation, allowing | ||
anyone with an idea to bring it to life without needing to write a single | ||
line of code. | ||
</Callout> | ||
) | ||
} | ||
|
||
const meta = { | ||
component: StoryComponent, | ||
} satisfies Meta<typeof StoryComponent> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = {} |
22 changes: 22 additions & 0 deletions
22
frontend/apps/service-site/src/contents/components/Callout/Callout.tsx
This file contains 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,22 @@ | ||
import clsx from 'clsx' | ||
import type { FC, PropsWithChildren } from 'react' | ||
import styles from './Callout.module.css' | ||
|
||
type Props = { | ||
type?: 'default' | 'danger' | ||
} | ||
|
||
export const Callout: FC<PropsWithChildren<Props>> = ({ | ||
type = 'default', | ||
children, | ||
}) => { | ||
return ( | ||
<div | ||
className={clsx(styles.wrapper, { | ||
[styles.danger]: type === 'danger', | ||
})} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
frontend/apps/service-site/src/contents/components/Callout/index.ts
This file contains 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 @@ | ||
export * from './Callout' |
This file contains 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 @@ | ||
export * from './Callout' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
frontend/apps/service-site/src/libs/contentlayer/MDXContent.tsx
This file contains 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,19 @@ | ||
import { Callout } from '@/contents/components' | ||
import type { MDXComponents } from 'mdx/types' | ||
// eslint-disable-next-line no-restricted-imports | ||
import { useMDXComponent } from 'next-contentlayer/hooks' | ||
import type { FC } from 'react' | ||
|
||
const mdxComponents: MDXComponents = { | ||
Callout: (props) => <Callout {...props} />, | ||
} | ||
|
||
type Props = { | ||
code: string | ||
} | ||
|
||
export const MDXContent: FC<Props> = ({ code }) => { | ||
const Content = useMDXComponent(code) | ||
|
||
return <Content components={mdxComponents} /> | ||
} |
This file contains 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 @@ | ||
export * from './MDXContent' |
This file contains 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 |
---|---|---|
|
@@ -10,8 +10,9 @@ | |
}, | ||
"packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b", | ||
"devDependencies": { | ||
"concurrently": "^9.0.1", | ||
"syncpack": "^13.0.0", | ||
"turbo": "^2.1.2", | ||
"@turbo/gen": "^2.1.2" | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.
🚀