-
Notifications
You must be signed in to change notification settings - Fork 406
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
Support for {{ message }} default value #182
Comments
I'm a little confused by this.
If I recall, this is not really valid mustache? It's certainly not a pattern partial like:
I'll take a look at this, as with the other issues, sometime soon. Thanks for contributing and your interest in pattern lab node. |
Sorry, the syntax was bad. I mean something similar to this suggestion. Having an option to be able to use a Thanks for all the work you are doing for PL node! |
Interesting. The linked issue pertains to styleModifiers, which I understand and agree would be neat! Default values should be found in |
The scenario I have is the following: I have a component for a price that has three states and is wrapped in a When a price is unchanged: When a price is discounted, two prices are displayed: The standard price atom could be built like:
Then I can create the variant atoms this way:
and:
This method enables controlling variants of It would be possible to create a What would be nice is to be able to do the following:
That way when I visit the price default atom I get a value displayed, instead of seeing nothing. Maybe I am not understanding how to arrange my atoms properly. When I look at the demo - http://demo.patternlab.io/?p=atoms-headings I see the headings on atomic level are all present. I do not feel like this is the ideal way of working. What happens if I have a component that has a specific header that I can just call with If the heading markup changes the user is going to have to change it in every other molecule, organism, etc. that has a heading in it, rather than just changing it in a single mustache file at atomic level. It looks like it could become a maintenance nightmare. |
Hi @theorise
The demo works (PLPHP by the way, not PL Node) because the HTML is:
You can confirm this by pulling up the code view. Indeed, not maintainable, and clearly not intended to be consumed by larger atomic design elements.
I completely understand where you are coming from with wanting atomic-level default values. I accomplish this myself by leveraging the I'd create a record like:
and then make atoms-header-1:
This should let the default display, unless a pattern parameter is specified or it's otherwise overwritten by a large template. In the parameter case, this should then work:
Does this meet your needs? Things get a little dicey if you use nested |
Thank you for the response @bmuenzenmeyer. I had absolutely no idea you could use anything other than 'message' in the pattern include argument, now I feel stupid! Your reply covers everything I was asking and more. Unfortunately it just revealed a couple of bugs. You are not able to use anything over than the top level of data.json: Unset styleModifiers seem to inherit a class despite not being set: |
I am closing this as a resolved issue. |
It would be great to be able to have a fallback / default value when using
{{message}}
. You can define a{{message}}
when including a pattern, however there is no way of making it optional.The current situation is as follows:
Pattern: (atom)
Pattern call: (molecule)
Output when viewing molecule:
Output when viewing atom:
An ideal way would be for there to be a fallback / default value which the
{{message}}
would overwrite if present:Pattern: (atom) - using a string
Pattern: (atom) - using _data.json
Pattern call: (molecule)
Output when viewing: (molecule)
Output when viewing: (atom)
The text was updated successfully, but these errors were encountered: