mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-09 08:12:28 +03:00
move website to own directory
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// import Link from 'next/link';
|
||||
import type { ComponentProps } from 'react';
|
||||
|
||||
export interface HeadingProps extends ComponentProps<'h1'> {
|
||||
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
||||
}
|
||||
|
||||
export const Heading = ({ id, tag: Tag, ...rest }: HeadingProps) => {
|
||||
if (id) {
|
||||
return (
|
||||
<>
|
||||
{/* <Link href={`/#${id}`} scroll={false}> */}
|
||||
{/* eslint-disable-next-line */}
|
||||
<Tag {...rest} />
|
||||
{/* </Link> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
/* eslint-disable-next-line */
|
||||
return <Tag {...rest} />;
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { OverlayScrollbars } from '@~package/overlayscrollbars';
|
||||
import type { ComponentProps } from 'react';
|
||||
|
||||
export const Pre = ({ children }: ComponentProps<'pre'>) => {
|
||||
const ref = useRef(null);
|
||||
useEffect(() => {
|
||||
if (ref.current) {
|
||||
const instance = OverlayScrollbars(ref.current, {
|
||||
paddingAbsolute: true,
|
||||
scrollbars: { autoHide: 'leave' },
|
||||
});
|
||||
return () => instance.destroy();
|
||||
}
|
||||
});
|
||||
return <pre ref={ref}>{children}</pre>;
|
||||
};
|
||||
Reference in New Issue
Block a user