Skip to content
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

Nested Layouts #82

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Nested Layouts #82

wants to merge 1 commit into from

Conversation

Roseskk
Copy link
Collaborator

@Roseskk Roseskk commented May 18, 2022

No description provided.

@Roseskk Roseskk requested a review from BigTows May 18, 2022 10:21
@Roseskk Roseskk linked an issue May 18, 2022 that may be closed by this pull request
@netlify
Copy link

netlify bot commented May 18, 2022

Deploy Preview for cheerful-lily-b65942 ready!

Name Link
🔨 Latest commit 2862f3f
🔍 Latest deploy log https://app.netlify.com/sites/cheerful-lily-b65942/deploys/6284c8c9a4779f000854a44b
😎 Deploy Preview https://deploy-preview-82--cheerful-lily-b65942.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

return (
<ViewLayout><Component {...pageProps} /></ViewLayout>
)
const getLayout = Component.getLayout ?? ((page:any)=> page)
Copy link
Member

Choose a reason for hiding this comment

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

ааааа теперь понял)

Смотри у тебя сейчас куча дублей кода, давай так:

  1. Если Component приводит свой Layout то мы его подставляем
  2. Если же Component не выдвигает свой Layout, то мы подставляем по умолчанию:
<ViewLayout>
            {page}
</ViewLayout>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ну дубли есть как бы), для каждой страницы лэйаут, а ты о чем?

Copy link
Member

Choose a reason for hiding this comment

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

Если ты НЕ переопределил функцию в компоненте, то подставлять ViewLayout иначе то что вернула функция. Тогда дубли уйдут

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

не понял а что это еще не закрытый тикет чтоль

@Roseskk Roseskk requested a review from BigTows May 31, 2022 16:43
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.

Разбить Layout
2 participants