Don't wrap custom component with p
#1603
Answered
by
ChristianMurphy
deadcoder0904
asked this question in
Q&A
-
I am making a <Sidenote type="info">
The source file name(s) are larger than is supported by the file system. Try moving to a location
which has a shorter path name, or try renaming to shorter name(s) before attempting this operation
</Sidenote> And the code for it looks like: import React from 'react'
import { InformationCircleIcon, ExclamationIcon, XCircleIcon } from '@heroicons/react/outline'
import clsx from 'clsx'
interface ISidenote {
title?: string
type: 'info' | 'warning' | 'error'
children: React.ReactChild
}
export const Sidenote = ({ title, type = 'info', children }: ISidenote) => {
return (
<div
className={clsx('border-[1px] bg-[hsl(0deg 0% 8%)] rounded-md', {
'dark:border-red-400': type === 'error',
'dark:border-yellow-400': type === 'warning',
'dark:border-blue-400': type === 'info',
})}
role="alert"
>
<div
className={clsx('flex items-center p-4', {
'dark:bg-error': type === 'error',
'dark:bg-warning': type === 'warning',
'text-blue-900 bg-blue-100 dark:bg-info': type === 'info',
})}
>
{type === 'info' && (
<InformationCircleIcon className="text-blue-400 w-28 h-28" aria-hidden="true" />
)}
{type === 'warning' && (
<ExclamationIcon className="text-yellow-400 w-28 h-28" aria-hidden="true" />
)}
{type === 'error' && <XCircleIcon className="text-red-400 w-28 h-28" aria-hidden="true" />}
<div className="ml-3">
{title && <h3 className="text-sm font-medium">{title}</h3>}
<div className="mt-2 text-sm text-blue-900">{children}</div>
</div>
</div>
</div>
)
} Notice, the How can I do that? |
Beta Was this translation helpful? Give feedback.
Answered by
ChristianMurphy
Jul 30, 2021
Replies: 1 comment 7 replies
-
Examples of how to do this in MDX 1 https://codesandbox.io/s/mdx-1-no-paragraph-0wst7 and MDX 2 https://codesandbox.io/s/mdx-2-no-paragraph-lituo |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
ChristianMurphy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples of how to do this in MDX 1 https://codesandbox.io/s/mdx-1-no-paragraph-0wst7 and MDX 2 https://codesandbox.io/s/mdx-2-no-paragraph-lituo