Skip to content

Commit

Permalink
feat(input): add --input-label-font-size css var (#209) (#213)
Browse files Browse the repository at this point in the history
close #209
  • Loading branch information
kiaking committed Jan 31, 2023
1 parent 2125e02 commit 4a199ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 6 additions & 0 deletions docs/styles/input-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ Customize the font size of the generic input value. The font size is different d
* undefined and size specific values defined below is used.
*/
--input-font-size: undefined;
--input-label-font-size: undefined;

/**
* Set the font size of different `size` of inputs. When
* `--button-font-size` is set, these values gets ignored.
*/
--input-mini-font-size: 14px;
--input-mini-label-font-size: 12px;

--input-small-font-size: 16px;
--input-small-label-font-size: 14px;

--input-medium-font-size: 16px;
--input-medium-label-font-size: 14px;
}
```

Expand Down
16 changes: 7 additions & 9 deletions lib/components/SInputBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,19 @@ function getErrorMsg(validation: Validatable) {
<style scoped lang="postcss">
.SInputBase.mini {
.label { padding-bottom: 6px; }
.label-text-value { font-size: 12px; }
.label { padding-bottom: 6px; height: 22px; }
.label-text-value { font-size: var(--input-label-font-size, var(--input-mini-label-font-size)); }
.label-text-info { width: 14px; height: 14px; }
}
.SInputBase.small {
.label { padding-bottom: 8px; }
.label-text-value { font-size: 14px; }
.label-note, .check { transform: translateY(1px); }
.label { padding-bottom: 8px; height: 24px; }
.label-text-value { font-size: var(--input-label-font-size, var(--input-small-label-font-size)); }
}
.SInputBase.medium {
.label { padding-bottom: 8px; }
.label-text-value { font-size: 14px; }
.label-note, .check { transform: translateY(1px); }
.label { padding-bottom: 8px; height: 24px; }
.label-text-value { font-size: var(--input-label-font-size, var(--input-medium-label-font-size)); }
}
.SInputBase.has-error {
Expand All @@ -113,7 +111,7 @@ function getErrorMsg(validation: Validatable) {
.label {
display: flex;
align-items: center;
align-items: baseline;
width: 100%;
line-height: 16px;
font-weight: 500;
Expand Down
4 changes: 4 additions & 0 deletions lib/styles/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,8 @@
--input-mini-font-size: 14px;
--input-small-font-size: 16px;
--input-medium-font-size: 16px;

--input-mini-label-font-size: 12px;
--input-small-label-font-size: 14px;
--input-medium-label-font-size: 14px;
}

0 comments on commit 4a199ac

Please sign in to comment.