mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
fix(docs): fix all line and link overflow issues (#426)
This commit is contained in:
@@ -1,34 +1,44 @@
|
||||
import type { JSX, AnchorHTMLAttributes } from 'react'
|
||||
import { Button } from '@mantine/core'
|
||||
import type { JSX, AnchorHTMLAttributes, ReactNode } from 'react'
|
||||
import { Anchor } from '@mantine/core'
|
||||
import { Link } from 'tuono'
|
||||
import { IconExternalLink } from '@tabler/icons-react'
|
||||
|
||||
export default function MdxLink(
|
||||
props: AnchorHTMLAttributes<HTMLAnchorElement>,
|
||||
): JSX.Element {
|
||||
interface MdxLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export default function MdxLink(props: MdxLinkProps): JSX.Element {
|
||||
if (props.href?.startsWith('http') || props.href?.startsWith('mailto')) {
|
||||
return (
|
||||
<Button
|
||||
component="a"
|
||||
<Anchor
|
||||
{...props}
|
||||
target="_blank"
|
||||
rightSection={
|
||||
<IconExternalLink size="16px" style={{ marginLeft: -5 }} />
|
||||
}
|
||||
variant="transparent"
|
||||
style={{ height: '20px' }}
|
||||
display="inline"
|
||||
style={{ fontWeight: 600 }}
|
||||
mt={-2}
|
||||
p={0}
|
||||
/>
|
||||
>
|
||||
{props.children}
|
||||
<IconExternalLink
|
||||
size="16px"
|
||||
style={{
|
||||
marginLeft: '4px',
|
||||
display: 'inline-block',
|
||||
transform: 'translateY(2px)',
|
||||
}}
|
||||
/>
|
||||
</Anchor>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
<Anchor
|
||||
component={Link}
|
||||
{...props}
|
||||
target="_blank"
|
||||
variant="transparent"
|
||||
style={{ height: '20px' }}
|
||||
display="inline"
|
||||
style={{ fontWeight: 600 }}
|
||||
mt={-2}
|
||||
p={0}
|
||||
/>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
.pre {
|
||||
code {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
import type { JSX } from 'react'
|
||||
import { CodeHighlight } from '@mantine/code-highlight'
|
||||
|
||||
import styles from './MdxPre.module.css'
|
||||
|
||||
interface PreProps {
|
||||
children: {
|
||||
props: {
|
||||
@@ -15,7 +13,6 @@ interface PreProps {
|
||||
export default function MdxPre({ children }: PreProps): JSX.Element {
|
||||
return (
|
||||
<CodeHighlight
|
||||
className={styles.pre}
|
||||
code={children.props.children || ''}
|
||||
style={{ borderRadius: 8, fontWeight: 100 }}
|
||||
language={children.props.className?.replace('language-', '')}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
.wrapper {
|
||||
width: calc(100% - 220px);
|
||||
word-wrap: break-word;
|
||||
|
||||
/* var(--mantine-breakpoint-md) = 62em */
|
||||
@media (max-width: 62em) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -6,20 +6,27 @@ import TableOfContents from '@/components/TableOfContents'
|
||||
import EditPage from '../EditPage'
|
||||
import MdxProvider from '../MdxProvider'
|
||||
|
||||
import classes from './MdxWrapper.module.css'
|
||||
|
||||
interface MdxWrapperProps {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export function MdxWrapper({ children }: MdxWrapperProps): JSX.Element {
|
||||
return (
|
||||
<Container size={1000} w="100%" display="flex" style={{ gap: 12 }}>
|
||||
<Container
|
||||
size={1000}
|
||||
w="100%"
|
||||
display="flex"
|
||||
style={{ gap: 12, justifyContent: 'space-between' }}
|
||||
>
|
||||
<Box
|
||||
id="mdx-root"
|
||||
component="article"
|
||||
mt="xl"
|
||||
px={16}
|
||||
py={36}
|
||||
style={{ maxWidth: '100%' }}
|
||||
className={classes.wrapper}
|
||||
>
|
||||
<MdxProvider>{children}</MdxProvider>
|
||||
<EditPage />
|
||||
|
||||
Reference in New Issue
Block a user