|
@@ -1,8 +1,23 @@ |
|
|
import {Refractor} from '@modal-soft/react-refractor'; |
|
|
import {Refractor} from '@modal-soft/react-refractor'; |
|
|
import {NextPage} from 'next'; |
|
|
import {NextPage} from 'next'; |
|
|
import * as React from 'react'; |
|
|
import * as React from 'react'; |
|
|
|
|
|
import {getFormValues} from '@theoryofnekomata/formxtra'; |
|
|
|
|
|
|
|
|
const BlogPostPage: NextPage = () => { |
|
|
const BlogPostPage: NextPage = () => { |
|
|
|
|
|
const handleAction: React.FormEventHandler<HTMLFormElement> = React.useCallback((e) => { |
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
const { currentTarget, nativeEvent } = e; |
|
|
|
|
|
const { submitter } = nativeEvent as unknown as { submitter: HTMLButtonElement }; |
|
|
|
|
|
const { action } = getFormValues(currentTarget, { submitter }); |
|
|
|
|
|
switch (action) { |
|
|
|
|
|
case 'copyContents': |
|
|
|
|
|
console.log('copy contents'); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div className="container mx-auto px-4"> |
|
|
<div className="container mx-auto px-4"> |
|
@@ -13,7 +28,7 @@ const BlogPostPage: NextPage = () => { |
|
|
Use <code>@modal-soft/react-refractor</code> as follows on your page: |
|
|
Use <code>@modal-soft/react-refractor</code> as follows on your page: |
|
|
</p> |
|
|
</p> |
|
|
</div> |
|
|
</div> |
|
|
<div className="bg-shade/20 overflow-auto pt-4 pb-8"> |
|
|
|
|
|
|
|
|
<div className="bg-shade/20 overflow-auto pt-4 pb-8 text-sm"> |
|
|
<div className="container mx-auto px-4"> |
|
|
<div className="container mx-auto px-4"> |
|
|
<Refractor |
|
|
<Refractor |
|
|
lineNumbers |
|
|
lineNumbers |
|
@@ -21,16 +36,7 @@ const BlogPostPage: NextPage = () => { |
|
|
language="tsx" |
|
|
language="tsx" |
|
|
scroll |
|
|
scroll |
|
|
actions={ |
|
|
actions={ |
|
|
<> |
|
|
|
|
|
<button |
|
|
|
|
|
type="submit" |
|
|
|
|
|
name="action" |
|
|
|
|
|
value="copyContents" |
|
|
|
|
|
className="h-12 uppercase text-primary font-semi-expanded font-bold" |
|
|
|
|
|
> |
|
|
|
|
|
Copy |
|
|
|
|
|
</button> |
|
|
|
|
|
</> |
|
|
|
|
|
|
|
|
<></> |
|
|
} |
|
|
} |
|
|
code={`import {Refractor} from '@modal-soft/react-refractor'; |
|
|
code={`import {Refractor} from '@modal-soft/react-refractor'; |
|
|
import {NextPage} from 'next'; |
|
|
import {NextPage} from 'next'; |
|
|