-
-
Notifications
You must be signed in to change notification settings - Fork 786
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Innei <[email protected]>
- Loading branch information
Showing
39 changed files
with
1,061 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ | |
"markdown-escape": "2.0.0", | ||
"markdown-to-jsx": "npm:@innei/[email protected]", | ||
"mdast-util-toc": "6.1.1", | ||
"medium-zoom": "1.0.8", | ||
"next": "13.4.6", | ||
"next-themes": "0.2.1", | ||
"react": "18.2.0", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
'use client' | ||
|
||
export default ({ error, reset }: any) => { | ||
return ( | ||
<html> | ||
<body> | ||
<div>Something went wrong</div> | ||
</body> | ||
</html> | ||
) | ||
return <div>Something went wrong</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { useEffect, useRef, useState } from 'react' | ||
import { motion } from 'framer-motion' | ||
|
||
import { clsxm } from '~/utils/helper' | ||
|
||
interface AnimateChangeInHeightProps { | ||
children: React.ReactNode | ||
className?: string | ||
duration?: number | ||
} | ||
|
||
export const AutoResizeHeight: React.FC<AnimateChangeInHeightProps> = ({ | ||
children, | ||
className, | ||
duration = 0.6, | ||
}) => { | ||
const containerRef = useRef<HTMLDivElement | null>(null) | ||
const [height, setHeight] = useState<number | 'auto'>('auto') | ||
|
||
useEffect(() => { | ||
if (containerRef.current) { | ||
const resizeObserver = new ResizeObserver((entries) => { | ||
// We only have one entry, so we can use entries[0]. | ||
const observedHeight = entries[0].contentRect.height | ||
setHeight(observedHeight) | ||
}) | ||
|
||
resizeObserver.observe(containerRef.current) | ||
|
||
return () => { | ||
// Cleanup the observer when the component is unmounted | ||
resizeObserver.disconnect() | ||
} | ||
} | ||
}, []) | ||
|
||
return ( | ||
<motion.div | ||
className={clsxm('overflow-hidden', className)} | ||
style={{ height }} | ||
animate={{ height }} | ||
transition={{ duration }} | ||
> | ||
<div ref={containerRef}>{children}</div> | ||
</motion.div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
src/components/layout/header/internal/HeaderActionButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
export const HeaderActionButton: Component<JSX.IntrinsicElements['button']> = ({ | ||
children, | ||
...rest | ||
}) => { | ||
import { forwardRef } from 'react' | ||
import type { ForwardRefComponent } from 'framer-motion' | ||
|
||
export const HeaderActionButton: ForwardRefComponent< | ||
HTMLButtonElement, | ||
JSX.IntrinsicElements['button'] | ||
> = forwardRef(({ children, ...rest }, ref) => { | ||
return ( | ||
<button | ||
className="group h-10 rounded-full bg-gradient-to-b from-zinc-50/50 to-white/90 px-3 text-sm shadow-lg shadow-zinc-800/5 ring-1 ring-zinc-900/5 backdrop-blur transition dark:from-zinc-900/50 dark:to-zinc-800/90 dark:ring-white/10 dark:hover:ring-white/20" | ||
{...rest} | ||
ref={ref} | ||
> | ||
{children} | ||
</button> | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.