Skip to content

Commit

Permalink
feat(preset_tw): add rule of box-sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Jan 26, 2022
1 parent 7a12e01 commit c4b00f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions _docs/pages/docs/box_sizing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Box Sizing
description: Utilities for controlling how the browser should calculate an element's total size.
category: Layout
---
7 changes: 7 additions & 0 deletions preset_tw/rules/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ export const boxDecorations: Rule[] = [
[BOX_DECORATION_BREAK]: "slice",
}],
];

const BOX_SIZING = "box-sizing";

export const boxSizings: Rule[] = [
["box-border", { [BOX_SIZING]: "border-box" }],
["box-content", { [BOX_SIZING]: "content-box" }],
];
4 changes: 3 additions & 1 deletion preset_tw/rules/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { lineHeights } from "./line_height.ts";
import { columns } from "./columns.ts";
import { breakBefore } from "./break_before.ts";
import { breakAfter } from "./break_after.ts";
import { boxDecorations, breakInsides } from "./layout.ts";
import { boxDecorations, boxSizings, breakInsides } from "./layout.ts";

export const nestedRules = [
alignContents,
Expand Down Expand Up @@ -85,6 +85,7 @@ export const nestedRules = [
breakAfter,
breakInsides,
boxDecorations,
boxSizings,
];

export {
Expand All @@ -95,6 +96,7 @@ export {
backfaceVisibilities,
backgroundColors,
boxDecorations,
boxSizings,
breakAfter,
breakBefore,
breakInsides,
Expand Down

0 comments on commit c4b00f1

Please sign in to comment.