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

feat(docs): update callouts to include icon attribute #1597

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Changes from 2 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
52 changes: 36 additions & 16 deletions packages/ui/app/src/mdx/components/callout/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,65 +101,85 @@ export const Callout: FC<PropsWithChildren<Callout.Props>> = ({ intent: intentRa

// aliases

export function InfoCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function InfoCallout({ children, title, icon }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can also just spread the props in case new props are ever added in the future

change { children, title, icon } to { children, ...props }

<Callout intent="info" {...props}>
  {children}
</Callout>

return (
<Callout intent="info" title={title}>
<Callout intent="info" title={title} icon={icon}>
{children}
</Callout>
);
}

export function WarningCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function WarningCallout({
children,
title,
icon,
}: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="warning" title={title}>
<Callout intent="warning" title={title} icon={icon}>
{children}
</Callout>
);
}

export function SuccessCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function SuccessCallout({
children,
title,
icon,
}: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="success" title={title}>
<Callout intent="success" title={title} icon={icon}>
{children}
</Callout>
);
}

export function ErrorCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function ErrorCallout({
children,
title,
icon,
}: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="error" title={title}>
<Callout intent="error" title={title} icon={icon}>
{children}
</Callout>
);
}

export function NoteCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function NoteCallout({ children, title, icon }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="note" title={title}>
<Callout intent="note" title={title} icon={icon}>
{children}
</Callout>
);
}

export function LaunchNoteCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function LaunchNoteCallout({
children,
title,
icon,
}: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="launch" title={title}>
<Callout intent="launch" title={title} icon={icon}>
{children}
</Callout>
);
}

export function TipCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function TipCallout({ children, title, icon }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="tip" title={title}>
<Callout intent="tip" title={title} icon={icon}>
{children}
</Callout>
);
}

export function CheckCallout({ children, title }: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
export function CheckCallout({
children,
title,
icon,
}: PropsWithChildren<Omit<Callout.Props, "intent">>): ReactElement {
return (
<Callout intent="check" title={title}>
<Callout intent="check" title={title} icon={icon}>
{children}
</Callout>
);
Expand Down
Loading