-
Notifications
You must be signed in to change notification settings - Fork 0
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
POC for patternlab viewer: initial commit #1
base: master
Are you sure you want to change the base?
Conversation
A lot of files are just copies of patternlab, I'll mark which files should be reviewed |
@@ -0,0 +1,85 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review this file
@sergesemashko |
@scottnath all params are optional, but I would recommend pass to custom // custom patternPaths object
patternlabWrapper({
dest: './app/public',
patternPaths: {"category":
{"subcategory": {"patternName1": "00-atoms-01-global-00-colors"},
{"subcategory2": {"patternName2": "00-atoms-01-global-01-redirect"},
...
}
});
// OR custom menu html
patternlabWrapper({
dest: './app/public',
patternNavHTML: '<ul class="patterns-menu sg-nav">
<li class="sg-nav-"><a class="sg-acc-handle">base</a>
<ul class="sg-acc-panel">
<li class="sg-nav-"><a class="sg-pop" href="app/bower_components/pattern-library/patterns/base/blockquote">Blockquote</a></li>
<li class="sg-nav-"><a class="sg-pop" href="app/bower_components/pattern-library/patterns/base/body">Body</a></li>
</ul>
</li>
</ul>'
});
// OR with html hardcoded in _patternlab-files/partials/patterNav.twig
patternlabWrapper({
dest: './app/public'
}); Let me know if you have any troubles/ |
@sergesemashko Created this:
Getting this:
|
@scottnath something wrong with relative paths, checking locally |
@scottnath , that was relative path issue, I fixed it. Please, try again |
@sergesemashko my current code:
|
@scottnath there is some JS bound on classes to do that kind of logic. <ul class="patterns-menu sg-nav">
<li>
<a class="sg-acc-handle">base</a>
<ul class="sg-acc-panel">
<li ><a class="sg-acc-handle" href="PUBLIC/base/a/a.html">Anchor Link</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/blockquote/blockquote.html">Blockquote</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/body/body.html">Body</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/button/button.html">Button</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/code/code.html">Code</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/em/em.html">Em</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/h1/h1.html">Heading Level 1</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/h2/h2.html">Heading Level 2</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/h3/h3.html">Heading Level 3</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/h4/h4.html">Heading Level 4</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/h5/h5.html">Heading Level 5</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/h6/h6.html">Heading Level 6</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/img/img.html">Base Image</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/label/label.html">Label</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/li/li.html">List Item</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/ol/ol.html">Ordered List</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/option/option.html">Option</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/p/p.html">Paragraph</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/pre/pre.html">Pre</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/select/select.html">Select</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/strong/strong.html">Strong</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/table/table.html">Table</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/tbody/tbody.html">Table body element</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/td/td.html">Table cell</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/test-img/test-img.html">Base Image</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/textarea/textarea.html">Textarea</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/th/th.html">Table header cell</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/thead/thead.html">Table header</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/tr/tr.html">Table row</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/base/ul/ul.html">Unordered List</a></li>
</ul>
</li>
<li><a class="sg-acc-handle">uncategorized</a>
<ul class="sg-acc-panel">
<li ><a class="sg-pop" href="PUBLIC/uncategorized/generic-elm-h2/generic-elm-h2.html">Heading Level 2 Generic H2</a></li>
</ul>
</li>
<li>
<a class="sg-acc-handle">components</a>
<ul class="sg-acc-panel">
<li ><a class="sg-acc-handle" href="PUBLIC/components/figure-image/figure-image.html">Figure Image</a></li>
<li ><a class="sg-acc-handle" href="PUBLIC/components/message/message.html">Message</a></li>
</ul>
</li>
</ul> This is updated twig template with classes for menu (insert links into href attributes if something is missing): {% if categories is not empty %}
<ul class="patterns-menu sg-nav">
{% for key,value in categories %}
{% if value.patterns is not empty %}
<li>
<a href="#" class="sg-acc-handle">{{key}}</a>
<ul class="sg-acc-panel">
{% if value.subcategories is not empty %}
{% for key,value in value.subcategories %}
{% if value.patterns is not empty %}
<li>
<a href="#" class="sg-acc-handle">{{key}}</a>
<ul class="sg-acc-panel">
{% for item in value.patterns %}
<li><a class="sg-pop" href="{{item.url}}">{{item.name}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% for item in value.patterns %}
<li class="sg-nav-"><a class="sg-pop" href="{{item.url}}">{{item.name}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %} also both _patterns and index.html should be in the same folder and urls for patterns should be relative to public folder:
Let me know if that doesn't work. |
@sergesemashko didn't work. I've got the links right, but it just repeats the main interface, so then it just starts to double up. Is there any way you could simplify this? We really need drop-in solutions for all of these pieces. |
@scottnath, simpler solution will be to combine this repo with pattern-presenter and generate view in pattern-presenter only. I can start looking into that. What do you think? |
@sergesemashko that seems like a possible solution, but really all of this patternlab code seems like very excessive overkill. Other than the familiar interface, what are we gaining brining all this in? Is something like this pull request workable? What do we lose with a basic version like that (other than the styling of the interface?) |
Speaking about POC - we do not lose anything. But, obviously, it would be hard to use the tool without some interface features. |
@sergesemashko agreed. But maybe we can keep it simple and still have an interface. This is what my PR creates: http://pattern-library.github.io/ it is ugly, but it is simple. |
@beynya @scottnath please review