Skip to content

Commit 2573c9d

Browse files
committed
fix: header style, drop animation, card component
1 parent ae2c458 commit 2573c9d

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed

packages/markdown-editor/src/components/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function Header({ flatDirectories, items }: NavBarProps): ReactElement {
8484
'contrast-more:nx-shadow-[0_0_0_1px_#000] contrast-more:dark:nx-shadow-[0_0_0_1px_#fff]',
8585
)}
8686
>
87-
<nav className="nx-ml-[320px] nx-flex nx-h-[var(--nextra-navbar-height)] nx-max-w-[120rem] nx-items-center nx-justify-end nx-gap-2">
87+
<nav className="nx-ml-[20px] nx-mr-[24px] nx-flex nx-h-[var(--nextra-navbar-height)] nx-items-center nx-justify-end nx-gap-2">
8888
{config.logoLink ? (
8989
<Anchor
9090
href={typeof config.logoLink === 'string' ? config.logoLink : '/'}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { defaultDropAnimation, DropAnimation } from '@dnd-kit/core'
1+
import type { DropAnimation } from '@dnd-kit/core'
22
import { CSS } from '@dnd-kit/utilities'
33

44
export const dropAnimation: DropAnimation = {
55
keyframes({ transform }) {
66
return [
7-
{ opacity: 1, transform: CSS.Transform.toString(transform.initial) },
7+
{ opacity: 0, transform: CSS.Transform.toString(transform.initial) },
88
{
99
opacity: 0,
10-
transform: CSS.Transform.toString({
11-
...transform.final,
12-
x: transform.final.x + 5,
13-
y: transform.final.y + 5,
14-
}),
10+
// transform: CSS.Transform.toString({
11+
// ...transform.final,
12+
// x: transform.final.x + 5,
13+
// y: transform.final.y + 5,
14+
// }),
1515
},
1616
]
1717
},
18-
easing: 'ease-out',
19-
sideEffects({ active }) {
20-
active.node.animate([{ opacity: 0 }, { opacity: 1 }], {
21-
duration: defaultDropAnimation.duration,
22-
easing: defaultDropAnimation.easing,
23-
})
24-
},
18+
// easing: 'ease-out',
19+
// sideEffects({ active }) {
20+
// active.node.animate([{ opacity: 0 }, { opacity: 0 }], {
21+
// duration: defaultDropAnimation.duration,
22+
// easing: defaultDropAnimation.easing,
23+
// })
24+
// },
2525
}

packages/markdown-editor/src/mdx-compiler.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,25 @@ export const mdxCompiler = async (
139139
return result
140140
} catch (error: any) {
141141
if (process.env.NODE_ENV === 'development') {
142-
console.log('Failed to compile source', error)
142+
console.log('Failed to compile source as mdx', error)
143143
}
144-
const result = await serialize(content, {
145-
mdxOptions: {
146-
format: 'md',
147-
development: false,
148-
remarkPlugins,
149-
rehypePlugins,
150-
},
151-
})
152144

153-
return result
145+
try {
146+
const result = await serialize(content, {
147+
mdxOptions: {
148+
format: 'md',
149+
development: false,
150+
remarkPlugins,
151+
rehypePlugins,
152+
},
153+
})
154+
155+
return result
156+
} catch (error) {
157+
if (process.env.NODE_ENV === 'development') {
158+
console.log('Failed to compile source as md', error)
159+
}
160+
return null
161+
}
154162
}
155163
}

packages/markdown-editor/src/nextra/components/cards.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ export function Card({
2929
icon,
3030
image,
3131
arrow,
32-
href,
32+
href = '/',
3333
...props
3434
}: {
3535
children: ReactNode
3636
title: string
3737
icon: ReactNode
3838
image?: boolean
3939
arrow?: boolean
40-
href: string
40+
href?: string
4141
}) {
4242
const animatedArrow = arrow ? arrowEl : null
4343

packages/markdown-editor/style.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)