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 type { JSX, AnchorHTMLAttributes, ReactNode } from 'react'
|
||||||
import { Button } from '@mantine/core'
|
import { Anchor } from '@mantine/core'
|
||||||
import { Link } from 'tuono'
|
import { Link } from 'tuono'
|
||||||
import { IconExternalLink } from '@tabler/icons-react'
|
import { IconExternalLink } from '@tabler/icons-react'
|
||||||
|
|
||||||
export default function MdxLink(
|
interface MdxLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||||
props: AnchorHTMLAttributes<HTMLAnchorElement>,
|
children: ReactNode
|
||||||
): JSX.Element {
|
}
|
||||||
|
|
||||||
|
export default function MdxLink(props: MdxLinkProps): JSX.Element {
|
||||||
if (props.href?.startsWith('http') || props.href?.startsWith('mailto')) {
|
if (props.href?.startsWith('http') || props.href?.startsWith('mailto')) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Anchor
|
||||||
component="a"
|
|
||||||
{...props}
|
{...props}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rightSection={
|
|
||||||
<IconExternalLink size="16px" style={{ marginLeft: -5 }} />
|
|
||||||
}
|
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
style={{ height: '20px' }}
|
display="inline"
|
||||||
|
style={{ fontWeight: 600 }}
|
||||||
mt={-2}
|
mt={-2}
|
||||||
p={0}
|
p={0}
|
||||||
/>
|
>
|
||||||
|
{props.children}
|
||||||
|
<IconExternalLink
|
||||||
|
size="16px"
|
||||||
|
style={{
|
||||||
|
marginLeft: '4px',
|
||||||
|
display: 'inline-block',
|
||||||
|
transform: 'translateY(2px)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Anchor>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Button
|
<Anchor
|
||||||
component={Link}
|
component={Link}
|
||||||
{...props}
|
{...props}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
style={{ height: '20px' }}
|
display="inline"
|
||||||
|
style={{ fontWeight: 600 }}
|
||||||
mt={-2}
|
mt={-2}
|
||||||
p={0}
|
p={0}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
.pre {
|
|
||||||
code {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import type { JSX } from 'react'
|
import type { JSX } from 'react'
|
||||||
import { CodeHighlight } from '@mantine/code-highlight'
|
import { CodeHighlight } from '@mantine/code-highlight'
|
||||||
|
|
||||||
import styles from './MdxPre.module.css'
|
|
||||||
|
|
||||||
interface PreProps {
|
interface PreProps {
|
||||||
children: {
|
children: {
|
||||||
props: {
|
props: {
|
||||||
@@ -15,7 +13,6 @@ interface PreProps {
|
|||||||
export default function MdxPre({ children }: PreProps): JSX.Element {
|
export default function MdxPre({ children }: PreProps): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<CodeHighlight
|
<CodeHighlight
|
||||||
className={styles.pre}
|
|
||||||
code={children.props.children || ''}
|
code={children.props.children || ''}
|
||||||
style={{ borderRadius: 8, fontWeight: 100 }}
|
style={{ borderRadius: 8, fontWeight: 100 }}
|
||||||
language={children.props.className?.replace('language-', '')}
|
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 EditPage from '../EditPage'
|
||||||
import MdxProvider from '../MdxProvider'
|
import MdxProvider from '../MdxProvider'
|
||||||
|
|
||||||
|
import classes from './MdxWrapper.module.css'
|
||||||
|
|
||||||
interface MdxWrapperProps {
|
interface MdxWrapperProps {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MdxWrapper({ children }: MdxWrapperProps): JSX.Element {
|
export function MdxWrapper({ children }: MdxWrapperProps): JSX.Element {
|
||||||
return (
|
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
|
<Box
|
||||||
id="mdx-root"
|
id="mdx-root"
|
||||||
component="article"
|
component="article"
|
||||||
mt="xl"
|
mt="xl"
|
||||||
px={16}
|
px={16}
|
||||||
py={36}
|
py={36}
|
||||||
style={{ maxWidth: '100%' }}
|
className={classes.wrapper}
|
||||||
>
|
>
|
||||||
<MdxProvider>{children}</MdxProvider>
|
<MdxProvider>{children}</MdxProvider>
|
||||||
<EditPage />
|
<EditPage />
|
||||||
|
|||||||
Reference in New Issue
Block a user