Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Feb 3, 2020
2 parents 80a78f1 + b0412a9 commit 8650ec2
Show file tree
Hide file tree
Showing 9 changed files with 244 additions and 74 deletions.
10 changes: 1 addition & 9 deletions docs/.vuepress/components/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div
:style="{
height: `${iframeHeight * iframeScale}px`
height: `${iframeHeight}px`
}">
<div class="preview__loader" v-if="isLoading" />
<iframe
Expand Down Expand Up @@ -68,14 +68,6 @@ import { log } from 'util';
`;
},
},
watch: {
/**
* Update the iframe sizes when the iframe scale changes
*/
iframeScale() {
this.setIframeHeight();
},
},
async mounted() {
// Get the content before anything
this.styles = await this.getStyles();
Expand Down
74 changes: 73 additions & 1 deletion docs/plugins/debug-outline.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
---
sidebar: auto
prev: false
next: ./grid.html
---

# Debug Outline

@todo
The debug outline plugins helps you visualise you HTML structure by adding colored outlines to all of them.

## Configuration

The plugin can be configured with the `theme.debugOutline` property:

```js{3}
module.exports = {
theme: {
debugOutline: false,
},
};
```

### `debugOutline`

- Type: `Boolean`
- Default: `false`

Whether the plugin is active or not.

## Examples

<Preview>
<div class="debug">
<div class="grid">
<div class="grid-row mb-2">
<div class="grid-col-3">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
</div>
<div class="grid-col-3">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
</div>
<div class="grid-col-3">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
</div>
<div class="grid-col-3">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
</div>
</div>
<div class="grid-row mb-2">
<div class="grid-col-4">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">4</div>
</div>
<div class="grid-col-4">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">4</div>
</div>
<div class="grid-col-4">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">4</div>
</div>
</div>
<div class="grid-row mb-2">
<div class="grid-col-6">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">6</div>
</div>
<div class="grid-col-6">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">6</div>
</div>
</div>
<div class="grid-row mb-2">
<div class="grid-col-12">
<div class="h-4 text-grey-600 bg-white flex items-center justify-center">12</div>
</div>
</div>
</div>
</div>
</Preview>
101 changes: 99 additions & 2 deletions docs/plugins/grid.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,111 @@
---
sidebar: auto
prev: ./debug-outline.html
next: ./typography.html
---

# Grid

@todo introduction
The grid plugin creates component classes to easily work with a 12 columns layout.

## Configuration

The plugin can be configured with the `theme.gridPlugin` property:

```js{3-7}
module.exports = {
theme: {
gridPlugin: {
columns: 12,
gutterWidth: 1,
gutterUnit: 'rem',
},
},
};
```

### `columns`

- Type: `Number`
- Default: `12`

The total number of columns.

### `gutterWidth`

- Type: `[ Number, String, Object ]`
- Default: `1`

The width of the grid's gutters provided as a **unitless number**. You can configure different widths per breakpoint by providing an object with the following schema:

```js
{
default: <value>,
...<screen>: <value,
}
```

The following configuration...

```js
module.exports = {
theme: {
screens: {
s: '600px',
m: '1200px',
l: '1800px',
},
gridPlugin: {
gutterWidth: {
default: 2,
m: 4,
},
},
},
};
```
...would generate a grid component with gutters of size `2` for viewports from `0` to `1200px` and of size `4` for viewports from `1200px` and up.

### `gutterUnit`

- Type: `String`
- Default: `'rem'`

The CSS unit used for the gutters.

## Classes

@todo
### Container

| Class | Description | Variants |
|-------------------|-------------|----------|
| `.grid` | @todo | `[]` |
| `.grid-nested` | @todo | `[]` |
| `.grid-no-gutter` | @todo | `[]` |

### Row

| Class | Description | Variants |
|---------------------|-------------|--------------|
| `.grid-row` | @todo | `responsive` |
| `.grid-row-start` | @todo | `responsive` |
| `.grid-row-center` | @todo | `responsive` |
| `.grid-row-end` | @todo | `responsive` |
| `.grid-row-stretch` | @todo | `responsive` |

### Columns

| Class | Description | Variants |
|----------------------|-------------|--------------|
| `.grid-pull-<count>` | @todo | `responsive` |
| `.grid-push-<count>` | @todo | `responsive` |
| `.grid-col-<count>` | @todo | `responsive` |
| `.grid-col-center` | @todo | `responsive` |
| `.grid-col-clear` | @todo | `responsive` |
| `.grid-col-left` | @todo | `responsive` |
| `.grid-col-no-clear` | @todo | `responsive` |
| `.grid-col-right` | @todo | `responsive` |


## Examples

Expand Down
2 changes: 2 additions & 0 deletions docs/plugins/typography.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
sidebar: auto
prev: ./grid.html
next: false
---

# Typography <Badge>Third party</Badge>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/tailwind-config",
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.6",
"description": "A custom Tailwind CSS config",
"main": "src/index.js",
"scripts": {
Expand Down
24 changes: 13 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ module.exports = {
*/
debugOutline: false,

/**
* Grid
*/
gridPlugin: {
gutterWidth: {
default: 1,
s: 2,
l: 3,
xxl: 4,
},
},

/**
* Breakpoints
*/
Expand Down Expand Up @@ -167,17 +179,7 @@ module.exports = {
},
plugins: [
require('./plugins/debug-outline')(),
require('./plugins/grid')({
gridGutters: {
default: '1',
xs: '1',
s: '2',
m: '2',
l: '3',
xl: '3',
xxl: '4',
},
}),
require('./plugins/grid')(),
/**
* Tailwind CSS typograpy plugin.
* @see https://github.com/benface/tailwindcss-typography
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/debug-outline.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*
* @package @studiometa/tailwind-config
*/
module.exports = function debugOutline() {
return function addDebugOutlineBase({ addBase, theme }) {
if (theme('debugOutline')) {
module.exports = function debugOutlinePluginFactory() {
return function debugOutlinePlugin({ addBase, theme }) {
if (theme('debugOutline', false)) {
addBase([
{
'.debug': {
Expand Down
Loading

0 comments on commit 8650ec2

Please sign in to comment.