Skip to content

Commit

Permalink
feat(input): Set the height of inputs and buttons to ensure they are …
Browse files Browse the repository at this point in the history
…the same cross-browser.
  • Loading branch information
ryanoglesby08 committed Sep 28, 2017
1 parent 14c75e2 commit f316a2b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/components/Button/Button.modules.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import '../../scss/settings/colours';
@import '../../scss/settings/spacing';
@import '../../scss/settings/typography';
@import '../../scss/settings/responsive-grid';
@import '../../scss/utility/responsive';

Expand All @@ -17,12 +16,17 @@ $button-text-color: $color-white;
.button {
composes: none rounded from "../Borders.modules.scss";
composes: medium boldFont from '../Typography/Text/Text.modules.scss';
composes: height font from '../FormFields.modules.scss';

display: block;

width: 100%;
padding: $spacing-base $spacing-wide;
padding: 0 $spacing-wide;

transition: background 0.2s;
font-family: $font-telus;

text-align: center;

cursor: pointer;
}

Expand Down Expand Up @@ -52,6 +56,7 @@ $button-text-color: $color-white;

.primary {
composes: button;

background-color: $primary-bg-color;
color: $button-text-color;

Expand All @@ -65,6 +70,7 @@ $button-text-color: $color-white;

.secondary {
composes: button;

background-color: $secondary-bg-color;
color: $button-text-color;

Expand All @@ -78,6 +84,7 @@ $button-text-color: $color-white;

.secondaryInverted {
composes: deprecatedInverted button;

color: $secondary-bg-color;

&:hover {
Expand All @@ -97,12 +104,14 @@ $button-text-color: $color-white;
&:hover {
background-color: $button-text-color;
color: $color-text;

box-shadow: none;
}
}

.outlinedInverted {
composes: deprecatedInverted button;

color: $color-text;

&:hover {
Expand All @@ -114,6 +123,7 @@ $button-text-color: $color-white;

.inverted {
composes: button;

background-color: $button-text-color;
color: $color-text;

Expand Down
14 changes: 14 additions & 0 deletions src/components/FormFields.modules.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import '../scss/settings/typography';

.height {
// Hardcode the height rather than relying on line-height, padding, and borders to ensure that form fields such as
// buttons, inputs, and selects all have the same height.
// Browsers treat line height of input fields oddly, which makes it an unreliable method for aligning the height
// of various elements.
// --> http://joshnh.com/weblog/line-height-doesnt-work-as-expected-on-inputs/
height: 3.25rem; // 52px
}

.font {
font-family: $font-telus;
}
2 changes: 1 addition & 1 deletion src/components/Input/Input.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Supply additional HTML input attributes as normal.
</div>
```

### Showing feedback for entered values
### Getting feedback for entered values

Use the `feedback` attribute to give the user feedback regarding their input. You can affirm that the user's input
was correct, or highlight errors that must be corrected.
Expand Down
7 changes: 6 additions & 1 deletion src/components/Input/Input.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
.inputWrapper {
composes: thin rounded from '../Borders.modules.scss';
composes: row from '../Flexbox.modules.scss';
composes: height from '../FormFields.modules.scss';

align-items: center;
padding: $spacing-base;
padding: 0 $spacing-base;
}

.defaultBoxShadow {
Expand Down Expand Up @@ -68,12 +69,16 @@ input.input {
//composes: noSpacing from '../Spacing/Spacing.modules.scss';
padding: 0;
margin: 0;

outline: 0;

// FIXME: Will be able to use composes when removing the targeting of the <input> element above
// composes: none rounded from '../Borders.modules.scss';
border: 0;
border-radius: 4px;

// FIXME: Will be able to use composes when removing the targeting of the <input> element above
// composes: font from '../FormFields.modules.scss';
font-family: $font-telus;

// FIXME: Will be able to use composes when removing the targeting of the <input> element above
Expand Down

0 comments on commit f316a2b

Please sign in to comment.