Skip to content

Commit

Permalink
docs: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Jul 18, 2020
1 parent 9feb3b0 commit 18e3216
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 63 deletions.
150 changes: 90 additions & 60 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,104 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title>Grd - A CSS grid framework using Flexbox</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/9.4.0/styles/github.min.css">
<link rel="stylesheet" href="https://1000ch.github.io/gh-pages.css/gh-pages.css">
<link rel="stylesheet" href="src/grd.css">
<!-- Place this tag in your head or just before your close body tag. -->
<script defer src="https://buttons.github.io/buttons.js"></script>
<script defer src="https://unpkg.com/github-corner"></script>
<script type="module">
import XMarked from 'https://unpkg.com/x-marked';

customElements.define('x-marked', XMarked);

document.addEventListener('DOMContentLoaded', () => {
const grid = document.querySelector('#grid');
const align = document.querySelector('#align-items');
const justify = document.querySelector('#justify-content');

function onGridChange() {
grid.className = `Grid ${align.value} ${justify.value}`;
}
align.addEventListener('change', onGridChange);
justify.addEventListener('change', onGridChange);

const template = document.querySelector('#template-cell');
const addCell = document.querySelector('#add');
const removeCell = document.querySelector('#remove');

addCell.addEventListener('click', () => {
const cell = document.importNode(template.content, true);
const select = cell.querySelector('select');
grid.appendChild(cell);
select.addEventListener('change', () => {
select.parentNode.className = `Cell ${select.value}`;
});
});

removeCell.addEventListener('click', () => {
if (grid.children.length) {
grid.children[grid.children.length - 1].remove();
}
});

addCell.click();
addCell.click();
});

window.addEventListener('load', () => {
const xmarked = document.querySelector('x-marked');
const div = document.querySelector('div');
const h2 = xmarked.shadowRoot.querySelector('h2');
xmarked.shadowRoot.querySelector('div').insertBefore(div, h2);
});
</script>
</head>
<body>
<div class="container">
<h1><img src="logo.png" alt="Grd" style="width: 100%; max-width: 480px;"></h1>
<div>
<!-- Place this tag where you want the button to render. -->
<a class="github-button" href="https://github.com/1000ch/grd" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star 1000ch/grd on GitHub">Star</a>
<!-- Place this tag where you want the button to render. -->
<a class="github-button" href="https://github.com/1000ch" data-size="large" data-show-count="true" aria-label="Follow @1000ch on GitHub">Follow @1000ch</a>
<p>A CSS grid framework using Flexbox.</p>
<ul>
<li><strong>Simple</strong>: Provides just 2 base classes <code>Grid</code> and <code>Cell</code> and some modifiers.</li>
<li><strong>Light-weight</strong>: <u>Only 321 bytes</u> (Gzipped).</li>
<li><strong>Flexible</strong>: Easy to use Flexbox features.</li>
</ul>
<p><a href="http://caniuse.com/#search=flex">Flexible Box Layout Module</a> and <a href="http://caniuse.com/#search=calc"><code>calc()</code> as CSS unit value</a> used in Grd are available on modern browsers (Chrome, Firefox, Safari, Opera, Edge and IE11).</p>
<h2>Live Demo</h2>
</div>
<github-corner>
<a href="https://github.com/1000ch/grd">GitHub</a>
</github-corner>
<x-marked highlight class="container">
# grd ![""](https://badge-size.herokuapp.com/1000ch/grd/master/src/grd.css.svg?compression=gzip)

![""](./logo.png)

A CSS grid framework using Flexbox.

- **Simple**: Provides just 2 base classes `Grid` and `Cell` and some modifiers.
- **Light-weight**: Only 321 bytes (Gzipped).
- **Flexible**: Easy to use Flexbox features.

[Flexible Box Layout Module](http://caniuse.com/#search=flex) and [`calc()` as CSS unit value](http://caniuse.com/#search=calc) used in Grd are available on modern browsers (Chrome, Firefox, Safari, Opera, Edge and IE11).

If you want to use Grd with Sass, you can choose [grd-sass](https://github.com/1000ch/grd-sass) as Sass port.

## Install

```bash
npm install grd
```

## Usage

```html
<div class="Grid">
<div class="Cell -3of12">3of12</div>
<div class="Cell -9of12">9of12</div>
</div>
```

## License

[MIT](https://1000ch.mit-license.org) © [Shogo Sensui](https://github.com/1000ch)
</x-marked>
<div class="container">
<h2>Demo</h2>
<div style="margin-bottom: 16px;">
&lt;div class=&quot;Grid <select id="align-items">
<option value="" selected>-</option>
Expand Down Expand Up @@ -69,55 +148,6 @@ <h2>Live Demo</h2>
&lt;/div&gt;
</div>
</template>
<h2>Install</h2>
<pre><code class="bash">npm install grd</code></pre>
<h2>Usage</h2>
<pre><code class="html">&lt;div class=&quot;Grid&quot;&gt;
&lt;div class=&quot;Cell -3of12&quot;&gt;3of12&lt;/div&gt;
&lt;div class=&quot;Cell -9of12&quot;&gt;9of12&lt;/div&gt;
&lt;/div&gt;</code></pre>
<h2>License</h2>
<p><a href="https://1000ch.mit-license.org" rel="nofollow">MIT</a> © <a href="https://github.com/1000ch">Shogo Sensui</a></p>
</div>
<a href="https://github.com/1000ch/grd" class="github-corner"><svg width="80" height="80" viewbox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
var grid = document.querySelector('#grid');
var align = document.querySelector('#align-items');
var justify = document.querySelector('#justify-content');

function onGridChange() {
grid.className = `Grid ${align.value} ${justify.value}`;
}
align.addEventListener('change', onGridChange);
justify.addEventListener('change', onGridChange);

var template = document.querySelector('#template-cell');
var add = document.querySelector('#add');
var remove = document.querySelector('#remove');

add.addEventListener('click', function() {
var cell = document.importNode(template.content, true);
var select = cell.querySelector('select');
grid.appendChild(cell);
select.addEventListener('change', function() {
select.parentNode.className = `Cell ${select.value}`;
});
});

remove.addEventListener('click', function() {
if (grid.children.length) {
grid.children[grid.children.length - 1].remove();
}
});

add.click();
add.click();
});
</script>
<script src="https://cdn.jsdelivr.net/highlight.js/9.4.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Place this tag in your head or just before your close body tag. -->
<script defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>
5 changes: 2 additions & 3 deletions readme.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
![Grd](logo.png)
# grd ![""](https://badge-size.herokuapp.com/1000ch/grd/master/src/grd.css.svg?compression=gzip)

![](https://badge-size.herokuapp.com/1000ch/grd/master/src/grd.css.svg?compression=gzip)
[![devDependency Status](https://david-dm.org/1000ch/grd/dev-status.svg)](https://david-dm.org/1000ch/grd?type=dev)
![""](./logo.png)

A CSS grid framework using Flexbox.

Expand Down

0 comments on commit 18e3216

Please sign in to comment.