Skip to content

Conversation

@marco-souza
Copy link
Contributor

Descrição

Adiciona ação para botão secondário da página. Link envia para sessão "Why it works".

  • links e traduções foram alteradas
  • botão precisa usar atributo as para funcionar corretamente com href
  • resolvi typo na sessão de aprendizado na pratica

it closes #48

- add site link
- update Section props
- add anchor and link
@vercel
Copy link

vercel bot commented Dec 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/podcodar/webapp/BacQCzro4RGpytjgkn3uAf9tqeVQ
✅ Preview: https://webapp-git-marco-48-podcodar.vercel.app

@marco-souza marco-souza temporarily deployed to Firebase December 1, 2021 11:35 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2021

Visit the preview URL for this PR (updated for commit be99fb4):

https://podcodar-webapp--pr84-marco-48-5ie9h8zh.web.app

(expires Wed, 08 Dec 2021 11:37:55 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@marco-souza marco-souza self-assigned this Dec 1, 2021

interface Props extends ChakraProps {
children: ReactNode;
id?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Porque usa essa ? após o id?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

também não entendi essa sintaxe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bom, vamos dar um passo atrás:

  1. Estou criando uma interface para o objeto props. Isso significa que estou criando o formato dele.
  2. Algumas vezes queremos fazer com que uma propriedade seja opcional, ou seja, que seja tenha um valor especificado (no caso string) ou undefined se nada for passado.

No TypeScript temos duas formas de falar que uma chave de um elemento é opcional:

interface Props {
  // ...
  id: undefined | string
}

// ou

interface Props {
  // ...
  id?: string
}

Dessa forma o id pode ser passado ou não.

Links:

Copy link
Contributor

@borgesgfj borgesgfj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legal demais!


interface Props extends ChakraProps {
children: ReactNode;
id?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

também não entendi essa sintaxe.

id?: string;
}

function Section({ children, ...props }: Props) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eu ainda não entendo bem essa sintaxe { children, ...props }: Props. Você poderia me explicar mais por auto?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essa é uma spread operation. Nesse caso, estou desestruturando o objeto do tipo Props original:

  1. pego a chave children e coloco ela numa variavel ({ children })
  2. pego o resto do objeto e salvo na variavel props ({ ...props })

Mas ficar estudando caso a caso não é o ideal, melhor olhar os seguintes links:

@marco-souza marco-souza temporarily deployed to Firebase December 2, 2021 13:00 Inactive
@marco-souza marco-souza merged commit 0cfb518 into main Dec 2, 2021
@marco-souza marco-souza deleted the marco/#48 branch December 2, 2021 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adicionar ação para botão secundário

4 participants