Skip to content

Commit 48b0586

Browse files
Merge pull request #94 from pattern-lab/feature-themes
Feature themes
2 parents 20ccb53 + 8ba0124 commit 48b0586

File tree

17 files changed

+1001
-234
lines changed

17 files changed

+1001
-234
lines changed

dist/index.html

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
<nav class="pl-c-nav pl-js-nav-target pl-js-nav-container" role="navigation">
1818

19+
<input class="pl-c-typeahead pl-js-typeahead" id="typeahead" type="text" placeholder="Find Pattern" />
20+
1921
<ol class="pl-c-nav__list pl-js-pattern-nav-target">
2022
<!-- pattern lab nav will be inserted here -->
2123
</ol><!--end pl-c-nav__list-->
2224

23-
<input class="pl-c-typeahead pl-js-typeahead" id="typeahead" type="text" placeholder="Find Pattern" />
24-
2525
</nav><!--end pl-c-nav-->
2626

2727
<div class="pl-c-controls pl-js-controls">
@@ -342,6 +342,31 @@ <h3 class="pl-c-annotations__item-title">{{ title }}</h3>
342342

343343
<!-- load Pattern Lab data -->
344344
<script src="styleguide/data/patternlab-data.js"></script>
345+
346+
<!-- applying theme config to get classes on before PL renders so there's no flash of unstyled content -->
347+
<!-- @todo Consider moving this to own file -->
348+
<script>
349+
if (config && config.theme) {
350+
if (config.theme.color === 'light') {
351+
document.body.classList.add('pl-c-body--theme-light');
352+
}
353+
if (config.theme.layout === 'vertical') {
354+
document.body.classList.add('pl-c-body--theme-sidebar');
355+
}
356+
switch (config.theme.density) {
357+
case 'cozy':
358+
document.body.classList.add('pl-c-body--theme-density-cozy');
359+
break;
360+
case 'comfortable':
361+
document.body.classList.add('pl-c-body--theme-density-comfortable');
362+
break;
363+
default:
364+
// not sure if you even need/want this
365+
document.body.classList.add('pl-c-body--theme-density-compact');
366+
}
367+
}
368+
</script>
369+
345370
<script src="annotations/annotations.js"></script>
346371

347372
<!-- load Pattern Lab external library js -->

0 commit comments

Comments
 (0)