Skip to content

Commit a80b892

Browse files
authored
Merge pull request #1254 from primer/tobiasahlin/add-common-utilities
Add common marketing utilities to primer/marketing
2 parents b720816 + 5d2f0be commit a80b892

File tree

6 files changed

+43
-1
lines changed

6 files changed

+43
-1
lines changed

.changeset/nervous-plants-smell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": minor
3+
---
4+
5+
Add common marketing utilities to primer/marketing

src/marketing/support/variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ $h000-size-mobile: 48px !default;
88

99
// Animations
1010
$transition-time: 0.4s !default;
11+
$ease-mktg: cubic-bezier(0.16, 1, 0.3, 1) !default;
1112

1213
// Increases the core spacing scale first by 8px for $spacer-7, then by 16px
1314
// increments from $spacer-8 to $spacer-12, i.e. after 40px, we have 48, 64,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Animation utilities for marketing
2+
3+
.hover-grow-mktg {
4+
transition: transform 0.4s $ease-mktg;
5+
6+
&:hover {
7+
transform: scale3d(1.025, 1.025, 1.025);
8+
}
9+
}

src/marketing/utilities/index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@import "../support/index.scss";
22
// utilities
3-
@import "./filters.scss";
3+
@import "./animations.scss";
44
@import "./borders.scss";
5+
@import "./filters.scss";
56
@import "./layout.scss";
67
@import "./margin.scss";
78
@import "./misc.scss";

src/marketing/utilities/layout.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@
2727
}
2828
}
2929
}
30+
31+
// Width and height utilities, especially needed when the
32+
// dimensions of an image are set in HTML
33+
.width-auto { width: auto !important; }
34+
.height-auto { height: auto !important; }
35+
36+
// Make an object fill its parent
37+
.object-fit-cover { object-fit: cover !important; }
38+
39+
// Handling z-index
40+
.z-1 { z-index: 1 !important; }
41+
.z-2 { z-index: 2 !important; }
42+
.z-3 { z-index: 3 !important; }
43+
44+
// Negative z-index
45+
.z-n1 { z-index: -1 !important; }
46+
.z-n2 { z-index: -2 !important; }

src/marketing/utilities/margin.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@
88
.mt#{$variant}-#{$scale} { margin-top: $size !important; }
99
.mb#{$variant}-#{$scale} { margin-bottom: $size !important; }
1010

11+
.mt#{$variant}-n#{$scale} { margin-top: -$size !important; }
12+
.mb#{$variant}-n#{$scale} { margin-bottom: -$size !important; }
13+
1114
.my#{$variant}-#{$scale} {
1215
margin-top: $size !important;
1316
margin-bottom: $size !important;
1417
}
1518
}
1619
}
1720
}
21+
22+
.mt-auto {
23+
margin-top: auto !important;
24+
}
25+
26+
.m-auto { margin: auto !important; }

0 commit comments

Comments
 (0)