Skip to content

Commit ab9b789

Browse files
authored
Spacing guidelines (#9)
* set spacing system to an 8px base unit * add ds css variables for spacing system * general spacing updates * aditional spacing updates * fix button size error * correct button size
1 parent 59725a1 commit ab9b789

File tree

11 files changed

+69
-52
lines changed

11 files changed

+69
-52
lines changed

src/css/base.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body {
2626
tab-size: 4;
2727
word-wrap: anywhere; /* aka overflow-wrap; used when hyphens are disabled or aren't sufficient */
2828
/* ds-text-body */
29-
font-size: 1rem;
29+
font-size: var(--ds-space-2);
3030
font-weight: 400;
3131
}
3232

src/css/breadcrumbs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ a + .breadcrumbs {
2929

3030
.breadcrumbs li::after {
3131
content: "/";
32-
padding: 0 0.5rem;
32+
padding: 0 var(--ds-space-1);
3333
}
3434

3535
.breadcrumbs li:last-of-type::after {

src/css/doc.css

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
max-width: var(--doc-max-width);
88
padding-right: calc(24 / var(--rem-base) * 1rem);
99
padding-left: calc(24 / var(--rem-base) * 1rem);
10-
padding-bottom: 4rem;
10+
padding-bottom: var(--ds-space-10);
1111
}
1212

1313
@media screen and (min-width: 1024px) {
@@ -217,11 +217,11 @@
217217
}
218218

219219
.doc .float-gap.right {
220-
margin: 0 1rem 1rem 0;
220+
margin: 0 var(--ds-space-2) var(--ds-space-2) 0;
221221
}
222222

223223
.doc .float-gap.left {
224-
margin: 0 0 1rem 1rem;
224+
margin: 0 0 var(--ds-space-2) var(--ds-space-2);
225225
}
226226

227227
.doc .float-group::after {
@@ -283,7 +283,7 @@
283283

284284
.doc table.tableblock th,
285285
.doc table.tableblock td {
286-
padding: 0.5rem;
286+
padding: var(--ds-space-1h) var(--ds-space-2);
287287
}
288288

289289
.doc table.tableblock,
@@ -376,7 +376,7 @@
376376
}
377377

378378
.doc .admonitionblock {
379-
margin: 1.4rem 0 0;
379+
margin: var(--ds-space-3) 0 0;
380380
}
381381

382382
.doc .admonitionblock p,
@@ -400,7 +400,7 @@
400400
}
401401

402402
.doc .admonitionblock td.content {
403-
padding: 1rem 1rem 0.75rem;
403+
padding: var(--ds-space-2);
404404
background: var(--admonition-background);
405405
width: 100%;
406406
word-wrap: anywhere;
@@ -411,12 +411,12 @@
411411
top: 0;
412412
left: 0;
413413
font-size: calc(15 / var(--rem-base) * 1rem);
414-
padding: 0 0.5rem;
415-
height: 1.25rem;
414+
padding: 0 var(--ds-space-1);
415+
height: var(--ds-space-2h);
416416
line-height: 1;
417417
font-weight: var(--admonition-label-font-weight);
418418
text-transform: uppercase;
419-
border-radius: 0.45rem;
419+
border-radius: var(--ds-space-1);
420420
transform: translate(-0.5rem, -50%);
421421
}
422422

@@ -509,13 +509,13 @@
509509
}
510510

511511
.doc .quoteblock {
512-
padding: 0.25rem 2rem 1.25rem;
512+
padding: var(--ds-space-h) var(--ds-space-4) var(--ds-space-2h);
513513
}
514514

515515
.doc .quoteblock .attribution {
516516
color: var(--quote-attribution-font-color);
517517
font-size: calc(15 / var(--rem-base) * 1rem);
518-
margin-top: 0.75rem;
518+
margin-top: var(--ds-space-1h);
519519
}
520520

521521
.doc .quoteblock blockquote {
@@ -532,7 +532,7 @@
532532

533533
.doc .verseblock {
534534
font-size: 1em;
535-
padding: 1rem 2rem;
535+
padding: var(--ds-space-2) var(--ds-space-4);
536536
}
537537

538538
.doc .verseblock pre {
@@ -543,7 +543,7 @@
543543
.doc ol,
544544
.doc ul {
545545
margin: 0;
546-
padding: 0 0 0 2rem;
546+
padding: 0 0 0 var(--ds-space-4);
547547
}
548548

549549
.doc ul.checklist,
@@ -558,7 +558,7 @@
558558

559559
.doc ul.no-bullet,
560560
.doc ol.unnumbered {
561-
padding-left: 1.25rem;
561+
padding-left: var(--ds-space-2h);
562562
}
563563

564564
.doc ul.unstyled,
@@ -613,7 +613,7 @@
613613
}
614614

615615
.doc ul.checklist {
616-
padding-left: 1.75rem;
616+
padding-left: var(--ds-space-2h);
617617
}
618618

619619
.doc ul.checklist p > i.fa-check-square-o:first-child,
@@ -641,12 +641,12 @@
641641
.doc .ulist .dlist,
642642
.doc .ulist .olist,
643643
.doc .ulist .ulist {
644-
margin-top: 0.5rem;
644+
margin-top: var(--ds-space-1);
645645
}
646646

647647
.doc .olist li + li,
648648
.doc .ulist li + li {
649-
margin-top: 0.5rem;
649+
margin-top: var(--ds-space-1);
650650
}
651651

652652
.doc .ulist .listingblock,
@@ -674,29 +674,30 @@
674674

675675
.doc .tableblock caption {
676676
text-align: left;
677+
margin-bottom: var(--ds-space-3);
677678
}
678679

679680
.doc .ulist .title,
680681
.doc .olist .title {
681682
font-style: var(--caption-font-style);
682683
font-weight: var(--caption-font-weight);
683-
margin-bottom: 0.25rem;
684+
margin-bottom: var(--ds-space-h);
684685
}
685686

686687
.doc .imageblock .title {
687-
margin-top: 0.5rem;
688+
margin-top: var(--ds-space-1);
688689
padding-bottom: 0;
689690
}
690691

691692
.doc details {
692-
margin-left: 1rem;
693+
margin-left: var(--ds-space-2);
693694
}
694695

695696
.doc details > summary {
696697
display: block;
697698
position: relative;
698699
line-height: var(--doc-line-height);
699-
margin-bottom: 0.5rem;
700+
margin-bottom: var(--ds-space-1);
700701
}
701702

702703
.doc details > summary::-webkit-details-marker {
@@ -710,27 +711,27 @@
710711
border-width: 0.3em 0 0.3em 0.5em;
711712
position: absolute;
712713
top: calc((var(--doc-line-height) * 0.5 - 0.3) * 1em);
713-
left: -1rem;
714+
left: calc(var(--ds-space-2) * -1);
714715
transform: translateX(15%);
715716
}
716717

717718
.doc details[open] > summary::before {
718719
border-color: currentColor transparent transparent;
719-
border-width: 0.5rem 0.3rem 0;
720+
border-width: 1rem 0.6rem 0;
720721
transform: translateY(15%);
721722
}
722723

723724
.doc details > summary::after {
724725
content: "";
725-
width: 1rem;
726+
width: var(--ds-space-2);
726727
height: 1em;
727728
position: absolute;
728729
top: calc((var(--doc-line-height) * 0.5 - 0.5) * 1em);
729730
left: -1rem;
730731
}
731732

732733
.doc details.result {
733-
margin-top: 0.25rem;
734+
margin-top: var(--ds-space-3);
734735
}
735736

736737
.doc details.result > summary {
@@ -748,7 +749,7 @@
748749
background: var(--example-background);
749750
border: 0.25rem solid var(--example-border-color);
750751
border-radius: 0.5rem;
751-
padding: 0.75rem;
752+
padding: var(--ds-space-1h);
752753
}
753754

754755
.doc .exampleblock > .content::after,
@@ -766,7 +767,7 @@
766767
.doc .sidebarblock {
767768
background: var(--sidebar-background);
768769
border-radius: 0.75rem;
769-
padding: 0.75rem 1.5rem;
770+
padding: var(--ds-space-1h) var(--ds-space-3);
770771
}
771772

772773
.doc .sidebarblock > .content > .title {
@@ -805,8 +806,8 @@
805806
display: flex;
806807
visibility: hidden;
807808
position: absolute;
808-
top: 0.25rem;
809-
right: 0.5rem;
809+
top: var(--ds-space-h);
810+
right: var(--ds-space-1);
810811
color: var(--pre-annotation-font-color);
811812
font-family: var(--body-font-family);
812813
font-size: calc(13 / var(--rem-base) * 1rem);
@@ -1044,11 +1045,11 @@
10441045
#footnotes {
10451046
font-size: 0.85em;
10461047
line-height: 1.5;
1047-
margin: 2rem -0.5rem 0;
1048+
margin: var(--ds-space-3) calc(var(--ds-space-1) * -1) 0;
10481049
}
10491050

10501051
.doc td.tableblock > .content #footnotes {
1051-
margin: 2rem 0 0;
1052+
margin: var(--ds-space-3) 0 0;
10521053
}
10531054

10541055
#footnotes hr {

src/css/ds-button.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
border-radius: 6px;
33
padding: 0 12px;
44
height: 40px;
5-
font-size: 0.90625rem;
5+
font-size: calc(16 / var(--rem-base) * 1rem);
66
font-weight: 600;
77
transition: var(--ds-transition);
88
border: 1px solid transparent;

src/css/ds-input.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.ds-input-container {
22
height: 40px;
3-
font-size: 1rem;
3+
font-size: var(--ds-space-2);
44
font-weight: 400;
55
color: var(--ds-text-primary);
66
transition: var(--ds-transition);

src/css/ds-typography.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
}
2525

2626
.ds-text-body {
27-
font-size: 1rem;
27+
font-size: var(--ds-space-2);
2828
font-weight: 400;
2929
}
3030

@@ -51,7 +51,7 @@
5151
}
5252

5353
.ds-text-button {
54-
font-size: 0.90625rem;
54+
font-size: calc(16 / var(--rem-base) * 1rem);
5555
font-weight: 600;
5656
}
5757

src/css/ds-vars.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,20 @@
9191
--ds-warning-700: #703c00;
9292
--ds-warning-800: #522b00;
9393
--ds-warning-900: #331900;
94+
--ds-space-q: 0.25rem; /* 2px */
95+
--ds-space-h: 0.5rem; /* 4px */
96+
--ds-space-1: 1rem; /* 8px */
97+
--ds-space-1h: 1.5rem; /* 12px */
98+
--ds-space-2: 2rem; /* 16px */
99+
--ds-space-2h: 2.5rem; /* 20px */
100+
--ds-space-3: 3rem; /* 24px */
101+
--ds-space-4: 4rem; /* 32px */
102+
--ds-space-5: 5rem; /* 40px */
103+
--ds-space-6: 6rem; /* 48px */
104+
--ds-space-7: 7rem; /* 56px */
105+
--ds-space-8: 8rem; /* 64px */
106+
--ds-space-9: 9rem; /* 72 */
107+
--ds-space-10: 10rem; /* 80px */
108+
--ds-space-11: 11rem; /* 88px */
109+
--ds-space-15: 15rem; /* 120px */
94110
}

src/css/footer.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ footer.footer {
33
color: var(--footer-font-color);
44
font-size: calc(12 / var(--rem-base) * 1rem);
55
line-height: var(--footer-line-height);
6-
padding: 1.5rem;
6+
padding: var(--ds-space-5);
77
}
88

99
.footer p {

src/css/pagination.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ nav.pagination {
22
display: flex;
33
border-top: 1px solid var(--toolbar-border-color);
44
line-height: 1;
5-
margin: 2rem -1rem -1rem;
6-
padding: 0.75rem 1rem 0;
5+
margin: var(--ds-space-3) calc(var(--ds-space-2h) * -1) calc(var(--ds-space-2h) * -1);
6+
padding: var(--ds-space-1h) var(--ds-space-2) 0;
77
}
88

99
nav.pagination span {
@@ -38,7 +38,7 @@ nav.pagination .next::before {
3838

3939
nav.pagination a {
4040
font-weight: var(--body-font-weight-bold);
41-
line-height: 1.3;
41+
line-height: 1.5;
4242
position: relative;
4343
}
4444

@@ -50,7 +50,7 @@ nav.pagination a::after {
5050
line-height: 0.75;
5151
position: absolute;
5252
top: 0;
53-
width: 1rem;
53+
width: var(--ds-space-2);
5454
}
5555

5656
nav.pagination .prev a::before {

0 commit comments

Comments
 (0)