Skip to content

Commit

Permalink
add px-based sizes (#493)
Browse files Browse the repository at this point in the history
* add px-based sizes

* change heading capitalization to match others

* replace size-px with size-static

* revert to size-px instead of size-static
  • Loading branch information
Brian-Pob authored Apr 17, 2024
1 parent 1561667 commit 00e0242
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
26 changes: 25 additions & 1 deletion docsite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2935,7 +2935,7 @@ <h6>Push Out</h6>
<section id="sizes">
<header>
<h2>Sizes</h2>
<p>No <code class="language-css">px</code> here, relative units all the way. <code>0</code>s are unsafe but common negative values, while 1-N are safe.</p>
<p>Sizes use relative units by default with <code class="language-css">rem</code> but static, <code class="language-css">px</code>-based units are also available. <code>0</code>s are unsafe but common negative values, while 1-N are safe.</p>
</header>
<div>
<h5>The Props</h5>
Expand Down Expand Up @@ -2975,6 +2975,30 @@ <h5>Document Relative Sizes</h5>
</code></pre>
</div>
</div>
<div>
<h5>Static Sizes</h5>
<div class="var-examples">
<pre class="language-css"><code>
--size-px-000: -8px;
--size-px-00: -4px;
--size-px-1: 4px;
--size-px-2: 8px;
--size-px-3: 16px;
--size-px-4: 20px;
--size-px-5: 24px;
--size-px-6: 28px;
--size-px-7: 32px;
--size-px-8: 48px;
--size-px-9: 64px;
--size-px-10: 80px;
--size-px-11: 120px;
--size-px-12: 160px;
--size-px-13: 240px;
--size-px-14: 320px;
--size-px-15: 480px;
</code></pre>
</div>
</div>
<div>
<h5>Usage Sample</h5>
<pre class="language-css"><code>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

17 changes: 17 additions & 0 deletions src/props.sizes.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
--size-13: 15rem;
--size-14: 20rem;
--size-15: 30rem;
--size-px-000: -8px;
--size-px-00: -4px;
--size-px-1: 4px;
--size-px-2: 8px;
--size-px-3: 16px;
--size-px-4: 20px;
--size-px-5: 24px;
--size-px-6: 28px;
--size-px-7: 32px;
--size-px-8: 48px;
--size-px-9: 64px;
--size-px-10: 80px;
--size-px-11: 120px;
--size-px-12: 160px;
--size-px-13: 240px;
--size-px-14: 320px;
--size-px-15: 480px;
--size-fluid-1: clamp(.5rem, 1vw, 1rem);
--size-fluid-2: clamp(1rem, 2vw, 1.5rem);
--size-fluid-3: clamp(1.5rem, 3vw, 2rem);
Expand Down
18 changes: 18 additions & 0 deletions src/props.sizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ export default {
'--size-14': '20rem',
'--size-15': '30rem',

'--size-px-000': '-8px',
'--size-px-00': '-4px',
'--size-px-1': '4px',
'--size-px-2': '8px',
'--size-px-3': '16px',
'--size-px-4': '20px',
'--size-px-5': '24px',
'--size-px-6': '28px',
'--size-px-7': '32px',
'--size-px-8': '48px',
'--size-px-9': '64px',
'--size-px-10': '80px',
'--size-px-11': '120px',
'--size-px-12': '160px',
'--size-px-13': '240px',
'--size-px-14': '320px',
'--size-px-15': '480px',

'--size-fluid-1': 'clamp(.5rem, 1vw, 1rem)',
'--size-fluid-2': 'clamp(1rem, 2vw, 1.5rem)',
'--size-fluid-3': 'clamp(1.5rem, 3vw, 2rem)',
Expand Down
4 changes: 2 additions & 2 deletions test/basic.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const OpenProps = require('../dist/open-props.cjs')
const OPtokens = require('../open-props.tokens.json')

test('Should have an all included import', t => {
t.is(Object.keys(OpenProps).length, 1658)
t.is(Object.keys(OpenProps).length, 1692)
})

test('Import should have animations', async t => {
Expand All @@ -24,7 +24,7 @@ test('Import should have colors', async t => {
})

test('JSON Import should have colors', async t => {
t.is(Object.keys(OPtokens).length, 439)
t.is(Object.keys(OPtokens).length, 456)
t.assert(Object.keys(OPtokens).includes('--orange-0'))
})

Expand Down

0 comments on commit 00e0242

Please sign in to comment.