Skip to content

Commit

Permalink
#1 Fix form group input UI issues (with addon and no-border class, la…
Browse files Browse the repository at this point in the history
…bel related issues)
  • Loading branch information
cristijora committed Feb 12, 2019
1 parent 1c03474 commit 5732617
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"bootstrap": "4.1.1",
"bootstrap": "^4.3.0",
"element-ui": "^2.5.4",
"nouislider": "^11.1.0",
"vue": "^2.6.6",
Expand Down
10 changes: 10 additions & 0 deletions src/assets/scss/now-ui-kit/_inputs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
color: $black-color;
line-height: normal;
font-size: $font-size-small;
height: 100%;
@include transition-input-focus-color();
@include box-shadow(none);

Expand Down Expand Up @@ -138,6 +139,15 @@
}
}

.input-group-append{
margin-left: 0;
.input-group-text{
background-color: $opacity-gray-3;
border: none;
border-right: transparent !important;
}
}

&.input-group-focus{
&.no-border{
.input-group-text{
Expand Down
69 changes: 37 additions & 32 deletions src/components/Inputs/formGroupInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,49 @@
]"
>
<slot name="label">
<label v-if="label" :class="labelClasses">
<label v-if="label" class="control-label" :class="labelClasses">
{{ label }}
<span v-if="required">*</span>
</label>
</slot>

<slot name="addonLeft">
<div v-if="addonLeftIcon" class="input-group-prepend">
<i class="input-group-text" :class="addonLeftIcon"></i>
</div>
</slot>
<slot>
<input
:value="value"
v-on="listeners"
v-bind="$attrs"
class="form-control"
:class="[{ valid: value && !error }, inputClasses]"
aria-describedby="addon-right addon-left"
/>
</slot>
<slot name="addonRight">
<span v-if="addonRightIcon" class="input-group-addon input-group-append">
<i class="input-group-text" :class="addonRightIcon"></i>
</span>
</slot>
<div :class="[{ 'input-group': hasIcon }]">
<slot name="addonLeft">
<div v-if="addonLeftIcon" class="input-group-prepend">
<i class="input-group-text" :class="addonLeftIcon"></i>
</div>
</slot>
<slot>
<input
:value="value"
v-on="listeners"
v-bind="$attrs"
class="form-control"
:class="[{ valid: value && !error }, inputClasses]"
aria-describedby="addon-right addon-left"
/>
</slot>
<slot name="addonRight">
<span
v-if="addonRightIcon"
class="input-group-addon input-group-append"
>
<i class="input-group-text" :class="addonRightIcon"></i>
</span>
</slot>

<slot name="infoBlock"></slot>
<slot name="helpBlock">
<div
class="text-danger invalid-feedback"
style="display: block;"
:class="{ 'mt-2': hasIcon }"
v-if="error"
>
{{ error }}
</div>
</slot>
<slot name="infoBlock"></slot>
<slot name="helpBlock">
<div
class="text-danger invalid-feedback"
style="display: block;"
:class="{ 'mt-2': hasIcon }"
v-if="error"
>
{{ error }}
</div>
</slot>
</div>
</div>
</template>
<script>
Expand Down
16 changes: 16 additions & 0 deletions src/pages/components/BasicElementsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@
>
</fg-input>
</div>
<div class="col-sm-6 col-lg-3">
<fg-input
addon-left-icon="now-ui-icons users_single-02"
class="no-border"
placeholder="No border left icon"
>
</fg-input>
</div>
<div class="col-sm-6 col-lg-3">
<fg-input
addon-right-icon="now-ui-icons users_single-02"
class="no-border"
placeholder="No border right icon"
>
</fg-input>
</div>
</div>
</div>
<div class="space-70"></div>
Expand Down
6 changes: 6 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
css: {
// Enable CSS source maps.
sourceMap: process.env.NODE_ENV !== 'production'
}
};
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1531,9 +1531,10 @@ boolbase@^1.0.0, boolbase@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"

[email protected]:
version "4.1.1"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.1.1.tgz#3aec85000fa619085da8d2e4983dfd67cf2114cb"
bootstrap@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.3.0.tgz#2559ccb8d45426ac6c54db23eb3d1c9f4257fa22"
integrity sha512-M0vqY0Z6UDweV2nLFl5dXcb+GIo53EBCGMMVxCGH5vJxl/jsr+HkULBMd4kn9rdpdBZwd3BduCgMOYOwJybo4Q==

brace-expansion@^1.1.7:
version "1.1.11"
Expand Down

0 comments on commit 5732617

Please sign in to comment.