Skip to content

Commit 1d1401e

Browse files
author
1000ch
committed
docs: tweaks
1 parent 2dbc721 commit 1d1401e

File tree

2 files changed

+92
-63
lines changed

2 files changed

+92
-63
lines changed

index.html

Lines changed: 90 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,104 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
66
<title>Grd - A CSS grid framework using Flexbox</title>
7-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/9.4.0/styles/github.min.css">
87
<link rel="stylesheet" href="https://1000ch.github.io/gh-pages.css/gh-pages.css">
98
<link rel="stylesheet" href="src/grd.css">
9+
<!-- Place this tag in your head or just before your close body tag. -->
10+
<script defer src="https://buttons.github.io/buttons.js"></script>
11+
<script defer src="https://unpkg.com/github-corner"></script>
12+
<script type="module">
13+
import XMarked from 'https://unpkg.com/x-marked';
14+
15+
customElements.define('x-marked', XMarked);
16+
17+
document.addEventListener('DOMContentLoaded', () => {
18+
const grid = document.querySelector('#grid');
19+
const align = document.querySelector('#align-items');
20+
const justify = document.querySelector('#justify-content');
21+
22+
function onGridChange() {
23+
grid.className = `Grid ${align.value} ${justify.value}`;
24+
}
25+
align.addEventListener('change', onGridChange);
26+
justify.addEventListener('change', onGridChange);
27+
28+
const template = document.querySelector('#template-cell');
29+
const addCell = document.querySelector('#add');
30+
const removeCell = document.querySelector('#remove');
31+
32+
addCell.addEventListener('click', () => {
33+
const cell = document.importNode(template.content, true);
34+
const select = cell.querySelector('select');
35+
grid.appendChild(cell);
36+
select.addEventListener('change', () => {
37+
select.parentNode.className = `Cell ${select.value}`;
38+
});
39+
});
40+
41+
removeCell.addEventListener('click', () => {
42+
if (grid.children.length) {
43+
grid.children[grid.children.length - 1].remove();
44+
}
45+
});
46+
47+
addCell.click();
48+
addCell.click();
49+
});
50+
51+
window.addEventListener('load', () => {
52+
const xmarked = document.querySelector('x-marked');
53+
const div = document.querySelector('div');
54+
const h2 = xmarked.shadowRoot.querySelector('h2');
55+
xmarked.shadowRoot.querySelector('div').insertBefore(div, h2);
56+
});
57+
</script>
1058
</head>
1159
<body>
12-
<div class="container">
13-
<h1><img src="logo.png" alt="Grd" style="width: 100%; max-width: 480px;"></h1>
60+
<div>
1461
<!-- Place this tag where you want the button to render. -->
1562
<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>
1663
<!-- Place this tag where you want the button to render. -->
1764
<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>
18-
<p>A CSS grid framework using Flexbox.</p>
19-
<ul>
20-
<li><strong>Simple</strong>: Provides just 2 base classes <code>Grid</code> and <code>Cell</code> and some modifiers.</li>
21-
<li><strong>Light-weight</strong>: <u>Only 321 bytes</u> (Gzipped).</li>
22-
<li><strong>Flexible</strong>: Easy to use Flexbox features.</li>
23-
</ul>
24-
<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>
25-
<h2>Live Demo</h2>
65+
</div>
66+
<github-corner>
67+
<a href="https://github.com/1000ch/grd">GitHub</a>
68+
</github-corner>
69+
<x-marked highlight class="container">
70+
# grd ![""](https://badge-size.herokuapp.com/1000ch/grd/master/src/grd.css.svg?compression=gzip)
71+
72+
![""](./logo.png)
73+
74+
A CSS grid framework using Flexbox.
75+
76+
- **Simple**: Provides just 2 base classes `Grid` and `Cell` and some modifiers.
77+
- **Light-weight**: Only 321 bytes (Gzipped).
78+
- **Flexible**: Easy to use Flexbox features.
79+
80+
[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).
81+
82+
If you want to use Grd with Sass, you can choose [grd-sass](https://github.com/1000ch/grd-sass) as Sass port.
83+
84+
## Install
85+
86+
```bash
87+
npm install grd
88+
```
89+
90+
## Usage
91+
92+
```html
93+
<div class="Grid">
94+
<div class="Cell -3of12">3of12</div>
95+
<div class="Cell -9of12">9of12</div>
96+
</div>
97+
```
98+
99+
## License
100+
101+
[MIT](https://1000ch.mit-license.org) © [Shogo Sensui](https://github.com/1000ch)
102+
</x-marked>
103+
<div class="container">
104+
<h2>Demo</h2>
26105
<div style="margin-bottom: 16px;">
27106
&lt;div class=&quot;Grid <select id="align-items">
28107
<option value="" selected>-</option>
@@ -69,55 +148,6 @@ <h2>Live Demo</h2>
69148
&lt;/div&gt;
70149
</div>
71150
</template>
72-
<h2>Install</h2>
73-
<pre><code class="bash">npm install grd</code></pre>
74-
<h2>Usage</h2>
75-
<pre><code class="html">&lt;div class=&quot;Grid&quot;&gt;
76-
&lt;div class=&quot;Cell -3of12&quot;&gt;3of12&lt;/div&gt;
77-
&lt;div class=&quot;Cell -9of12&quot;&gt;9of12&lt;/div&gt;
78-
&lt;/div&gt;</code></pre>
79-
<h2>License</h2>
80-
<p><a href="https://1000ch.mit-license.org" rel="nofollow">MIT</a> © <a href="https://github.com/1000ch">Shogo Sensui</a></p>
81151
</div>
82-
<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>
83-
<script>
84-
document.addEventListener('DOMContentLoaded', function() {
85-
var grid = document.querySelector('#grid');
86-
var align = document.querySelector('#align-items');
87-
var justify = document.querySelector('#justify-content');
88-
89-
function onGridChange() {
90-
grid.className = `Grid ${align.value} ${justify.value}`;
91-
}
92-
align.addEventListener('change', onGridChange);
93-
justify.addEventListener('change', onGridChange);
94-
95-
var template = document.querySelector('#template-cell');
96-
var add = document.querySelector('#add');
97-
var remove = document.querySelector('#remove');
98-
99-
add.addEventListener('click', function() {
100-
var cell = document.importNode(template.content, true);
101-
var select = cell.querySelector('select');
102-
grid.appendChild(cell);
103-
select.addEventListener('change', function() {
104-
select.parentNode.className = `Cell ${select.value}`;
105-
});
106-
});
107-
108-
remove.addEventListener('click', function() {
109-
if (grid.children.length) {
110-
grid.children[grid.children.length - 1].remove();
111-
}
112-
});
113-
114-
add.click();
115-
add.click();
116-
});
117-
</script>
118-
<script src="https://cdn.jsdelivr.net/highlight.js/9.4.0/highlight.min.js"></script>
119-
<script>hljs.initHighlightingOnLoad();</script>
120-
<!-- Place this tag in your head or just before your close body tag. -->
121-
<script defer src="https://buttons.github.io/buttons.js"></script>
122152
</body>
123153
</html>

readme.markdown

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
![Grd](logo.png)
1+
# grd ![""](https://badge-size.herokuapp.com/1000ch/grd/master/src/grd.css.svg?compression=gzip)
22

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

65
A CSS grid framework using Flexbox.
76

0 commit comments

Comments
 (0)