Skip to content

Commit d02e6be

Browse files
authored
Restrict Button scaling in Input Groups (#2209)
1 parent a5e530d commit d02e6be

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.changeset/dry-tables-leave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': patch
3+
---
4+
5+
Prevent Buttons from feeling disconnected from Input Groups when `:hover` or `:active` states are applied

src/mixins/_button.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,20 @@
9090
/**
9191
* Transform, opacity and filter changes are performant and will work across
9292
* many more stylistic modifiers than specific color shifts.
93+
*
94+
* We optionally support custom properties to allow the amount of scaling to
95+
* be adjusted by other patterns. For example, an Input Group might disable
96+
* the scaling so the button always appeared joined to adjacent elements.
9397
*/
9498

9599
&:hover {
96100
filter: brightness(brightness.$control-brighten);
97-
transform: scale(scale.$effect-grow);
101+
transform: scale(var(--scale-effect-grow, #{scale.$effect-grow}));
98102
}
99103

100104
&:active {
101105
filter: brightness(brightness.$control-dim);
102-
transform: scale(scale.$effect-shrink);
106+
transform: scale(var(--scale-effect-shrink, #{scale.$effect-shrink}));
103107
}
104108

105109
&:disabled,

src/objects/input-group/input-group.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
@use '../../compiled/tokens/scss/size';
22

33
.o-input-group {
4+
// Prevent button effects from appearing disconnected from the input group
5+
--scale-effect-grow: 1;
6+
--scale-effect-shrink: 1;
47
display: flex;
58

69
// Keeps focus styles from being cut off by adjacent, un-focused elements

0 commit comments

Comments
 (0)