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

Extending of blocks and wrapped templates in the template #6

Open
literat opened this issue Apr 22, 2024 · 3 comments
Open

Extending of blocks and wrapped templates in the template #6

literat opened this issue Apr 22, 2024 · 3 comments

Comments

@literat
Copy link
Contributor

literat commented Apr 22, 2024

I cannot extend a block from another template that is extending the template. The block cannot be changed.
But when I take out the block from the DS wrapper component, extending works.

Based on the documentation of the embed (https://twig.symfony.com/doc/3.x/tags/embed.html) adjusting the block should be possible, so I think that the TwigX bundle somehow breaks the standard behavior of the Twig.

https://jira.almacareer.tech/browse/DS-609

@literat
Copy link
Contributor Author

literat commented Apr 22, 2024

If I'm understanding things correctly here, I'd say that block overloading is a Twig issue that can't be carried over into the TwigX component composition concept and needs to be thought of differently. That is, overloading the inside of a component is not possible (unless I'm making do with props) and has to be done through slots and inserting custom content through them.

@literat
Copy link
Contributor Author

literat commented Apr 22, 2024

Or rather like this, it will be clearer:

<SearchResultCard>
  <SearchResultCardHeader>
   <!-- header content -->
  </SearchResultCardHeader>
  <SearchResultCardBody>
    <!-- body content -->
  </SearchResultCardBody>
  <SearchResultCardFooter>
    <!-- footer content -->
  </SearchResultCardFooter>
</SearchResultCard>

@literat
Copy link
Contributor Author

literat commented Apr 22, 2024

Hey, I think I've addressed this before. I ended up creating the individual slots as separate mini-components:

<SearchResultCardHeader>
  <SearchResultCardTitle>
    <Link href="/vacancy-detail" isUnderlined>
      Obch. zástupce výdejních míst – Moravskoslezský kraj
    </Link>
  </SearchResultCardTitle>
  <SearchResultCardLogo
    alt="UniCredit Bank Czech Republic and Slovakia, a.s."
    src="https://picsum.photos/300/150/"
    srcSet="https://picsum.photos/600/300 2x, https://picsum.photos/300/150"
  />
  <SearchResultCardStatus>
    Doporučujeme
  </SearchResultCardStatus>
  <SearchResultCardFavoriteLink
    href="/unmark-as-favorite"
    onClick="() => {}"
    title="Odebrat z oblíbených"
    isSelected
  />
</SearchResultCardHeader>

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

No branches or pull requests

1 participant