Skip to content

[Cookbook] - fix component_architecture #2025

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

Merged

Conversation

WebMamba
Copy link
Contributor

@WebMamba WebMamba commented Aug 3, 2024

Q A
Bug fix? no
New feature? no
Issues Fix
License MIT

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Aug 3, 2024
@smnandre
Copy link
Member

smnandre commented Aug 3, 2024

Some things i noticed while coding the render:

The last code block will not work (wrong data attribute).

Some name with incorrect case (Symfony, UX, JS)

Some these/those i think.

The example with Header/Body to change, as they are slots/blocks and no isolated component (maybe use a button with an Icon inside?)

I'll make another review before monday :)

Those two packages allow you to create reusable components in your Symfony application.
But the component architecture is not exclusive to Symfony, it is a design pattern that can be applied to any programming language or framework.
But the component architecture is not exclusive to Symfony, it's a design pattern that can be applied to any programming language or framework.
And the js world already implement this architecture for long time, on many different frameworks like React, Vue, or Svelte.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
And the js world already implement this architecture for long time, on many different frameworks like React, Vue, or Svelte.
And the JavaScript world already implements this architecture for long time, on many different frameworks like React, Vue, or Svelte.

@@ -50,18 +50,18 @@ Or you can make composition with the following syntax:
</twig:Card>
```

So here we Card component, and we give to the content of this component mutliple other components.
So here we Card component, and we give to the content of this component two others components.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
So here we Card component, and we give to the content of this component two others components.
So here we have a Card component, and we give to the content of this component two others components.

Not sure about the 1st sentence tho


### Independence

This is a really important rule, and not obvious. But your component should leave on his own context,
he should not be aware of the rest of the page. You should to talk one component into a page, to another and it should work exactly the same.
This rule make your component trully reusable.
he should not be aware of the rest of the page. You should be able to take one component into a page, to another and it should work exactly the same.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
he should not be aware of the rest of the page. You should be able to take one component into a page, to another and it should work exactly the same.
it should not be aware of the rest of the page. You should be able to take one component into a page, to another and it should works exactly the same.


***How does it work into Symfony?***

Symfony keep the context of the page into the context of your component. So this your own responsability to follow this rules.
But notice that if there are conflic between a variable from the context page and your component, your component context override the page context.
Symfony keep the context of the page into the context of your component. So this your own responsibility to follow this rules.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Symfony keep the context of the page into the context of your component. So this your own responsibility to follow this rules.
Symfony keeps the context of the page into the context of your component. So this your own responsibility to follow those rules.

(or "this rule")

Symfony keep the context of the page into the context of your component. So this your own responsability to follow this rules.
But notice that if there are conflic between a variable from the context page and your component, your component context override the page context.
Symfony keep the context of the page into the context of your component. So this your own responsibility to follow this rules.
But notice that if there are conflict between a variable from the context page and your component, your component context override the page context.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
But notice that if there are conflict between a variable from the context page and your component, your component context override the page context.
But notice that if there are conflicts between a variable from the context page and your component, your component context override the page context.

@@ -117,7 +117,7 @@ And when the loading is done, the state `loading` can be set to `false` and the

***How does it work into Symfony?***

In symfony you 2 different approach to handle state. The first one is to use stimulus directly
In Symfony you 2 different approach to handle state. The first one is to use stimulus directly
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In Symfony you 2 different approach to handle state. The first one is to use stimulus directly
In Symfony you have two different approaches to handle state. The first one is to use stimulus directly

@Kocal
Copy link
Member

Kocal commented Aug 4, 2024

I believe my comments can be replaced by an automatic tool, do you think we can use https://github.com/get-alex/alex or https://github.com/textlint/textlint or https://github.com/huacnlee/autocorrect or anything better?

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Aug 11, 2024
@WebMamba
Copy link
Contributor Author

Thanks a lot, @Kocal! I am so bad at spelling 😭

@WebMamba
Copy link
Contributor Author

Thanks a lot @smnandre! All fixed!

@smnandre
Copy link
Member

Thanks you !! Let's merge this and we can iterate next to add features, tags, etc etc !!

👏

@WebMamba WebMamba force-pushed the component_architecture_cookbook_syntax_fixes branch from 24f0d6b to 1609a0e Compare August 13, 2024 18:09
@kbond kbond force-pushed the component_architecture_cookbook_syntax_fixes branch from 1609a0e to 686ab07 Compare August 13, 2024 18:27
@kbond
Copy link
Member

kbond commented Aug 13, 2024

Thanks Matheo.

@kbond kbond merged commit 57c2921 into symfony:2.x Aug 13, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants