Skip to content

Commit

Permalink
feat(input-text): make background color customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Apr 15, 2023
1 parent 9818d3f commit 97f892c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/form-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<script setup>
import { computed, ref } from 'vue';
import { FORM_ELEMENT_INPUT_PLACEHOLDER_COLOR_DEFAULT, FORM_ELEMENT_INPUT_TEXT_COLOR_DEFAULT, FORM_ELEMENT_INPUT_TEXT_SIZE_DEFAULT } from '../theme-keys.js';
import { FORM_ELEMENT_INPUT_BACKGROUND_COLOR_DEFAULT, FORM_ELEMENT_INPUT_PLACEHOLDER_COLOR_DEFAULT, FORM_ELEMENT_INPUT_TEXT_COLOR_DEFAULT, FORM_ELEMENT_INPUT_TEXT_SIZE_DEFAULT } from '../theme-keys.js';
import { getThemeProperty } from '../theme.js';
import FormElementContainerWithLabel from './form-element-container-with-label.vue';
Expand Down Expand Up @@ -108,6 +108,7 @@ const invalidCharactersRegex = computed(() => {
const inputClazz = computed(() => {
const clazz = [
'w-full mt-4 outline-none px-3 leading-8',
getThemeProperty(FORM_ELEMENT_INPUT_BACKGROUND_COLOR_DEFAULT).value,
getThemeProperty(FORM_ELEMENT_INPUT_PLACEHOLDER_COLOR_DEFAULT).value,
getThemeProperty(FORM_ELEMENT_INPUT_TEXT_SIZE_DEFAULT).value,
getThemeProperty(FORM_ELEMENT_INPUT_TEXT_COLOR_DEFAULT).value
Expand Down
1 change: 1 addition & 0 deletions src/theme-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const TEXT_WEIGHT_DEFAULT = 'text.weight.default'
export const TEXT_WEIGHT_HIGHLIGHT = 'text.weight.highlight'
export const FORM_ELEMENT_INPUT_TEXT_SIZE_DEFAULT = 'formElementInput.textSize.default'
export const FORM_ELEMENT_INPUT_TEXT_COLOR_DEFAULT = 'formElementInput.textColor.default'
export const FORM_ELEMENT_INPUT_BACKGROUND_COLOR_DEFAULT = 'formElementInput.backgroundColor.default'
export const FORM_ELEMENT_INPUT_PLACEHOLDER_COLOR_DEFAULT = 'formElementInput.placeholderColor.default'
export const FORM_ELEMENT_SELECT_TEXT_SIZE_DEFAULT = 'formElementSelect.textSize.default'
export const FORM_ELEMENT_SELECT_TEXT_COLOR_DEFAULT = 'formElementSelect.textColor.default'
Expand Down
3 changes: 3 additions & 0 deletions src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ const theme = {
textColor: {
default: ref('text-gray-900')
},
backgroundColor: {
default: ref('bg-white')
},
placeholderColor: {
default: ref('placeholder:text-gray-500')
}
Expand Down

0 comments on commit 97f892c

Please sign in to comment.