Skip to content

Commit

Permalink
Merge pull request #1254 from primer/tobiasahlin/add-common-utilities
Browse files Browse the repository at this point in the history
Add common marketing utilities to primer/marketing
  • Loading branch information
jonrohan authored Mar 26, 2021
2 parents b720816 + 5d2f0be commit a80b892
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nervous-plants-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/css": minor
---

Add common marketing utilities to primer/marketing
1 change: 1 addition & 0 deletions src/marketing/support/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $h000-size-mobile: 48px !default;

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

// Increases the core spacing scale first by 8px for $spacer-7, then by 16px
// increments from $spacer-8 to $spacer-12, i.e. after 40px, we have 48, 64,
Expand Down
9 changes: 9 additions & 0 deletions src/marketing/utilities/animations.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Animation utilities for marketing

.hover-grow-mktg {
transition: transform 0.4s $ease-mktg;

&:hover {
transform: scale3d(1.025, 1.025, 1.025);
}
}
3 changes: 2 additions & 1 deletion src/marketing/utilities/index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@import "../support/index.scss";
// utilities
@import "./filters.scss";
@import "./animations.scss";
@import "./borders.scss";
@import "./filters.scss";
@import "./layout.scss";
@import "./margin.scss";
@import "./misc.scss";
Expand Down
17 changes: 17 additions & 0 deletions src/marketing/utilities/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,20 @@
}
}
}

// Width and height utilities, especially needed when the
// dimensions of an image are set in HTML
.width-auto { width: auto !important; }
.height-auto { height: auto !important; }

// Make an object fill its parent
.object-fit-cover { object-fit: cover !important; }

// Handling z-index
.z-1 { z-index: 1 !important; }
.z-2 { z-index: 2 !important; }
.z-3 { z-index: 3 !important; }

// Negative z-index
.z-n1 { z-index: -1 !important; }
.z-n2 { z-index: -2 !important; }
9 changes: 9 additions & 0 deletions src/marketing/utilities/margin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@
.mt#{$variant}-#{$scale} { margin-top: $size !important; }
.mb#{$variant}-#{$scale} { margin-bottom: $size !important; }

.mt#{$variant}-n#{$scale} { margin-top: -$size !important; }
.mb#{$variant}-n#{$scale} { margin-bottom: -$size !important; }

.my#{$variant}-#{$scale} {
margin-top: $size !important;
margin-bottom: $size !important;
}
}
}
}

.mt-auto {
margin-top: auto !important;
}

.m-auto { margin: auto !important; }

1 comment on commit a80b892

@vercel
Copy link

@vercel vercel bot commented on a80b892 Mar 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.