From a5e2f535db374eecff32a8dbe8591eb2dea06c19 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Tue, 22 Nov 2022 11:08:35 -0300 Subject: [PATCH 01/14] feat: created input spinner component --- components/InputSpinner/index.tsx | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 components/InputSpinner/index.tsx diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx new file mode 100644 index 0000000..65476ae --- /dev/null +++ b/components/InputSpinner/index.tsx @@ -0,0 +1,66 @@ +import { + HStack, + Input, + InputGroup, + InputLeftElement, + InputRightElement, + NumberInputProps, + useNumberInput, +} from '@chakra-ui/react' +import { AddIcon, MinusIcon } from '@chakra-ui/icons' + +interface Props { + step?: number + defaultValue?: number + min?: number + max?: number + width?: number | string + onChange: (valueAsString: string, valueAsNumber: number) => void +} + +export default function InputSpinner({ + step, + defaultValue, + min, + max, + width, + ...props +}: Props & NumberInputProps) { + const { getInputProps, getIncrementButtonProps, getDecrementButtonProps } = + useNumberInput({ + step: step || 1, + defaultValue: defaultValue || 0, + min: min || 0, + max: max || 10000, + ...props, + }) + + const inc = getIncrementButtonProps() + const dec = getDecrementButtonProps() + const input = getInputProps() + + return ( + + + + + + + + + + + + ) +} From 68c79e9d3dae66dba17f884c3b2f64bc3de46cbf Mon Sep 17 00:00:00 2001 From: Madeuss Date: Tue, 22 Nov 2022 11:09:32 -0300 Subject: [PATCH 02/14] refactor: refactor the index export file using * to export all from that files --- .../Welcome/{WelcomeContent.tsx => index.tsx} | 17 +++++++++++------ lib/index.ts | 11 +++-------- 2 files changed, 14 insertions(+), 14 deletions(-) rename components/Welcome/{WelcomeContent.tsx => index.tsx} (65%) diff --git a/components/Welcome/WelcomeContent.tsx b/components/Welcome/index.tsx similarity index 65% rename from components/Welcome/WelcomeContent.tsx rename to components/Welcome/index.tsx index 3040a8d..fe8cf68 100644 --- a/components/Welcome/WelcomeContent.tsx +++ b/components/Welcome/index.tsx @@ -1,16 +1,21 @@ -import NextButton from '../../components/NextButton' +import NextButton from '../NextButton' import type { FunctionComponent } from 'react' import type { HeadlineComponent, LinkComponent } from '../Default' interface WelcomeContentProps { - newContractPath: string, - t: Function, - Headline: HeadlineComponent, - Link: LinkComponent, + newContractPath: string + t: Function + Headline: HeadlineComponent + Link: LinkComponent } export type WelcomeContentComponent = FunctionComponent -function WelcomeContent({ newContractPath, t, Headline, Link }: WelcomeContentProps) { +function WelcomeContent({ + newContractPath, + t, + Headline, + Link, +}: WelcomeContentProps) { return ( <> diff --git a/lib/index.ts b/lib/index.ts index 954307b..f5e27de 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,8 +1,3 @@ -import WelcomeContent from '../components/Welcome/WelcomeContent' -import NextButton from '../components/NextButton' -import type { WelcomeContentComponent } from '../components/Welcome/WelcomeContent' -import type { NextButtonComponent } from '../components/NextButton' - - -export { WelcomeContent, NextButton } -export type { WelcomeContentComponent, NextButtonComponent } +export * from '../components/Welcome' +export * from '../components/NextButton' +export * from '../components/InputSpinner' From 2f9ab4d88f2c316d8cf74ff9a3a5877610745b5f Mon Sep 17 00:00:00 2001 From: Madeuss Date: Tue, 22 Nov 2022 11:10:07 -0300 Subject: [PATCH 03/14] feat: added chakra-ui icons lib --- package.json | 1 + yarn.lock | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/package.json b/package.json index b5de333..7d09dd3 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "lint": "next lint" }, "dependencies": { + "@chakra-ui/icons": "^2.0.12", "@chakra-ui/react": "^2.3.6", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", diff --git a/yarn.lock b/yarn.lock index 1343842..00dbcb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -251,6 +251,20 @@ dependencies: "@chakra-ui/shared-utils" "2.0.2" +"@chakra-ui/icon@3.0.12": + version "3.0.12" + resolved "https://registry.yarnpkg.com/@chakra-ui/icon/-/icon-3.0.12.tgz#04f5b38591c4ff1cc922c14f814ce6b5d67525d9" + integrity sha512-VbUqgMcoZ26P1MtZdUqlxAKYDi1Bt8sSPNRID8QOwWfqyRYrbzabORVhKR3gpi6GaINjm7KRHIXHarj3u6EWdA== + dependencies: + "@chakra-ui/shared-utils" "2.0.3" + +"@chakra-ui/icons@^2.0.12": + version "2.0.12" + resolved "https://registry.yarnpkg.com/@chakra-ui/icons/-/icons-2.0.12.tgz#5b4dd53512c2543c0617d4b348bf7bd1d9284e4a" + integrity sha512-lZyB96Yic5qM3gWp/QlQuD8WyS+V+19mjNxFW7IVmcn7fm+bLsnPrVPv2Qmpcs6/d4jsUyc1broyuyM+Urtg8Q== + dependencies: + "@chakra-ui/icon" "3.0.12" + "@chakra-ui/image@2.0.11": version "2.0.11" resolved "https://registry.yarnpkg.com/@chakra-ui/image/-/image-2.0.11.tgz#eb880ecd2fce47f22ef50bbbba66cbb027c0304c" @@ -640,6 +654,11 @@ resolved "https://registry.yarnpkg.com/@chakra-ui/shared-utils/-/shared-utils-2.0.2.tgz#1df08133194c12ac4df9302604ec37784c2bb026" integrity sha512-wC58Fh6wCnFFQyiebVZ0NI7PFW9+Vch0QE6qN7iR+bLseOzQY9miYuzPJ1kMYiFd6QTOmPJkI39M3wHqrPYiOg== +"@chakra-ui/shared-utils@2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@chakra-ui/shared-utils/-/shared-utils-2.0.3.tgz#97cbc11282e381ebd9f581c603088f9d60ead451" + integrity sha512-pCU+SUGdXzjAuUiUT8mriekL3tJVfNdwSTIaNeip7k/SWDzivrKGMwAFBxd3XVTDevtVusndkO4GJuQ3yILzDg== + "@chakra-ui/skeleton@2.0.17": version "2.0.17" resolved "https://registry.yarnpkg.com/@chakra-ui/skeleton/-/skeleton-2.0.17.tgz#737e08f771980f5b73060dc6c940691e7759d044" From 145f5f8861471ea100aa747d53db1ada48528cf4 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Tue, 22 Nov 2022 11:13:29 -0300 Subject: [PATCH 04/14] feat: added pr template md file --- .github/pull_request_template.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..f16ac6f --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,21 @@ +# O que esse PR faz? + +## Qual o problema encontrado? + +- descrição do problema +- **screenshots** se possível +- exemplo de `código` se necessário +- mensagem de erro (log, excessão, alert) + +## Qual a solução aplicada? + +- descrição da solução +- **screenshots** se possível +- exemplo de `código` se necessário + +## Screenshots + +# Antes de pedir os seus joinhas, confira: + +- [ ] Changelog? +- [ ] Base branch está correta? (Por padrão é a `main`) From 24968568189b6d4c22f3a48c712f291271fab2fd Mon Sep 17 00:00:00 2001 From: Madeuss Date: Tue, 22 Nov 2022 11:40:40 -0300 Subject: [PATCH 05/14] refactor: refactor props order --- components/InputSpinner/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 65476ae..b1e22a0 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -52,12 +52,12 @@ export default function InputSpinner({ - + From 85b4609198dd880ce1174b923c6eb3f5acd9133e Mon Sep 17 00:00:00 2001 From: Madeuss Date: Tue, 22 Nov 2022 11:45:50 -0300 Subject: [PATCH 06/14] fix: fix input and welcome component exporting --- components/InputSpinner/index.tsx | 2 +- components/Welcome/index.tsx | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index b1e22a0..0e8555c 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -18,7 +18,7 @@ interface Props { onChange: (valueAsString: string, valueAsNumber: number) => void } -export default function InputSpinner({ +export function InputSpinner({ step, defaultValue, min, diff --git a/components/Welcome/index.tsx b/components/Welcome/index.tsx index fe8cf68..20ae4ea 100644 --- a/components/Welcome/index.tsx +++ b/components/Welcome/index.tsx @@ -10,7 +10,7 @@ interface WelcomeContentProps { } export type WelcomeContentComponent = FunctionComponent -function WelcomeContent({ +export function WelcomeContent({ newContractPath, t, Headline, @@ -25,5 +25,3 @@ function WelcomeContent({ ) } - -export default WelcomeContent From 8ed81074b15efa5a21d6c5c677d018e2f63688e3 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Wed, 23 Nov 2022 14:01:51 -0300 Subject: [PATCH 07/14] fix: refactor props use way --- components/InputSpinner/index.tsx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 0e8555c..27aa477 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -9,29 +9,16 @@ import { } from '@chakra-ui/react' import { AddIcon, MinusIcon } from '@chakra-ui/icons' -interface Props { - step?: number - defaultValue?: number - min?: number - max?: number - width?: number | string - onChange: (valueAsString: string, valueAsNumber: number) => void -} - export function InputSpinner({ - step, - defaultValue, - min, - max, - width, ...props -}: Props & NumberInputProps) { +}: NumberInputProps) { + const {step, defaultValue, min, width} = props + const { getInputProps, getIncrementButtonProps, getDecrementButtonProps } = useNumberInput({ step: step || 1, defaultValue: defaultValue || 0, min: min || 0, - max: max || 10000, ...props, }) @@ -40,7 +27,7 @@ export function InputSpinner({ const input = getInputProps() return ( - + Date: Wed, 23 Nov 2022 14:03:14 -0300 Subject: [PATCH 08/14] refactor: remove checkboxes from pr template --- .github/pull_request_template.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f16ac6f..1b1dd9c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -14,8 +14,3 @@ - exemplo de `código` se necessário ## Screenshots - -# Antes de pedir os seus joinhas, confira: - -- [ ] Changelog? -- [ ] Base branch está correta? (Por padrão é a `main`) From ade19ff16b0d3e9fdbbbeda11afc12515f488b35 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Wed, 23 Nov 2022 15:33:15 -0300 Subject: [PATCH 09/14] feat: added input elements left and right as prop options --- components/InputSpinner/index.tsx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 27aa477..9734f69 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -9,10 +9,13 @@ import { } from '@chakra-ui/react' import { AddIcon, MinusIcon } from '@chakra-ui/icons' -export function InputSpinner({ - ...props -}: NumberInputProps) { - const {step, defaultValue, min, width} = props +interface Props { + minusIcon?: React.ReactNode + addIcon?: React.ReactNode +} + +export function InputSpinner({ ...props }: Props & NumberInputProps) { + const { step, defaultValue, min, max, width, minusIcon, addIcon } = props const { getInputProps, getIncrementButtonProps, getDecrementButtonProps } = useNumberInput({ @@ -27,16 +30,16 @@ export function InputSpinner({ const input = getInputProps() return ( - + - + {minusIcon ? minusIcon : } - - + + {addIcon ? ( + addIcon + ) : ( + + )} From 9cf149b09355c1a00dc74c7c1002f1c3a28d2c01 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Wed, 23 Nov 2022 15:41:29 -0300 Subject: [PATCH 10/14] fix: removing useless props of add icon default component --- components/InputSpinner/index.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 9734f69..e835da2 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -48,11 +48,7 @@ export function InputSpinner({ ...props }: Props & NumberInputProps) { {...input} /> - {addIcon ? ( - addIcon - ) : ( - - )} + {addIcon ? addIcon : } From 3228cb2bc73cddd635c91021bee289434343a637 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Wed, 23 Nov 2022 15:53:01 -0300 Subject: [PATCH 11/14] fix: remove useless prop --- components/InputSpinner/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index e835da2..0d27c91 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -15,7 +15,7 @@ interface Props { } export function InputSpinner({ ...props }: Props & NumberInputProps) { - const { step, defaultValue, min, max, width, minusIcon, addIcon } = props + const { step, defaultValue, min, width, minusIcon, addIcon } = props const { getInputProps, getIncrementButtonProps, getDecrementButtonProps } = useNumberInput({ From ea2cdee2f04973c81c2ac1380c1e3da727f470d9 Mon Sep 17 00:00:00 2001 From: Madeuss Date: Wed, 23 Nov 2022 16:06:35 -0300 Subject: [PATCH 12/14] fix: remove specific color props --- components/InputSpinner/index.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 0d27c91..5e3d166 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -32,23 +32,12 @@ export function InputSpinner({ ...props }: Props & NumberInputProps) { return ( - - {minusIcon ? minusIcon : } + + {minusIcon ? minusIcon : } - + - {addIcon ? addIcon : } + {addIcon ? addIcon : } From 00b2d791894aa5e20da335bf9a73667c9c13b201 Mon Sep 17 00:00:00 2001 From: Mateus S <47336224+Madeuss@users.noreply.github.com> Date: Thu, 24 Nov 2022 09:34:42 -0300 Subject: [PATCH 13/14] Update components/InputSpinner/index.tsx Co-authored-by: Fabricio C Zuardi --- components/InputSpinner/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 5e3d166..442b064 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -14,7 +14,7 @@ interface Props { addIcon?: React.ReactNode } -export function InputSpinner({ ...props }: Props & NumberInputProps) { +export function InputSpinner(props: Props & NumberInputProps) { const { step, defaultValue, min, width, minusIcon, addIcon } = props const { getInputProps, getIncrementButtonProps, getDecrementButtonProps } = From 4b3e60c9d7390f2299c2a023a8170e57f850f1be Mon Sep 17 00:00:00 2001 From: Mateus S <47336224+Madeuss@users.noreply.github.com> Date: Thu, 24 Nov 2022 09:35:09 -0300 Subject: [PATCH 14/14] Update components/InputSpinner/index.tsx Co-authored-by: Fabricio C Zuardi --- components/InputSpinner/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/InputSpinner/index.tsx b/components/InputSpinner/index.tsx index 442b064..df279df 100644 --- a/components/InputSpinner/index.tsx +++ b/components/InputSpinner/index.tsx @@ -33,7 +33,7 @@ export function InputSpinner(props: Props & NumberInputProps) { - {minusIcon ? minusIcon : } + {minusIcon || }