feat: add support for hooks in changelogs
Signed-off-by: Antony Bouyon <antony.bouyon@believe.com>
This commit is contained in:
@@ -1,16 +1,22 @@
|
||||
import { changelog } from '@/utils/changelog';
|
||||
import { MDXRemote } from 'next-mdx-remote-client/rsc';
|
||||
import { formattedMDXComponents } from '@/mdx-components';
|
||||
import type { Component } from '@/utils/changelog';
|
||||
import type { Component, Hook } from '@/utils/changelog';
|
||||
import {
|
||||
Badge,
|
||||
BreakingBadge,
|
||||
generateChangelogMarkdown,
|
||||
} from '../Changelog/utils';
|
||||
|
||||
export const ChangelogComponent = ({ component }: { component: Component }) => {
|
||||
const componentChangelog = changelog.filter(c =>
|
||||
c.components.includes(component),
|
||||
export const ChangelogComponent = ({
|
||||
component,
|
||||
hook,
|
||||
}: {
|
||||
component: Component;
|
||||
hook: Hook;
|
||||
}) => {
|
||||
const componentChangelog = changelog.filter(
|
||||
c => c.components?.includes(component) || c.hooks?.includes(hook),
|
||||
);
|
||||
|
||||
const content = `## Changelog
|
||||
|
||||
@@ -35,14 +35,22 @@ export type Component =
|
||||
| 'tooltip'
|
||||
| 'visually-hidden';
|
||||
|
||||
export type Hook = 'use-breakpoint';
|
||||
|
||||
export type Version = `${number}.${number}.${number}`;
|
||||
|
||||
export interface ChangelogProps {
|
||||
components: Component[];
|
||||
type AtLeastOne<T, K extends keyof T = keyof T> = K extends string
|
||||
? Pick<T, K> & Partial<Omit<T, K>>
|
||||
: never;
|
||||
|
||||
export type ChangelogProps = {
|
||||
description: string;
|
||||
version: Version;
|
||||
prs: string[];
|
||||
breaking?: boolean;
|
||||
commitSha?: string;
|
||||
migration?: string;
|
||||
}
|
||||
} & AtLeastOne<{
|
||||
components: Component[];
|
||||
hooks: Hook[];
|
||||
}>;
|
||||
|
||||
Reference in New Issue
Block a user