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

Include/Append Component code #33

Open
snixtho opened this issue Jul 22, 2023 · 0 comments
Open

Include/Append Component code #33

snixtho opened this issue Jul 22, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@snixtho
Copy link
Member

snixtho commented Jul 22, 2023

I'll introduce the problem with a scenario:
You want to create themed components so you need to define <style> tags within the manialink. These styles are the same for all components and manialinks. So instead of re-defining all the styles in each and every manialink and component, you create a single component with all the styles in.

You can now import this component and just type something like <Theme /> to add it to the manialink.

But there is a problem: Since every component needs this available, and we don't know if it is available, and to avoid boilercode, each component includes the theme styles. So now you have the styles defined over and over again for each of the components used in a manialink.

What would be great is to have some sort of way to just include or append these styles once. I'm thinking of a syntax such as

<append component="Theme" />

In this case it will always append the contents of the component Theme. But if you want to only append it once, you can use the once modifier:

<append component="Theme" once="true" />

Because it is rendered like a component when it is included, you can even pass properties to it:

<append component="Theme" once="true" myProp="something" />
@snixtho snixtho added the enhancement New feature or request label Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant