-
Notifications
You must be signed in to change notification settings - Fork 351
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
Checkbox input color #413
Checkbox input color #413
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,6 +10,7 @@ | |||||||||||||||||
v-model="compVal" | ||||||||||||||||||
class="inline-block mr-2" | ||||||||||||||||||
:disabled="disabled ? true : null" | ||||||||||||||||||
:color="color" | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider explicitly declaring the props: {
...inputProps,
+ color: {
+ type: String,
+ default: null
+ },
}, Committable suggestion
Suggested change
|
||||||||||||||||||
/> | ||||||||||||||||||
<slot name="label"> | ||||||||||||||||||
<span>{{ label }} | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
:name="name" | ||
type="checkbox" | ||
:class="sizeClasses" | ||
class="rounded border-gray-500 cursor-pointer" | ||
class="rounded border-gray-500 cursor-pointer checkbox" | ||
:style="{ '--accent-color': color }" | ||
:disabled="disabled ? true : null" | ||
> | ||
<label | ||
|
@@ -20,14 +21,7 @@ | |
</template> | ||
|
||
<script setup> | ||
import { | ||
defineEmits, | ||
defineOptions, | ||
defineProps, | ||
onMounted, | ||
ref, | ||
watch, | ||
} from "vue" | ||
import { defineEmits, defineOptions, defineProps, onMounted, ref, watch, } from "vue" | ||
|
||
defineOptions({ | ||
name: "VCheckbox", | ||
|
@@ -39,6 +33,7 @@ const props = defineProps({ | |
modelValue: { type: [Boolean, String], default: false }, | ||
disabled: { type: Boolean, default: false }, | ||
sizeClasses: { type: String, default: "w-4 h-4" }, | ||
color: { type: String, default: null }, | ||
}) | ||
|
||
const emit = defineEmits(["update:modelValue", "click"]) | ||
|
@@ -73,3 +68,8 @@ onMounted(() => { | |
if (internalValue.value === null) internalValue.value = false | ||
}) | ||
</script> | ||
<style> | ||
.checkbox { | ||
accent-color: var(--accent-color); | ||
} | ||
Comment on lines
+72
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification The CSS variable
Analysis chainThe CSS rule for setting the Scripts ExecutedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the definition of the CSS variable `--accent-color`.
# Test: Search for the variable definition. Expect: At least one occurrence.
rg --type css 'var\(--accent-color\)'
Length of output: 39 Script: #!/bin/bash
# Description: Verify the definition of the CSS variable `--accent-color`.
# Test: Search for the variable definition in various file types.
rg 'var\(--accent-color\)' --type-add 'scss' --type-add 'less' --type-add 'js'
Length of output: 134 Script: #!/bin/bash
# Description: Verify the definition of the CSS variable `--accent-color`.
# Test: Search for the variable definition in various file types.
rg 'var\(--accent-color\)' --type-add 'scss:*.scss' --type-add 'less:*.less' --type-add 'js:*.js'
Length of output: 187 |
||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding the
color
prop to the component'sprops
definition in the script section to ensure it's fully integrated and reactive.props: { ...inputProps, + color: String, // Add this line to handle the color prop },
Committable suggestion