Dynamic Codepen links

This commit is contained in:
Angelos Chalaris 2017-12-11 17:12:13 +02:00
parent e468d4b0b8
commit 95e31bd4ed
6 changed files with 80 additions and 30 deletions

View file

@ -1,5 +1,6 @@
var fs = require('fs');
var version = require('./vinf'); // Gets version info.
var frameworkUrl = '"https://cdnjs.cloudflare.com/ajax/libs/mini.css/3.0.0-alpha.1/mini-default.css"';
// INDEX
@ -25,7 +26,7 @@ var indexHtml = `<!DOCTYPE html>
<h1 class="splash">mini<small>.css</small></h1>
<p class="splash">minimal, responsive, style-agnostic <br>CSS framework</p>
<p id="version-info">${version.version}</p>
<a class="button splash">Get started</a>
<a class="button splash" href="docs">Get started</a>
</div>
<header class="row sticky">
<span class="col-md-1 col-lg-2"></span>
@ -123,6 +124,7 @@ var mainEnd = `<footer><p><strong>mini.css</strong> was designed and built by <a
var documentationFragments = docFragments.map(f => buildFragment(f)).join('<br/>');
var documentationLinks = docFragments.map(f => buildLink(f)).join('');
var documentationSearch = `<script>
// Search script
var docs= [${docFragments.map(f => stripData(f))}];
var options = {threshold:0.4, keys:["keys"]};
var fuse = new Fuse(docs,options);
@ -144,6 +146,16 @@ var documentationSearch = `<script>
document.getElementById('search-style').innerHTML = '#no-results{display:none;}';
}
}
// Codepen prefill script
var el = document.querySelectorAll('.prefiller-example > pre');
el.forEach(e => e.innerHTML = '<form action="https://codepen.io/pen/define" method="POST" target="_blank" class="codepen-form">' +
'<input type="hidden" name="data" value=\\\'' + JSON.stringify({
html : e.innerText,
css_external : ${frameworkUrl}
}).replace(/"/g, "&quot;")
.replace(/'/g, "&apos;") + '\\\'>' +
'<input type="image" class="codepen-link" src="data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23424242%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolygon%20points%3D%2212%202%2022%208.5%2022%2015.5%2012%2022%202%2015.5%202%208.5%2012%202%22%3E%3C%2Fpolygon%3E%3Cline%20x1%3D%2212%22%20y1%3D%2222%22%20x2%3D%2212%22%20y2%3D%2215.5%22%3E%3C%2Fline%3E%3Cpolyline%20points%3D%2222%208.5%2012%2015.5%202%208.5%22%3E%3C%2Fpolyline%3E%3Cpolyline%20points%3D%222%2015.5%2012%208.5%2022%2015.5%22%3E%3C%2Fpolyline%3E%3Cline%20x1%3D%2212%22%20y1%3D%222%22%20x2%3D%2212%22%20y2%3D%228.5%22%3E%3C%2Fline%3E%3C%2Fsvg%3E" width="40" height="40" value="Open in Codepen">' +
'</form>' + e.innerHTML);
</script>
<style id="search-style">#no-results{display:none;}</style>`;
@ -152,9 +164,9 @@ function buildFragment(fragment){
<h2 class="section double-padded">${fragment.title}</h2>
<div class="section">${fragment.description}</div>
${fragment.example?`<div class="section"><h3>Example</h3>${fragment.example}</div>`:''}
${fragment.samples.length?`<div class="section double-padded"><h3>Sample code</h3>${fragment.samples.join('')}</div>`:''}
${fragment.samples.length?`<div class="section double-padded prefiller-example"><h3>Sample code</h3>${fragment.samples.join('')}</div>`:''}
${fragment.modifiers.length?
`<div class="section double-padded"><h3>Modifiers</h3>
`<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
${fragment.modifiers.map(m => `<h4>${m.title}</h4>${m.description}${m.example?`<h5>Example</h5>${m.example}`:''}${m.samples.length?`<h5>Sample code</h5>${m.samples.join('')}`:''}`).join('<br/>')}</div>`:''}
${fragment.dos.length||fragment.donts.length?
`<div class="section double-padded"><h3>Best practices</h3>${[fragment.dos.map(d => `<div class="row dodos"><div class="col-sm-12 col-md-6">${d.sample}</div><div class="col-sm-12 col-md-6"><p><mark class="do">Do:</mark>&nbsp;${d.description}</p></div></div>`).join('<br/>'),fragment.donts.map(d => `<div class="row dodos"><div class="col-sm-12 col-md-6">${d.sample}</div><div class="col-sm-12 col-md-6"><p><mark class="dont">Don't:</mark>&nbsp;${d.description}</p></div></div>`).join('<br/>')].join('')}</div>`

View file

@ -227,3 +227,5 @@
- **Hugging cat** was messing with the `DEVLOG`, good thing I noticed and fixed it.
- Moved component-specific variable definitions in `contextual` under the related conditionals.
- Documented `mark` elements.
- Fixed a broken link in `index.html`.
- Added the appropriate script for generating Codepen links dynamically. Oh, yeah!

View file

@ -56,7 +56,7 @@
<div class="section"><p><strong>mini.css</strong> utilizes the ruleset of <a href="http://necolas.github.io/normalize.css/" target="_blank">Normalize.css</a> v7.0.0 to reliably deal with inconsistencies between browsers, while applying some tasteful defaults on top, such as using <a href="https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/" target="_blank">native font stack</a> to figure out the best font for each device, setting the background and foreground colors, as well as the size of the text to <code>16px</code> and its line height to <code>1.5</code>.</p>
<p>All of the most common HTML5 elements, such as paragraphs, links, bold, small and slanted text, have been styled by default using clean, modern typography to make your pages look cool and stand out from the rest of the internet.</p></div>
<div class="section"><h3>Example</h3><p class="doc">This is a paragraph with some sample text. Did you know that the latest version of <strong class="doc">mini.css</strong> is codenamed <em class="doc">Gluon</em>? Well, now you do!</p><hr class="doc"/><p><small class="doc">Remember that <strong class="doc">mini.css</strong> is totally free, no fine print involved!</small></p></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is a paragraph. with some <span class="highlight-a">&lt;strong&gt;</span>bold text<span class="highlight-a">&lt;/strong&gt;</span> and some <span class="highlight-a">&lt;em&gt;</span>italics text<span class="highlight-a">&lt;/em&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is a paragraph. with some <span class="highlight-a">&lt;strong&gt;</span>bold text<span class="highlight-a">&lt;/strong&gt;</span> and some <span class="highlight-a">&lt;em&gt;</span>italics text<span class="highlight-a">&lt;/em&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span><span class="highlight-a">&gt;</span>This is a link.<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;small&gt;</span>This is some small text.<span class="highlight-a">&lt;/small&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;sub&gt;</span>Subscript<span class="highlight-a">&lt;/sub&gt;</span></span>
@ -78,7 +78,7 @@
<div class="col-sm-12 col-md-6 col-md-first"><h4 class="doc">Heading 4<small class="doc">Subheading</small></h4></div>
<div class="col-sm-12 col-md-6"><h5 class="doc">Heading 5<small class="doc">Subheading</small></h5></div>
<div class="col-sm-12 col-md-6 col-md-last"><h6 class="doc">Heading 6<small class="doc">Subheading</small></h6></div></div></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;h1&gt;</span>Heading 1 <span class="highlight-a">&lt;small&gt;</span>Subheading<span class="highlight-a">&lt;/small&gt;&lt;/h1&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;h1&gt;</span>Heading 1 <span class="highlight-a">&lt;small&gt;</span>Subheading<span class="highlight-a">&lt;/small&gt;&lt;/h1&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;h2&gt;</span>Heading 2 <span class="highlight-a">&lt;small&gt;</span>Subheading<span class="highlight-a">&lt;/small&gt;&lt;/h2&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;h3&gt;</span>Heading 3 <span class="highlight-a">&lt;small&gt;</span>Subheading<span class="highlight-a">&lt;/small&gt;&lt;/h3&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;h4&gt;</span>Heading 4 <span class="highlight-a">&lt;small&gt;</span>Subheading<span class="highlight-a">&lt;/small&gt;&lt;/h4&gt;</span></span>
@ -94,7 +94,7 @@
<div class="section"><p>Image elements are responsive by default, automatically scaling down as necessary to display properly on smaller devices. Images retain their original aspect ratio and they will never scale above their original size.</p>
<p>If you want to add captions to images, you can use HTML5 figure elements, along with their related captions.</p></div>
<div class="section"><h3>Example</h3><figure><img src="https://placehold.it/800x600" alt="placeholder"><figcaption class="doc">Image caption</figcaption></figure></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;img</span> <span class="highlight-b">src</span>=<span class="highlight-c">&quot;image.png&quot;</span> <span class="highlight-b">alt</span>=<span class="highlight-c">&quot;Image description&quot;</span><span class="highlight-a">/&gt;</span></span></pre><pre><span class="code-line"><span class="highlight-a">&lt;figure&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;img</span> <span class="highlight-b">src</span>=<span class="highlight-c">&quot;image.png&quot;</span> <span class="highlight-b">alt</span>=<span class="highlight-c">&quot;Image description&quot;</span><span class="highlight-a">/&gt;</span></span></pre><pre><span class="code-line"><span class="highlight-a">&lt;figure&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;img</span> <span class="highlight-b">src</span>=<span class="highlight-c">&quot;image.png&quot;</span> <span class="highlight-b">alt</span>=<span class="highlight-c">&quot;Image description&quot;</span><span class="highlight-a">/&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;figcaption&gt;</span>Image caption<span class="highlight-a">&lt;/figcaption&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/figure&gt;</span></span></pre></div>
@ -107,7 +107,7 @@
<div class="section"><p>List elements, both unordered and ordered, are minimally styled to match with the rest of the framework's aesthetics. Their margins and padding are reset to properly align with the rest of the common HTML5 elements, providing a stable foundation for all of your web app's lists.</p></div>
<div class="section"><h3>Example</h3><ul class="doc"><li class="doc">Apple</li><li class="doc">Orange</li><li class="doc">Strawberry</li></ul><br/>
<ol class="doc"><li class="doc">Wake up</li><li class="doc">Eat breakfast</li><li class="doc">Go to work</li></ol></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;ul&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;ul&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;li&gt;</span>Apple<span class="highlight-a">&lt;/li&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;li&gt;</span>Orange<span class="highlight-a">&lt;/li&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;li&gt;</span>Strawberry<span class="highlight-a">&lt;/li&gt;</span></span>
@ -129,7 +129,7 @@
return num1 + num2;
}</pre>
<blockquote cite="www.quotation.source" class="doc">This is some text quoted from elsewhere.</blockquote></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is some text with some inline <span class="highlight-a">&lt;code&gt;</span>source code<span class="highlight-a">&lt;/code&gt;</span> and some keyboard <span class="highlight-a">&lt;kbd&gt;</span>input<span class="highlight-a">&lt;/kbd&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is some text with some inline <span class="highlight-a">&lt;code&gt;</span>source code<span class="highlight-a">&lt;/code&gt;</span> and some keyboard <span class="highlight-a">&lt;kbd&gt;</span>input<span class="highlight-a">&lt;/kbd&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;pre&gt;</span>function sum(num1, num2){</span>
<span class="code-line"> return num1 + num2;</span>
<span class="code-line">}<span class="highlight-a">&lt;/pre&gt;</span></span>
@ -154,7 +154,7 @@
<div class="row"><div class="col-sm-12"><div class="box-colored">12</div></div></div>
<div class="row"><div class="col-sm"><div class="box-colored">fluid</div></div><div class="col-sm"><div class="box-colored">fluid</div></div></div>
</div></div>
<div class="section double-padded"><h3>Sample code</h3>
<div class="section double-padded prefiller-example"><h3>Sample code</h3>
<pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;container&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;row&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;col-sm-1&quot;</span><span class="highlight-a">&gt;</span><span class="highlight-a">&lt;/div&gt;</span> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;col-sm-11&quot;</span><span class="highlight-a">&gt;</span><span class="highlight-a">&lt;/div&gt;</span></span>
@ -190,7 +190,7 @@
<span class="code-line"> <span class="highlight-a">&lt;p&gt;</span>Media object content...<span class="highlight-a">&lt;/p&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;/div&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/div&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Screen sizes and width</h4><p>Each column class is defined by specifying a screen size (small - <code>sm</code>, medium - <code>md</code> or large - <code>lg</code>) and a column width (a value between <code>1</code> and <code>12</code> or you can omit it for a fluid column), separated by dashes (e.g. <code>.col-sm-6</code> for a 6-wide column on a small screen). Using these you can apply different layouts for different screen sizes, by altering the width of columns, using multiple classes. Note that column widths are applied recursively, meaning that if you do not specify a width for a specific screen size the column will use the width applied for the previous largest screen size.</p><h5>Example</h5><div class="container" style="padding: 0.25rem">
<div class="row">
<div class="col-sm-12 col-md">
@ -310,11 +310,11 @@
<div class="card"><div class="section"><h3 class="doc">Card 2</h3><p class="doc">This is another card with some sample content.</p></div></div>
<div class="card"><div class="section"><h3 class="doc">Card 3</h3><p class="doc">This is one more card with some sample content.</p></div></div>
</div></div></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;row&quot;</span><span class="highlight-a">&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;row&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;card&quot;</span><span class="highlight-a">&gt;&lt;/div&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;card&quot;</span><span class="highlight-a">&gt;&lt;/div&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/div&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Alternative sizes</h4><p>You can create small (<code>.small</code>, <code>240px</code> wide) or large (<code>.large</code>, <code>480px</code> wide) cards by applying the appropriate modifiers to a card. Apart from that, you can also create fluid (<code>.fluid</code>) cards, that take up as much space as is available, however you will have to place these cards inside a grid layout's columns, effectively adding one extra step for them to display properly.</p><h5>Example</h5><div class="container" style="padding: 0.25rem"><div class="row">
<div class="card small"><div class="section"><h3 class="doc">Small Card</h3><p class="doc">Small cards are <code>240px</code> wide.</p></div></div>
<div class="card large"><div class="section"><h3 class="doc">Large Card</h3><p class="doc">Large cards are <code>480px</code> wide.</p></div></div>
@ -352,11 +352,11 @@
<div class="section"><h3>Example</h3><div class="container" style="padding: 0.25rem"><div class="row"><div class="col-sm-12">
<div class="card fluid" style="margin: 0.5rem 0.25rem"><h3 class="doc section">Title section</h3><p class="doc section">This is a section with some textual content.</p></div>
</div></div></div></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;card&quot;</span><span class="highlight-a">&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;card&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;section&quot;</span><span class="highlight-a">&gt;&lt;/div&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;section&quot;</span><span class="highlight-a">&gt;&lt;/div&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/div&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Media sections</h4><p>You can create sections for media (<code>.media</code>), such as images or videos (using an <code>&lt;img&gt;</code> or a <code>&lt;iframe&gt;</code> element respectively). These sections are styled appropriately for presentation of media content, meaning that the content will scale appropriately to fill up the available space.</p><h5>Example</h5><div class="container" style="padding: 0.25rem;"><div class="row">
<div class="card"><div class="section"><h3 class="doc">Card with image</h3></div><img class="section media" src="https://placehold.it/800x600" alt="placeholder"></div>
<div class="card"><div class="section"><h3 class="doc">Card with video</h3></div><iframe class="section media" width="1280" height="720" src="https://www.youtube.com/embed/ScMzIvxBSi4"></iframe></div>
@ -403,7 +403,7 @@
<div class="row responsive-label"><div class="col-sm-12 col-md-3"><label for="sf1-readonly" class="doc">Readonly</label></div>
<div class="col-sm-12 col-md"><input readonly value="Readonly" id="sf1-readonly" style="width:85%;" class="doc"></div></div>
</fieldset></form></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;form&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;form&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;fieldset&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;legend&gt;</span>Simple form<span class="highlight-a">&lt;/legend&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;label</span> <span class="highlight-b">for</span>=<span class="highlight-c">&quot;username&quot;</span><span class="highlight-a">&gt;</span>Username<span class="highlight-a">&lt;/label&gt;</span></span>
@ -434,7 +434,7 @@
<h2 class="section double-padded">Buttons</h2>
<div class="section"><p>Buttons and button-like input elements have been styled by default to be consistent across browsers. You can also style other elements, such as links or form labels, to look like buttons, using the appropriate class (<code>.button</code>) or the <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_button_role" target="_blank">button</a> role.</p></div>
<div class="section"><h3>Example</h3><button class="doc">Button</button><a href="#" class="button doc">Link</a><label class="button doc">Label</label><button disabled class="doc">Disabled</button></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;button&gt;</span>Button<span class="highlight-a">&lt;/button&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;button&gt;</span>Button<span class="highlight-a">&lt;/button&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;input</span> <span class="highlight-b">type</span>=<span class="highlight-c">&quot;button&quot;</span> <span class="highlight-b">value</span>=<span class="highlight-c">&quot;Button&quot;</span><span class="highlight-a"> /&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;input</span> <span class="highlight-b">type</span>=<span class="highlight-c">&quot;reset&quot;</span> <span class="highlight-b">value</span>=<span class="highlight-c">&quot;Button&quot;</span><span class="highlight-a"> /&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;input</span> <span class="highlight-b">type</span>=<span class="highlight-c">&quot;submit&quot;</span> <span class="highlight-b">value</span>=<span class="highlight-c">&quot;Button&quot;</span><span class="highlight-a"> /&gt;</span></span>
@ -442,7 +442,7 @@
<span class="code-line"><span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span> <span class="highlight-b">role</span>=<span class="highlight-c">&quot;button&quot;</span><span class="highlight-a">&gt;</span>Link<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;label</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;button&quot;</span><span class="highlight-a">&gt;</span>Label<span class="highlight-a">&lt;/label&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;label</span> <span class="highlight-b">role</span>=<span class="highlight-c">&quot;button&quot;</span><span class="highlight-a">&gt;</span>Label<span class="highlight-a">&lt;/label&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Color variants</h4><p>To make your buttons stand out, you can give them a primary (<code>.primary</code>), secondary (<code>.secondary</code>), tertiary (<code>.tertiary</code>) or inversed (<code>.inverse</code>) color palette.</p><h5>Example</h5><button class="primary doc">Primary</button><button class="secondary doc">Secondary</button><button class="tertiary doc">Tertiary</button><button class="inverse doc">Inverse</button><h5>Sample code</h5><pre><span class="code-line"><span class="highlight-a">&lt;button</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;primary&quot;</span><span class="highlight-a">&gt;</span>Primary<span class="highlight-a">&lt;/button&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;button</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;secondary&quot;</span><span class="highlight-a">&gt;</span>Secondary<span class="highlight-a">&lt;/button&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;button</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;tertiary&quot;</span><span class="highlight-a">&gt;</span>Tertiary<span class="highlight-a">&lt;/button&gt;</span></span>
@ -464,7 +464,7 @@
</fieldset>
</form>
<div class="button-group"><button class="doc">Buttons</button><button class="doc">can be</button><button class="doc">grouped</button></div></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;input-group&quot;</span><span class="highlight-a">&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;input-group&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;label</span> <span class="highlight-b">for</span>=<span class="highlight-c">&quot;username&quot;</span><span class="highlight-a">&gt;</span>Username<span class="highlight-a">&lt;/label&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;input</span> <span class="highlight-b">type</span>=<span class="highlight-c">&quot;text&quot;</span> <span class="highlight-b">id</span>=<span class="highlight-c">&quot;Username&quot;</span> <span class="highlight-b">placeholder</span>=<span class="highlight-c">&quot;Username&quot;</span><span class="highlight-a">/&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/div&gt;</span></span></pre><pre><span class="code-line"><span class="highlight-a">&lt;div</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;button-group&quot;</span><span class="highlight-a">&gt;</span></span>
@ -472,7 +472,7 @@
<span class="code-line"> <span class="highlight-a">&lt;button&gt;</span>Button<span class="highlight-a">&lt;/button&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;button&gt;</span>Button<span class="highlight-a">&lt;/button&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/div&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Fluid &amp; vertical grouping</h4><p>You can make your input groups fluid (<code>.fluid</code>) or vertical (<code>.vertical</code>), by applying the appropriate modifiers.</p><h5>Example</h5><form>
<fieldset>
<legend class="doc">Fluid input groups</legend>
@ -510,12 +510,12 @@
<a href="#" class="button doc">News</a>
<button class="doc">About</button> <button class="doc">Contact</button>
</header></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;header&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;header&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;logo&quot;</span><span class="highlight-a">&gt;</span>Logo<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;button&quot;</span><span class="highlight-a">&gt;</span>Home<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;button&gt;</span>Download<span class="highlight-a">&lt;/button&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/header&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Sticky header</h4><p>You can make your web app's header sticky (<code>.sticky</code>), by applying the appropriate modifier.</p><h5>Sample code</h5><pre><span class="code-line"><span class="highlight-a">&lt;header</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;sticky&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;logo&quot;</span><span class="highlight-a">&gt;</span>Logo<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;button&quot;</span><span class="highlight-a">&gt;</span>Home<span class="highlight-a">&lt;/a&gt;</span></span>
@ -537,7 +537,7 @@
<a href="#" class="sublink-2 doc">Staff AMA - 16th, Dec</a> <a href="#" class="sublink-1 doc">Policy Update</a>
<a href="#" class="doc">About</a> <a href="#" class="doc">Contact</a>
</nav></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;nav&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;nav&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span><span class="highlight-a">&gt;</span>Category 1<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;span&gt;</span>Category 2<span class="highlight-a">&lt;/span&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;sublink-1&quot;</span><span class="highlight-a">&gt;</span>Item 2.1<span class="highlight-a">&lt;/a&gt;</span></span>
@ -552,10 +552,10 @@
<h2 class="section double-padded">Footer</h2>
<div class="section"><p>The footer element has been minimally styled, aiming to provide you with a clean base to create your web apps' footers.</p></div>
<div class="section"><h3>Example</h3><footer> <p class="doc">&copy; 2016-2017 Web Corporation | <a href="#" class="doc">About</a> | <a href="#" class="doc">Terms of use</a></p> </footer></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;footer&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;footer&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;p&gt;</span>Footer text<span class="highlight-a">&lt;/p&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/footer&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Sticky footer</h4><p>You can make your web app's footer sticky (<code>.sticky</code>), by applying the appropriate modifier.</p><h5>Sample code</h5><pre><span class="code-line"><span class="highlight-a">&lt;footer</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;sticky&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;p&gt;</span>Footer text<span class="highlight-a">&lt;/p&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/footer&gt;</span></span></pre></div>
@ -576,14 +576,14 @@
<label for="demo-toggle" class="drawer-close doc"></label><a href="#" class="doc">Home</a><br/> <a href="#" class="doc">News</a><br/>
<a href="#" class="doc">About</a><br/> <a href="#" class="doc">Contact</a><br/></div>
</div></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;label</span> <span class="highlight-b">for</span>=<span class="highlight-c">&quot;drawer-control&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;drawer-toggle&quot;</span><span class="highlight-a">&gt;&lt;/label&gt;</span></span>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;label</span> <span class="highlight-b">for</span>=<span class="highlight-c">&quot;drawer-control&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;drawer-toggle&quot;</span><span class="highlight-a">&gt;&lt;/label&gt;</span></span>
<span class="code-line"></span>
<span class="code-line"><span class="highlight-a">&lt;input</span> <span class="highlight-b">type</span>=<span class="highlight-c">&quot;checkbox&quot;</span> <span class="highlight-b">id</span>=<span class="highlight-c">&quot;drawer-control&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;drawer&quot;</span><span class="highlight-a">&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;div&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;label</span> <span class="highlight-b">for</span>=<span class="highlight-c">&quot;drawer-control&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;drawer-close&quot;</span><span class="highlight-a">&gt;&lt;/label&gt;</span></span>
<span class="code-line"> <span class="highlight-a">&lt;a</span> <span class="highlight-b">href</span>=<span class="highlight-c">&quot;#&quot;</span><span class="highlight-a">&gt;</span>Home<span class="highlight-a">&lt;/a&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;/div&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Persistent drawer</h4><p>If you want your drawer menus to not expand into normal containers on larger screens, simply add the appropriate modifier (<code>.persistent</code>) on the checkbox controlling the drawer and its toggle button.</p><h5>Sample code</h5><pre><span class="code-line"><span class="highlight-a">&lt;label</span> <span class="highlight-b">for</span>=<span class="highlight-c">&quot;drawer-control&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;drawer-toggle persistent&quot;</span><span class="highlight-a">&gt;&lt;/label&gt;</span></span>
<span class="code-line"></span>
<span class="code-line"><span class="highlight-a">&lt;input</span> <span class="highlight-b">type</span>=<span class="highlight-c">&quot;checkbox&quot;</span> <span class="highlight-b">id</span>=<span class="highlight-c">&quot;drawer-control&quot;</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;drawer persistent&quot;</span><span class="highlight-a">&gt;</span></span>
@ -612,8 +612,8 @@
<h2 class="section double-padded">Text highlighting</h2>
<div class="section"><p>The native HTML5 mark element has been minimally styled to allow for easy text highlighting.</p></div>
<div class="section"><h3>Example</h3><p class="doc">This is a paragraph with some <mark class="doc">highlighted text</mark>.</p></div>
<div class="section double-padded"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is some <span class="highlight-a">&lt;mark&gt;</span>highlighted text<span class="highlight-a">&lt;/mark&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Modifiers</h3>
<div class="section double-padded prefiller-example"><h3>Sample code</h3><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is some <span class="highlight-a">&lt;mark&gt;</span>highlighted text<span class="highlight-a">&lt;/mark&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span></pre></div>
<div class="section double-padded prefiller-example"><h3>Modifiers</h3>
<h4>Color variants</h4><p>You can change the color of highlighted text, based on context by applying the appropriate class (secondary - <code>.secondary</code> or tertiary - <code>.tertiary</code>).</p><h5>Example</h5><p class="doc">This is a <mark class="doc secondary">secondary highlight</mark> and this is a <mark class="doc tertiary">tertiary highlight</mark>.</p><h5>Sample code</h5><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is a <span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;secondary&quot;</span><span class="highlight-a">&gt;</span>secondary highlight<span class="highlight-a">&lt;/mark&gt;</span> and this is a <span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;tertiary&quot;</span><span class="highlight-a">&gt;</span>tertiary highlight<span class="highlight-a">&lt;/mark&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span></pre><br/><h4>Style variants</h4><p>You can make highlights look like tags (<code>.tag</code>) or display as inline blocks (<code>.inline-block</code>), by applying the appropriate class.</p><h5>Example</h5><p class="doc">This is a highlight styled as a <mark class="doc tag">tag</mark>.</p><p><mark class="doc inline-block">This is some highlighted text that is displayed as an inline block.</mark></p><h5>Sample code</h5><pre><span class="code-line"><span class="highlight-a">&lt;p&gt;</span>This is a highlight styled as a <span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;tag&quot;</span><span class="highlight-a">&gt;</span>tag<span class="highlight-a">&lt;/mark&gt;</span>.<span class="highlight-a">&lt;/p&gt;</span></span>
<span class="code-line"><span class="highlight-a">&lt;p&gt;</span><span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;inline-block&quot;</span><span class="highlight-a">&gt;</span>This is some highlighted text that is displayed as an inline block.<span class="highlight-a">&lt;/mark&gt;</span><span class="highlight-a">&lt;/p&gt;</span></span></pre></div>
<div class="section double-padded"><h3>Best practices</h3><div class="row dodos"><div class="col-sm-12 col-md-6"><pre><span class="code-line"><span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;inline-block&quot;</span><span class="highlight-a">&gt;</span><span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;secondary&quot;</span><span class="highlight-a">&gt;</span>Secondary highlight<span class="highlight-a">&lt;/mark&gt;</span> inside a inline block.<span class="highlight-a">&lt;/mark&gt;</span></span></pre></div><div class="col-sm-12 col-md-6"><p><mark class="do">Do:</mark>&nbsp;You can nest a highlight inside another one, if the outer one is displayed as an inline-block.</p></div></div><div class="row dodos"><div class="col-sm-12 col-md-6"><pre><span class="code-line"><span class="highlight-a">&lt;mark</span> <span class="highlight-b">class</span>=<span class="highlight-c">&quot;primary inverse&quot;</span><span class="highlight-a">&gt;</span>Highlight<span class="highlight-a">&lt;/mark&gt;</span></span>
@ -623,6 +623,7 @@
</div><footer><p><strong>mini.css</strong> was designed and built by <a href="https://github.com/Chalarangelo" target="_blank">@Chalarangelo</a>. Source code licensed under the <a href="https://github.com/Chalarangelo/mini.css/blob/master/LICENSE">MIT License</a>.</p><p>Icons provided by <a href="https://feathericons.com/" target="_blank">Feather</a>. Search powered by <a href="http://fusejs.io/" target="_blank">Fuse.js</a>.</p></footer></main>
</div></div>
<script>
// Search script
var docs= [{id: "getting-started", keys: ["html","viewport","head","meta","getting started","introduction","browser support","installation","usage","setup","cdn","npm","yarn"] },{id: "common-textual-elements", keys: ["p","paragraph","text","textual elements","strong","bold","b","em","i","emphasis","italics","small","a","link","hr","horizontal rule","sub","subscript","sup","exponent","superscript","normalize","reset"] },{id: "heading", keys: ["heading","h1","h2","h3","h4","h5","h6","small","title","subtitle","subheading"] },{id: "images-captions", keys: ["img","image","responsive","responsiveness","caption","figure","figcaption"] },{id: "lists", keys: ["list","ul","ol","li"] },{id: "code-and-quotations", keys: ["code","pre","kbd","blockquote","quotation"] },{id: "grid", keys: ["grid","grid system","col","column","layout","row","container","small","medium","large","sm","md","lg","cols","predefined","offset","order","reorder","first","last","normal"] },{id: "cards", keys: ["card","row","section","container","col","column","small","large","fluid","warning","error"] },{id: "card-sections", keys: ["card","row","section","container","col","column","media","double-padded","dark"] },{id: "forms-and-input", keys: ["form","fieldset","legend","input","type","text","checkbox","radio","email","password","tel","input-group","input group","row","col","column","vertical","fluid","file","upload","select","textarea","option","label"] },{id: "buttons", keys: ["button","input","reset","submit","link","a","label","primary","secondary","tertiary","aria","small","large","inverse"] },{id: "input-grouping", keys: ["input group","input-group","vertical","fluid","input","button","button group","button-group"] },{id: "header", keys: ["navigation","header","sticky","button","logo","link"] },{id: "navigation-bar", keys: ["navigation","bar","nav","link"] },{id: "footer", keys: ["navigation","footer","sticky","link"] },{id: "drawer", keys: ["drawer","checkbox","toggle","close","drawer-toggle","drawer-close","menu","navigation","hamburger"] },{id: "text-highlighting", keys: ["mark","highlight","text highlighting","tag","primary","secondary","tertiary","inline-block"] }];
var options = {threshold:0.4, keys:["keys"]};
var fuse = new Fuse(docs,options);
@ -644,6 +645,16 @@
document.getElementById('search-style').innerHTML = '#no-results{display:none;}';
}
}
// Codepen prefill script
var el = document.querySelectorAll('.prefiller-example > pre');
el.forEach(e => e.innerHTML = '<form action="https://codepen.io/pen/define" method="POST" target="_blank" class="codepen-form">' +
'<input type="hidden" name="data" value=\'' + JSON.stringify({
html : e.innerText,
css_external : "https://cdnjs.cloudflare.com/ajax/libs/mini.css/3.0.0-alpha.1/mini-default.css"
}).replace(/"/g, "&quot;")
.replace(/'/g, "&apos;") + '\'>' +
'<input type="image" class="codepen-link" src="data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23424242%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolygon%20points%3D%2212%202%2022%208.5%2022%2015.5%2012%2022%202%2015.5%202%208.5%2012%202%22%3E%3C%2Fpolygon%3E%3Cline%20x1%3D%2212%22%20y1%3D%2222%22%20x2%3D%2212%22%20y2%3D%2215.5%22%3E%3C%2Fline%3E%3Cpolyline%20points%3D%2222%208.5%2012%2015.5%202%208.5%22%3E%3C%2Fpolyline%3E%3Cpolyline%20points%3D%222%2015.5%2012%208.5%2022%2015.5%22%3E%3C%2Fpolyline%3E%3Cline%20x1%3D%2212%22%20y1%3D%222%22%20x2%3D%2212%22%20y2%3D%228.5%22%3E%3C%2Fline%3E%3C%2Fsvg%3E" width="40" height="40" value="Open in Codepen">' +
'</form>' + e.innerHTML);
</script>
<style id="search-style">#no-results{display:none;}</style>
</body></html>

View file

@ -20,7 +20,7 @@
<h1 class="splash">mini<small>.css</small></h1>
<p class="splash">minimal, responsive, style-agnostic <br>CSS framework</p>
<p id="version-info">v3.0.0-alpha.1</p>
<a class="button splash">Get started</a>
<a class="button splash" href="docs">Get started</a>
</div>
<header class="row sticky">
<span class="col-md-1 col-lg-2"></span>

File diff suppressed because one or more lines are too long

View file

@ -430,6 +430,31 @@ header.row a span {
}
}
.codepen-form {
border: 0;
padding: 0;
position: relative;
height: 0;
overflow: visible;
}
.codepen-link {
border-radius: 0.125rem;
border: 0.0625rem solid #ddd;
background: #f0f0f0;
transition: background 0.3s;
cursor: pointer;
padding: 0.25rem;
top: -1.25rem;
right: -1.25rem;
position: absolute;
width: 1.75rem;
height: 1.75rem;
&:hover, &:focus {
background: #fafafa;
}
}
// I removed this, it seemed unnecessary, but keep it here just in case I want it back in later on?
// header .logo{
// padding-top: 0.1875rem;