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

Add vsSize prop for <vs-input> component #274

Merged
merged 1 commit into from
Oct 2, 2018
Merged
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
5 changes: 5 additions & 0 deletions docs/components/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ API:
parameters: primary,success,danger,warning,dark,RGB,HEX
description: Input and text color.
default: primary
- name: vs-size
type: String
parameters: small,normal,large
description: Size of input.
default: normal
- name: type
type: String
parameters: email, number, url, password, custom
Expand Down
24 changes: 23 additions & 1 deletion src/components/vsInput/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,27 @@
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.150);
transition: all .3s ease
width: 100%
&-small
padding: 0.2rem
+ .vs-placeholder-label-small
padding: 0rem 0.4rem
&-normal
padding: 0.4rem
&-large
padding: 0.8rem
+ .vs-placeholder-label-large
padding: 0.6rem
&:focus
box-shadow: 0px 3px 10px 0px rgba(0, 0, 0, 0.150);
&:focus,&.hasValue
+ .vs-placeholder-label
transform: translate(-3px,-90%) !important
font-size: .7rem
padding-left: .5rem !important
+ .vs-placeholder-label-small
transform: translate(-3px,-120%) !important
font-size: .7rem
padding-left: .5rem !important
&:focus
+ .input-span-placeholder
transform: translate(5px)
Expand Down Expand Up @@ -66,6 +80,10 @@
cursor text
user-select none
top: 2px
&-small
padding: 0.2rem
&-large
padding: 0.6rem
.icon-inputx
position absolute
left 5px;
Expand All @@ -77,7 +95,11 @@
cursor default
user-select none
top: 8px

&-small
top: 4px
font-size: 1rem
&-large
top: 14px
&.icon-after
left auto
right 5px;
Expand Down
19 changes: 13 additions & 6 deletions src/components/vsInput/vsInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<input
ref="vsinput"
:style="style"
:class="{
:class="[`vs-inputx-${vsSize}`,{
'hasValue':value != '',
'hasIcon':vsIcon,
'icon-after-input':vsIconAfter
}"
}]"
:placeholder="null"
:value="value"
v-bind="$attrs"
Expand All @@ -35,9 +35,12 @@
v-if="isValue&&(vsLabelPlaceholder||$attrs.placeholder)"
ref="spanplaceholder"
:style="styleLabel"
:class="{
'vs-placeholder-label':vsLabelPlaceholder,
}"
:class="[
vsLabelPlaceholder&&(`vs-placeholder-label-${vsSize}`),
`input-span-placeholder-${vsSize}`,
{
'vs-placeholder-label': vsLabelPlaceholder,
}]"
class="input-span-placeholder"
@click="focusInput">
{{ $attrs.placeholder || vsLabelPlaceholder }}
Expand All @@ -46,7 +49,7 @@

<i
v-if="vsIcon"
:class="[vsIconPack,vsIcon,{
:class="[vsIconPack,vsIcon, `icon-inputx-${vsSize}`, {
'icon-after':vsIconAfter,
}]"
translate="no"
Expand Down Expand Up @@ -175,6 +178,10 @@ export default {
default: null,
type:String
},
vsSize:{
default:'normal',
type:String
}
},
data:()=>({
isFocus:false
Expand Down