Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some UI changes #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
</div>
<VSelect
v-model="selectedName"
listTitle="Select form your followers"
:options="names"
:disabled="disabledName"
:searchable="searchableName"/>
<h2>Array of objects</h2>
<h2 style="margin-top: 70px;">Array of objects</h2>
<div class="options">
<p><b>Options:</b></p>
<div>
Expand Down
59 changes: 43 additions & 16 deletions src/vue-bootstrap-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
class="v-select"
:class="{'disabled': disabled}">
<button @click="toggle" type="button" class="v-select-toggle">
<div>{{ title }}</div>
<div class="arrow-down"></div>
<div class="container">
<div class="select">
<div class="options-title">{{ dropdownTitle }}</div>
<div class="selected-item">{{ title }}</div>
</div>
<div class="arrow-down"></div>
</div>
</button>
<div v-show="show" class="v-dropdown-container">
<div v-show="searchable" class="v-bs-searchbox">
Expand Down Expand Up @@ -57,6 +62,10 @@ export default {
type: String,
default: "disabled"
},
listTitle: {
type: String,
default: "Select from list"
},
labelTitle: {
type: String,
default: "Nothing selected"
Expand Down Expand Up @@ -103,6 +112,9 @@ export default {
};
},
computed: {
dropdownTitle() {
return this.listTitle;
},
title() {
return this.selectedValue
? this.getOptionLabel(this.selectedValue)
Expand Down Expand Up @@ -246,9 +258,16 @@ export default {
* {
box-sizing: border-box;
}
*:focus {
outline: none;
box-shadow: 0 0 0 0.1rem rgba(136, 141, 169, 0.5);
}

input {
width: 100%;
&:focus {
outline: none;
}
}

ul {
Expand Down Expand Up @@ -278,50 +297,58 @@ ul {
cursor: not-allowed;

&:focus {
outline: 0 !important;
outline: none;
}
}
}
}

.v-select-toggle {
display: flex;
justify-content: space-between;
user-select: none;
padding: 0.375rem 0.75rem;
padding: 0.75rem;
color: #212529;
background-color: #f8f9fa;
border-color: #d3d9df;
width: 100%;
text-align: right;
text-align: left;
white-space: nowrap;
border: 1px solid transparent;
padding: 0.375rem 0.75rem;
font-size: 12px;
font-family: inherit, sans-serif;
line-height: 1.5;
border-radius: 0.25rem;
transition: background-color, border-color, box-shadow, 0.15s ease-in-out;
cursor: pointer;

&:hover {
background-color: #e2e6ea;
border-color: #dae0e5;
border: 1px solid #e6ecf5;
background-color: transparent;
}
.container {
display: flex;
align-items: center;
}
.select {
width: 50%;
display: inline-block;
.selected-item {
padding: 5px 12px;
font-weight: bold;
}
.options-title {
color: #888da8;
text-transform: uppercase;
}
}

.arrow-down {
width: 50%;
display: inline-block;
width: 0;
height: 0;
margin-left: 0.255em;
margin-top: 7px;
vertical-align: 0.255em;
content: "";
border-top: 0.3em solid;
border-right: 0.3em solid transparent;
border-bottom: 0;
border-left: 0.3em solid transparent;
margin-left: auto;
}

.v-dropdown-container {
Expand Down