Fixed input field (#1130)

* fixed

* fixed

* fixed
This commit is contained in:
Apoorv Taneja 2019-08-13 21:57:31 +05:30 committed by Cassie Tarakajian
parent 25151e76ee
commit 07a225c161
2 changed files with 49 additions and 38 deletions

View file

@ -29,9 +29,12 @@ class Preferences extends React.Component {
} }
onFontInputChange(event) { onFontInputChange(event) {
this.setState({ const INTEGER_REGEX = /^[0-9\b]+$/;
fontSize: event.target.value if (event.target.value === '' || INTEGER_REGEX.test(event.target.value)) {
}); this.setState({
fontSize: event.target.value
});
}
} }
onFontInputSubmit(event) { onFontInputSubmit(event) {
@ -151,10 +154,9 @@ class Preferences extends React.Component {
aria-atomic="true" aria-atomic="true"
value={this.state.fontSize} value={this.state.fontSize}
onChange={this.onFontInputChange} onChange={this.onFontInputChange}
type="text"
ref={(element) => { this.fontSizeInput = element; }} ref={(element) => { this.fontSizeInput = element; }}
onClick={() => { onClick={() => { this.fontSizeInput.select(); }}
this.fontSizeInput.select();
}}
/> />
</form> </form>
<button <button

View file

@ -5,7 +5,8 @@
min-height: #{460 / $base-font-size}rem; min-height: #{460 / $base-font-size}rem;
max-height: 100%; max-height: 100%;
z-index: 9999; z-index: 9999;
padding: 0 #{20 / $base-font-size}rem #{2 / $base-font-size}rem #{20 / $base-font-size}rem ; padding: 0 #{20 / $base-font-size}rem #{2 / $base-font-size}rem #{20 /
$base-font-size}rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
outline: none; outline: none;
@ -47,17 +48,17 @@
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
@include themify() { @include themify() {
color: getThemifyVariable('heading-text-color'); color: getThemifyVariable("heading-text-color");
} }
} }
.preferences__title{ .preferences__title {
width: #{90 / $base-font-size}rem; width: #{90 / $base-font-size}rem;
height: #{25 / $base-font-size}rem; height: #{25 / $base-font-size}rem;
font-family: Montserrat; font-family: Montserrat;
font-size: #{21 / $base-font-size}rem; font-size: #{21 / $base-font-size}rem;
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
} }
.preference__subheadings { .preference__subheadings {
@ -65,7 +66,7 @@
flex-wrap: wrap; flex-wrap: wrap;
padding-bottom: #{0.1 / $base-font-size}rem; padding-bottom: #{0.1 / $base-font-size}rem;
@include themify() { @include themify() {
border-bottom: 1px solid getThemifyVariable('button-border-color'); border-bottom: 1px solid getThemifyVariable("button-border-color");
} }
} }
@ -75,7 +76,7 @@
padding-bottom: #{12 / $base-font-size}rem; padding-bottom: #{12 / $base-font-size}rem;
& + & { & + & {
@include themify() { @include themify() {
border-top: 1px dashed getThemifyVariable('button-border-color'); border-top: 1px dashed getThemifyVariable("button-border-color");
} }
} }
} }
@ -86,13 +87,13 @@
margin-top: #{13 / $base-font-size}rem; margin-top: #{13 / $base-font-size}rem;
margin-bottom: #{7 / $base-font-size}rem; margin-bottom: #{7 / $base-font-size}rem;
@include themify() { @include themify() {
color: getThemifyVariable('heading-text-color'); color: getThemifyVariable("heading-text-color");
} }
} }
.preference__subtitle { .preference__subtitle {
@include themify() { @include themify() {
color: getThemifyVariable('inactive-text-color'); color: getThemifyVariable("inactive-text-color");
} }
width: 100%; width: 100%;
margin-bottom: #{10 / $base-font-size}rem; margin-bottom: #{10 / $base-font-size}rem;
@ -101,9 +102,10 @@
.preference__value { .preference__value {
@include themify() { @include themify() {
border: #{1 / $base-font-size}rem solid getThemifyVariable('button-border-color'); border: #{1 / $base-font-size}rem solid
background-color: getThemifyVariable('button-background-color'); getThemifyVariable("button-border-color");
color: getThemifyVariable('input-text-color'); background-color: getThemifyVariable("button-background-color");
color: getThemifyVariable("input-text-color");
} }
text-align: center; text-align: center;
border-radius: 0%; border-radius: 0%;
@ -118,11 +120,10 @@
.preference__label { .preference__label {
@include themify() { @include themify() {
color: getThemifyVariable('inactive-text-color'); color: getThemifyVariable("inactive-text-color");
&:hover { &:hover {
color: getThemifyVariable('primary-text-color'); color: getThemifyVariable("primary-text-color");
} }
} }
margin: #{-15 / $base-font-size}rem 0 0 #{-5 / $base-font-size}rem; margin: #{-15 / $base-font-size}rem 0 0 #{-5 / $base-font-size}rem;
font-size: #{9 / $base-font-size}rem; font-size: #{9 / $base-font-size}rem;
@ -131,13 +132,14 @@
.react-tabs__tab--selected { .react-tabs__tab--selected {
@include themify() { @include themify() {
border-bottom: #{4 / $base-font-size}rem solid getThemifyVariable('button-background-hover-color'); border-bottom: #{4 / $base-font-size}rem solid
getThemifyVariable("button-background-hover-color");
} }
} }
.react-tabs__tab--selected .preference__subheading { .react-tabs__tab--selected .preference__subheading {
@include themify() { @include themify() {
color: getThemifyVariable('primary-text-color'); color: getThemifyVariable("primary-text-color");
} }
} }
@ -154,21 +156,22 @@
.preference__subheading { .preference__subheading {
@include themify() { @include themify() {
color: getThemifyVariable('inactive-text-color'); color: getThemifyVariable("inactive-text-color");
&:hover, &:focus{ &:hover,
color: getThemifyVariable('primary-text-color'); &:focus {
cursor: pointer; color: getThemifyVariable("primary-text-color");
cursor: pointer;
} }
&:focus { &:focus {
color: getThemifyVariable('primary-text-color'); color: getThemifyVariable("primary-text-color");
cursor: pointer; cursor: pointer;
} }
} }
font-size: #{12 / $base-font-size}rem; font-size: #{12 / $base-font-size}rem;
height: #{20 / $base-font-size}rem; height: #{20 / $base-font-size}rem;
width: 100%; width: 100%;
margin: 0; margin: 0;
padding: 0 #{5 /$base-font-size}rem; padding: 0 #{5 / $base-font-size}rem;
} }
.preference__vertical-list { .preference__vertical-list {
@ -186,8 +189,8 @@
margin-top: #{40 / $base-font-size}rem; margin-top: #{40 / $base-font-size}rem;
margin-bottom: #{10 / $base-font-size}rem; margin-bottom: #{10 / $base-font-size}rem;
@include themify() { @include themify() {
color: getThemifyVariable('inactive-text-color'); color: getThemifyVariable("inactive-text-color");
border-bottom: 1px dashed getThemifyVariable('button-border-color'); border-bottom: 1px dashed getThemifyVariable("button-border-color");
} }
} }
@ -195,6 +198,12 @@
@extend %hidden-element; @extend %hidden-element;
} }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.preference__option { .preference__option {
@include themify() { @include themify() {
@extend %preference-option; @extend %preference-option;
@ -213,7 +222,7 @@
@include themify() { @include themify() {
@extend %preference-option; @extend %preference-option;
&:hover { &:hover {
color: getThemifyVariable('button-background-hover-color'); color: getThemifyVariable("button-background-hover-color");
} }
} }
margin-left: #{30 / $base-font-size}rem; margin-left: #{30 / $base-font-size}rem;
@ -233,7 +242,7 @@
.preference__radio-button:checked + .preference__option { .preference__radio-button:checked + .preference__option {
@include themify() { @include themify() {
//for some reason this won't work for getThemifyVariable //for some reason this won't work for getThemifyVariable
color: map-get($theme-map, 'primary-text-color'); color: map-get($theme-map, "primary-text-color");
} }
} }