diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..eb82587 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,6 @@ { - "extends": "next/core-web-vitals" + "extends": "next/core-web-vitals", + "rules": { + "react/display-name": "off" + } } diff --git a/codegen.ts b/codegen.ts new file mode 100644 index 0000000..60afa1c --- /dev/null +++ b/codegen.ts @@ -0,0 +1,37 @@ + +import type { CodegenConfig } from '@graphql-codegen/cli'; + +const config: CodegenConfig = { + overwrite: true, + schema: "https://sanavaulth-api.herokuapp.com/graphql", + documents: "./**/*.graphql", + generates: { + "src/types.ts": { + plugins: [ + "typescript", + "typescript-operations", + "fragment-matcher" + ], + config: { + apolooClientVersion: 3, + useExplicitTyping: true, + }, + }, + "./graphql.schema.json": { + plugins: ["introspection"], + }, + "src/": { + preset: "near-operation-file", + presetConfig: { + extension: ".generated.tsx", + baseTypesPath: "types.ts", + }, + plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'], + config: { + withHooks: true, + } + } + } +}; + +export default config; diff --git a/components/Dialog.tsx b/components/Dialog.tsx index 35deaf8..06676ea 100644 --- a/components/Dialog.tsx +++ b/components/Dialog.tsx @@ -6,11 +6,20 @@ interface DialogProps { children: ReactNode; description?: ReactNode; title: ReactNode; + open: boolean; + setOpen: (open: boolean) => void; + isCaptchaOpen: boolean; } -export function Dialog({ button, children, description, title }: DialogProps) { +export function Dialog({ button, children, description, title, open, setOpen, isCaptchaOpen }: DialogProps) { + const checkCanClose = () => { + if(!open) setOpen(true); + if(isCaptchaOpen) setOpen(true); + if(open && !isCaptchaOpen) setOpen(false); + } + return ( - + {button} diff --git a/components/Input.tsx b/components/Input.tsx index 2056339..de28f13 100644 --- a/components/Input.tsx +++ b/components/Input.tsx @@ -1,11 +1,14 @@ +import { forwardRef } from "react"; import { twMerge } from "tailwind-merge"; interface InputProps extends React.InputHTMLAttributes { name: string; label: string; + className?: string; } -export function Input({ name, label, ...props }: InputProps) { +const Input = forwardRef((props, ref) => { + const { name, label, className } = props; return (
); -} +}); + +export default Input; \ No newline at end of file diff --git a/components/TextArea.tsx b/components/TextArea.tsx index 1923641..e75158c 100644 --- a/components/TextArea.tsx +++ b/components/TextArea.tsx @@ -1,12 +1,15 @@ +import { forwardRef } from "react"; import { twMerge } from "tailwind-merge"; interface TextAreaProps extends React.TextareaHTMLAttributes { name: string; label: string; + className?: string; } -export function TextArea({ name, label, ...props }: TextAreaProps) { +const TextArea = forwardRef((props, ref) => { + const { name, label, className } = props; return (