-
Notifications
You must be signed in to change notification settings - Fork 1
FEA: add secondary button link #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- add site link - update Section props - add anchor and link
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/podcodar/webapp/BacQCzro4RGpytjgkn3uAf9tqeVQ |
|
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 🌎 |
|
|
||
| interface Props extends ChakraProps { | ||
| children: ReactNode; | ||
| id?: string; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
- Estou criando uma
interfacepara o objetoprops. Isso significa que estou criando o formato dele. - Algumas vezes queremos fazer com que uma propriedade seja opcional, ou seja, que seja tenha um valor especificado (no caso
string) ouundefinedse 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:
borgesgfj
left a comment
There was a problem hiding this 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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- pego a chave
childrene coloco ela numa variavel ({ children }) - 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:
Descrição
Adiciona ação para botão secondário da página. Link envia para sessão "Why it works".
aspara funcionar corretamente comhrefit closes #48