diff --git a/Gruntfile.js b/Gruntfile.js index d0f0e99..3282588 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,8 +9,6 @@ var plugins = fs.readdirSync(__dirname + "/src/plugins").filter(function(one){ return info; }); -console.log("Plugins: ", plugins); - // This builds the library itself module.exports = function (grunt) { @@ -82,13 +80,13 @@ module.exports = function (grunt) { // get the current concat config var concat = { test: { src: [], dest: 'test/tests.html' }, - docs: { src: [], dest: 'documentation.md' }, + docs: { src: ['src/readme.md'], dest: 'documentation.md' }, preview: { src: [], dest: 'preview.html' } }; fs.readdirSync(__dirname + "/src/plugins").forEach(function(name, i){ var test = 'src/plugins/' + name + '/test.html'; - var doc = 'src/plugins/' + name + '/documentation.md'; + var doc = 'src/plugins/' + name + '/readme.md'; var preview = 'src/plugins/' + name + '/description.html'; diff --git a/documentation.html b/documentation.html index 4585a17..64ff3da 100644 --- a/documentation.html +++ b/documentation.html @@ -1,306 +1,542 @@ -Plugins - Picnic CSS

Documentation

How to include Picnic CSS and what plugins are included

Button

button, .button, [type=submit]

An element that looks like it can be clicked and will perform some action.

- Normal - Success - Warning - Error -

- -

- Icon +Plugins - Picnic CSS

Picnic CSS

+

Picnic CSS is a lightweight and beautiful CSS library

+

Buttons

+

They can be of different colors and types:

+
<button>Button</button>
+<button class='success'>Success</button>
+<button class='warning'>Warning</button>
+<button class='error'>Error</button>
+<button disabled>Disabled</button>
+
+
<button>Button</button>
+<a class="button">Link</a>
+<input value="Submit" type="submit">
+<label>
+  <input type="checkbox">
+  <span class="toggle button">Toggle</span>
+</label>
+
+

Pseudo buttons

+

Allows for seemingly links to behave as buttons:

+
<button class="pseudo">Button</button>
+<a class="pseudo button">Link</a>
+<input class="pseudo" value="Submit" type="submit">
+<label>
+    <input type="checkbox">
+    <span class="toggle pseudo button">Toggle</span>
+</label>
+
+

Hack it

+

You only have to define a single color base for new colors. The :hover and :active status are handled as overlays for consistency and simplicity

+
<button class="myCoolButton">My Cool Button</button>
+
+
.myCoolButton {
+    background: #85144b;
+}
+
+

To create a larger button you only need to make the font inside it larger. The paddings are set in em so the whole button stays in great shape:

+
<button class="mainButton">Large button</button><br>
+<button>Normal button</button><br>
+<button class="shyButton">Small button</button>
+
+
.mainButton {
+    font-size: 1.5em;
+}
+.shyButton {
+    font-size: .75em;
+}
+
+

To change the color of the pseudo-color on hover:

+
<button class="pseudo cool">Pseudo personal</button>
+
+
.cool:hover,
+.cool:active,
+.cool:focus {
+    background: #cff;
+}
+
+

Card

+

A card is a self-contained, replicable type. It works great with other of its kind. It can consist of only one element or many of them:

+
<article class="card">
+  <header>
+    <h3>A really simple h3</h3>
+  </header>
+</article>
+
+
<article class="card">
+  <header>
+    <button>Love</button>
+    <button class="dangerous">Hate</button>
+  </header>
+</article>
+
+
<article class="card">
+  <header>
+    <h3>Forest</h3>
+  </header>
+  <footer>
+    <button>Like</button>
+  </footer>
+</article>
+
+
<article class="card">
+  <img src="/web/img/forest.jpg">
+  <footer>
+    <h3>Misty Forest</h3>
+    <button>Like</button>
+  </footer>
+</article>
+
+

Checkbox

+

Display an inline checkbox with a nice default style

+
<label>
+  <input type="checkbox">
+  <span class="checkable">Check me out (;</span>
+</label>
+
+
<label>
+  <input type="checkbox" checked>
+  <span class="checkable">Uncheck me</span>
+</label>
+
+

Usage

+

This plugin, while experimental in the past, is mature now. Use a normal checkbox followed by any other element with the class checkable. The element that follows the checkbox will receive the pseudo classes so it should be able to do so. We recommend a <span> or <label>. Here we use the label around them for making the <input> change state when you click on this folowing element.

+
<label>
+  <input type="checkbox">
+  <span class="checkable">Checkbox text</span>
+</label>
+
+

But you can also use a label and reference the original input:

+
<input id="checkboxdemo" type="checkbox">
+<label for="checkboxdemo" class="checkable">Checkbox text</label>
+
+

Javascript

+

You do not need javascript since we are using the native elements and not setting display: none purposefully. However, you can still use javascript as normal to retrieve the checked elements.

+

- Disabled - Pseudo -

Card

.card

A self-contained, independent element. It works great with others of its kind.

-
-
- -
-

A quiet forest

- - -
-
-
-
-
- -
-

The Albufera

- - -
-
-
-

Checkbox

[type=checkbox]

The classical checkbox revisited for bigger and coherent shape.


-

DropimageJS

.dropimage

Allows you to click the element or drop an image on it to upload the image and display a preview.

-
- -
-
- -
-
- + +

-

Grids

.row

-
[half]
-
[half]
-
- -
-
[third]
-
[third]
-
[third]
-
- -
-
[fourth]
-
[fourth]
-
[fourth]
-
[fourth]
-
- -
-
[fifth]
-
[fifth]
-
[fifth]
-
[fifth]
-
[fifth]
-

Input and textarea

input, textarea

-
- -
-
- -
-
-
-
- -
-
- -
-
-
- -
-

Label

.label

An element to display some short relevant information

h1 is important - Normal -

-

h2 is important too - Success -

-

Is h3 important? - Warning -

-

h4 is not so important - Error -

-

p is normal text - Normal -

-

Modal

.modal

A pop-up like element that displays important information and focuses user's attention on it.

- -

Navigation bar

nav

Gives access to common links of the website in an easy way from the top of the page.

Radiobutton

[type=radio]

Allows to choose one element from several of them.

- -

-

- -

Select

.select

A typical dropdown, now enhanced with a custom down arrow and coherent style.

Stack

.stack

Allow to set one element on top of each other and gives them a sense of unity.

-
- - - - -
-
- - - - + + +
<nav class="demo">
+  <a href="#" class="brand">
+    <img class="logo" src="/web/img/basket.png" />
+    <span>Picnic CSS</span>
+  </a>
+
+  <!-- responsive-->
+  <input id="bmenub" type="checkbox" class="show">
+  <label for="bmenub" class="burger pseudo button">menu</label>
+
+  <div class="menu">
+    <a href="#" class="pseudo button icon-picture">Demo</a>
+    <a href="#" class="button icon-puzzle">Plugins</a>
+  </div>
+</nav>
+

Responsive

+

The nav is responsive by default. The text inside the <label> can be changed for the following characters for a different effect (source):

+
    +
  • Identical to &#8801; (safe on mobile):
  • +
  • Trigram for heaven &#9776;:
  • +
  • Any other:
  • +
+ +

Thanks to a vertical-align trick, you can set it up to any height you want:

+
nav.imponent {
+  padding: 2em 0;
+}
+
+.imponent .logo {
+  height: 3em;
+}
+
+
<nav class="demo imponent">
+  <a href="#" class="brand">
+    <img class="logo" src="/web/img/basket.png" />
+    <span>Picnic CSS</span>
+  </a>
+</nav>
+
+

Form elements

+

Just get anything you want inside the nav, most things should worl

+

Table

table

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameCityAge
FranciscoValencia, Spain23
EveSan Francisco, USA22
MartinNew York, USA45
SarahLondon, UK25

Tabs

.tabs

Tab system for webpage

- - - / - - - / - - -
-
-
-
-

First tab

-
-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. -

-
-
- -
-
-
-

Second tab

-
-

- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. -

-
-
- -
-
-
-

Third tab

-
-

- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -

-
-
+ + +

Tooltip

[data-tooltip]

An element that displays extra information when you put your mouse on it.

- - -
-HTML - - - - -Javascript - - // Pure javascript - document.querySelector('form').onsubmit = function(e){ - e.preventDefault(); - var tosAccepted = document.querySelector('.tos').checked; - alert(tosAccepted); - } - - // jQuery - $("form").on('submit', function(e){ - e.preventDefault(); - var tosAccepted = $('.tos').is(':checked'); - alert(tosAccepted); - }); - - +```js +// Pure javascript +document.querySelector('form').onsubmit = function(e){ + e.preventDefault(); + alert(document.querySelector('input.tos').checked); +} -# Drop image +// jQuery +$("form").on('submit', function(e){ + e.preventDefault(); + alert($('input.tos').is(':checked')); +}); +``` +## Drop image Allows you to add a file input element that can receive an image drop and clicks with native elements. However, it needs some javascript to show the dropped image: -
- -
- - - - - +```html + +``` -## Javascript +### Javascript This is the javascript you need for multiple elements: - window.onload = function(){ - [].forEach.call(document.querySelectorAll('.dropimage'), function(img){ - img.onchange = function(e){ - var inputfile = this, reader = new FileReader(); - reader.onloadend = function(){ - inputfile.style['background-image'] = 'url('+reader.result+')'; - } - reader.readAsDataURL(e.target.files[0]); - } - }); - }; - - + reader.readAsDataURL(e.target.files[0]); + } + }); +}; +``` -## Hack it +### Hack it Do you want round pictures? No problem, just do this: - .profile { - border-radius: 50%; /* Make it a circle */ - padding-bottom: 100%; /* 100% height (ratio 1) */ - } +```css +.profile { + border-radius: 50%; /* Make it a circle */ + padding-bottom: 100%; /* 100% height (ratio 1) */ +} +``` To get this: - - -
-
- -
-
- -
-
- -
-
- +```html + +``` Make it smaller - .miniprofile { - border-radius: 50%; /* Make it a circle */ - margin: 0 auto; /* Center horizontally */ - width: 60%; /* 60% width */ - padding-bottom: 60%; /* 60% height */ - } - - - -
-
- -
-
- -
-
- -
-
+```css +.miniprofile { + border-radius: 50%; /* Make it a circle */ + margin: 0 auto; /* Center horizontally */ + width: 60%; /* 60% width */ + padding-bottom: 60%; /* 60% height */ +} +``` +```html + +``` ## Grids @@ -487,359 +273,132 @@ A simple and responsive grid based on [ungrid](http://chrisnager.github.io/ungri Note: the class `.demo` is added for the fancy colors. -
-
[one]
-
- -
-
[two]
-
[two]
-
- -
-
[three]
-
[three]
-
[three]
-
- -
-
[four]
-
[four]
-
[four]
-
[four]
-
- -
-
[five]
-
[five]
-
[five]
-
[five]
-
[five]
-
- -
-
.half
-
[empty]
-
- -
-
.third
-
[empty]
-
- -
-
.fourth
-
[empty]
-
- -
-
.fifth
-
[empty]
-
- -
-
.two-fifth
-
[empty]
-
+### Evenly stacked grids -
-
.three-fifth
-
[empty]
-
+To display few grids with the same width, just add as many grid elements as you want as children of `.row`: +```html
-
.two-third
-
[empty]
+
[1]
-
.three-fourth
-
[empty]
+
[2]
[2]
-
.four-fifth
-
[empty]
+
[3]
[3]
[3]
- - -## Evenly stacked grids - -To display few grids with the same width, just do: -
-
[one]
+
[4]
[4]
[4]
[4]
- -
-
[two]
-
[two]
-
- -
-
[three]
-
[three]
-
[three]
-
- -
-
[four]
-
[four]
-
[four]
-
[four]
-
- -
-
[five]
-
[five]
-
[five]
-
[five]
-
[five]
-
- - -
-
[one]
-
- -
-
[two]
-
[two]
-
- -
-
[three]
-
[three]
-
[three]
-
- -
-
[four]
-
[four]
-
[four]
-
[four]
-
- -
-
[five]
-
[five]
-
[five]
-
[five]
-
[five]
-
+``` -## Grid classes +### Grid classes More fine-grain control over grids +```html
-
.half
-
[empty]
+
.half
[ ]
-
.third
-
[empty]
+
.third
[ ]
-
.fourth
-
[empty]
+
.fourth
[ ]
-
.fifth
-
[empty]
+
.fifth
[ ]
-
.two-fifth
-
[empty]
+
.two-fifth
[ ]
-
.three-fifth
-
[empty]
+
.three-fifth
[ ]
-
.two-third
-
[empty]
+
.two-third
[ ]
-
.three-fourth
-
[empty]
+
.three-fourth
[ ]
-
.four-fifth
-
[empty]
+
.four-fifth
[ ]
+``` -
-
.half
-
[empty]
-
-
-
.third
-
[empty]
-
- -
-
.fourth
-
[empty]
-
- -
-
.fifth
-
[empty]
-
- -
-
.two-fifth
-
[empty]
-
- -
-
.three-fifth
-
[empty]
-
- -
-
.two-third
-
[empty]
-
- -
-
.three-fourth
-
[empty]
-
- -
-
.four-fifth
-
[empty]
-
- - - -## Hack it +### Hack it Combine a class with several cells for this distribution: +```html
-
.half
-
[empty]
-
[empty]
+
.half
[ ]
[ ]
- -
-
.half
-
[empty]
-
[empty]
-
+``` Set your own width for your grid in any unit you want: -
-
.myCoolGrid
-
[empty]
-
- -
-
.myGreatGrid
-
[empty]
-
- - - - .myCoolGrid { - width: 31.56%; - } - - .myGreatGrid { - width: 700px; - } -#Input +```html +
+
.myCoolGrid
[ ]
+
+``` +## Input Simple (or not) text form elements: - - - - -##Elements - -The most basic usage: +```html + + +``` - -
- - -
+ +## Label +An element to display some short relevant information on the side of other element -# Label +```html +

header 1 Normal

+

header 2 Success

+

header 3 Warning

+

header 4 Error

+

paragraph Normal

+``` -An element to display some short relevant information on the side of other element -

h1 is important - Normal -

-

h2 is important too - Success -

-

Is h3 important? - Warning -

-

h4 is not so important - Error -

-

p is normal text - Normal -

- -

h1 is important - Normal -

-

h2 is important too - Success -

-

Is h3 important? - Warning -

-

h4 is not so important - Error -

-

p is normal text - Normal -

- - -# Modal +## Modal The modal is pure CSS, which makes the html quite ugly actually. However it does work. To try it, press the button: -

- - +```html +

- -

- - -## Installation - -Include it by adding `+modal` to your current installation: - - http://www.picnicss.com/nut/picnic_3+modal.min.css - - - -## Markup - -This is the markup for the example above: - - - - - - -## Multiple modals - -

- -

- - - -

- -

- - - - - +``` -## Javascript +### Javascript As always, there is **no javascript**. However, a little bit of javascript could enhance the experience allowing to close the modal by pressing `ESC`. - document.onkeydown = function(e){ - if (e.keyCode == 27) { - var modals = document.querySelectorAll('.modal > [type=checkbox]'); - for (var i = 0; i < modals.length; i++) { - modals[i].checked = false; - } - } - } - - +```js +document.onkeydown = function(e){ + if (e.keyCode == 27) { + var mods = document.querySelectorAll('.modal > [type=checkbox]'); + [].forEach.call(mods, function(mod){ mod.checked = false; }); + } +} +``` -# Nav +## Nav @@ -1038,7 +463,7 @@ A responsive, pure css navigation menu: - - -## Installation - -Include it by adding `+nav` to your current installation: - - http://www.picnicss.com/nut/picnic_3+nav.min.css - - - -## Markup - -This is the markup for the example above: - - - - - -## Responsive - -The nav is responsive by default. The text inside the `