|
|
@@ -1,8 +1,23 @@ |
|
|
|
import {Refractor} from '@modal-soft/react-refractor'; |
|
|
|
import {NextPage} from 'next'; |
|
|
|
import * as React from 'react'; |
|
|
|
import {getFormValues} from '@theoryofnekomata/formxtra'; |
|
|
|
|
|
|
|
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 ( |
|
|
|
<> |
|
|
|
<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: |
|
|
|
</p> |
|
|
|
</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"> |
|
|
|
<Refractor |
|
|
|
lineNumbers |
|
|
@@ -21,16 +36,7 @@ const BlogPostPage: NextPage = () => { |
|
|
|
language="tsx" |
|
|
|
scroll |
|
|
|
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'; |
|
|
|
import {NextPage} from 'next'; |
|
|
|