Skip to content

Commit

Permalink
feat(input): add dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Nov 13, 2021
1 parent 4816735 commit befd63c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/varlet-ui/src/input/example/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import AppType from '@varlet/cli/site/mobile/components/AppType'
import { reactive, toRefs } from 'vue'
import { use, pack } from './locale'
import { watchLang } from '@varlet/cli/site/utils'
import { watchDarkMode } from '../../utils/components'
export default {
name: 'InputExample',
Expand All @@ -68,6 +69,7 @@ export default {
use(lang)
values.value5 = pack.value.clearableText
})
watchDarkMode()
return {
pack,
Expand Down
4 changes: 3 additions & 1 deletion packages/varlet-ui/src/input/input.less
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
transition-duration: 0.3s;
transform: translate(0, calc(-50% + var(--input-placeholder-size) / 2)) scale(1);
font-size: var(--input-placeholder-size);
color: var(--input-blur-color);
}

&__textarea-placeholder {
Expand All @@ -83,6 +84,7 @@
transition: transform 0.3s;
transform: translate(0, calc(var(--input-textarea-padding-top) + var(--input-placeholder-size))) scale(1);
font-size: var(--input-placeholder-size);
color: var(--input-blur-color);
}

&__autocomplete {
Expand All @@ -100,10 +102,10 @@
padding: 0;
outline: none;
border: none;
font-size: inherit;
background: transparent;
color: var(--input-input-text-color);
caret-color: var(--input-focus-color);
font: inherit;
}

&__line {
Expand Down
2 changes: 2 additions & 0 deletions packages/varlet-ui/src/themes/dark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import switchThemes from './switch'
import steps from './steps'
import pagination from './pagination'
import table from './talble'
import input from './input'
import { StyleVars } from '../../style-provider'

export default {
Expand Down Expand Up @@ -41,4 +42,5 @@ export default {
...steps,
...pagination,
...table,
...input,
} as StyleVars
4 changes: 4 additions & 0 deletions packages/varlet-ui/src/themes/dark/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
'--input-input-text-color': '#fff',
'--input-blur-color': 'rgb(255, 255, 255, .7)',
}

0 comments on commit befd63c

Please sign in to comment.