Skip to content

Commit

Permalink
(fix) DarkColor handler (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisMazel authored Feb 14, 2020
1 parent db82f27 commit 0239ca2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
id="phoneNumber2"
v-model="phoneNumber2"
:translations="translations"
:dark="!dark"
no-flags
required
no-use-browser-locale
Expand All @@ -116,7 +115,8 @@
class="mb-2"
clearable
color="#FF9933"
dark-color="#21222e"
dark
dark-color="#303144"
:border-radius="8"
show-code-on-list
@update="onUpdate2"
Expand Down
12 changes: 2 additions & 10 deletions src/VuePhoneNumberInput/CountrySelector/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
:disabled="disabled"
class="country-selector__input"
readonly
:style="[radiusLeftStyle, inputBorderStyle, inputBoxShadowStyle]"
:style="[radiusLeftStyle, inputBorderStyle, inputBoxShadowStyle, inputBgColor]"
@focus="isFocus = true"
@keydown="keyboardNav"
@click.stop="toggleList"
Expand Down Expand Up @@ -72,7 +72,7 @@
ref="countriesList"
class="country-selector__list"
:class="{ 'has-calling-code': showCodeOnList }"
:style="[radiusStyle, listHeight]"
:style="[radiusStyle, listHeight, inputBgColor]"
>
<RecycleScroller
v-slot="{ item }"
Expand Down Expand Up @@ -425,14 +425,8 @@
// Dark Theme
&.is-dark {
.country-selector {
&__label {
color: $secondary-color-dark;
}
&__input {
cursor: pointer;
background-color: $bg-color-dark-l;
border: 1px solid $third-color-dark;
color: $secondary-color-dark;
&::-webkit-input-placeholder {
Expand Down Expand Up @@ -471,8 +465,6 @@
}
&__list {
background-color: $bg-color-dark-l;
&__item {
color: $text-color-dark;
Expand Down
18 changes: 6 additions & 12 deletions src/VuePhoneNumberInput/InputTel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
noCountrySelector ? radiusStyle : radiusRightStyle,
inputCaretStyle,
inputBorderStyle,
inputBoxShadowStyle
inputBoxShadowStyle,
inputBgColor,
textColor
]"
@keydown="keyDown"
@keyup="keyUp"
Expand Down Expand Up @@ -284,15 +286,7 @@
&.is-dark {
.input-tel {
&__label {
color: $secondary-color-dark;
}
&__input {
background-color: $bg-color-dark-l;
border: 1px solid $third-color-dark;
color: $secondary-color-dark;
&::-webkit-input-placeholder {
color: $secondary-color-dark;
}
Expand Down Expand Up @@ -346,7 +340,7 @@
.input-tel {
&__input {
border-color: $primary-color;
box-shadow: 0 0 0 0.2rem $primary-color-transparency;
box-shadow: 0 0 0 0.125rem $primary-color-transparency;
}
&__label {
Expand All @@ -356,14 +350,14 @@
&.has-error {
.input-tel__input {
box-shadow: 0 0 0 0.2rem $danger-color-transparency;
box-shadow: 0 0 0 0.125rem $danger-color-transparency;
}
}
&.is-valid {
.input-tel__input {
border-color: $success-color;
box-shadow: 0 0 0 0.2rem $success-color-transparency;
box-shadow: 0 0 0 0.125rem $success-color-transparency;
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/VuePhoneNumberInput/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
return {
colorValue: this.color,
color: { color: this.color },
textColor: { color: '#747474' },
textDarkColor: { color: 'rgba(255, 255, 255, 0.7)' },
validColor: { color: this.validColor },
errorColor: { color: this.errorColor },
darkColor: { color: this.darkColor },
Expand All @@ -190,9 +192,9 @@
borderValidColor: { borderColor: this.validColor },
borderErrorColor: { borderColor: this.errorColor },
borderDarkColor: { borderColor: this.darkColor },
boxShadowColor: { boxShadow: `0 0 0 0.2rem ${getShadowColor(this.color)}` },
boxShadowValid: { boxShadow: `0 0 0 0.2rem ${getShadowColor(this.validColor)}` },
boxShadowError: { boxShadow: `0 0 0 0.2rem ${getShadowColor(this.errorColor)}` },
boxShadowColor: { boxShadow: `0 0 0 0.125rem ${getShadowColor(this.color)}` },
boxShadowValid: { boxShadow: `0 0 0 0.125rem ${getShadowColor(this.validColor)}` },
boxShadowError: { boxShadow: `0 0 0 0.125rem ${getShadowColor(this.errorColor)}` },
borderRadius: { borderRadius: `${this.borderRadius}px` },
borderLeftRadius: { borderTopLeftRadius: `${this.borderRadius}px`, borderBottomLeftRadius: `${this.borderRadius}px` },
borderRightRadius: { borderTopRightRadius: `${this.borderRadius}px`, borderBottomRightRadius: `${this.borderRadius}px` }
Expand Down
7 changes: 7 additions & 0 deletions src/VuePhoneNumberInput/mixins/StylesHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
if (this.error) return this.theme.errorColor
else if (this.valid) return this.theme.validColor
else if (this.isFocus) return this.theme.color
else if (this.dark) return this.theme.textDarkColor
return null
},
inputBorderStyle () {
Expand All @@ -23,6 +24,12 @@ export default {
}
return null
},
inputBgColor () {
return !this.dark ? null : this.theme.bgDarkColor
},
textColor () {
return this.dark ? this.theme.textDarkColor : null
},
inputCaretStyle () {
return ({ caretColor: this.theme.colorValue })
},
Expand Down

0 comments on commit 0239ca2

Please sign in to comment.