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

fix(time-picker): [time-picker] Style optimization #2418

Merged
merged 1 commit into from
Oct 28, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const value1 = ref(new Date(2016, 9, 10, 18, 40))

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/basic-usage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const IconError = iconError()

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/clearable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const rangeValue = ref('')

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/default-value.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const value1 = ref(new Date(2016, 9, 10, 18, 40))

<style scoped lang="less">
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/disabled.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {

<style scoped lang="less">
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ const value1 = ref(new Date(2016, 9, 10, 18, 40))

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/editable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function focus() {

<style scoped lang="less">
.demo-date-picker-wrap {
width: 200px;
width: 280px;

& > * {
margin-top: 12px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {

<style scoped lang="less">
.demo-date-picker-wrap {
width: 200px;
width: 280px;

& > * {
margin-top: 12px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const pickerValue = ref(new Date(2016, 9, 10, 18, 40))

<style scoped lang="less">
.demo-date-picker-wrap {
width: 200px;
width: 280px;

& > * {
margin-top: 12px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/format.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default {

<style scoped lang="less">
.demo-date-picker-wrap {
width: 200px;
width: 280px;

& > * {
margin-top: 12px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div class="demo-time-picker-wrap">
<tiny-time-picker v-model="value1" is-range></tiny-time-picker>
</div>
</template>
Expand All @@ -13,3 +13,9 @@ const endTime = new Date(2016, 9, 10, 18, 50)

const value1 = ref([startTime, endTime])
</script>

<style scoped lang="less">
.demo-time-picker-wrap {
width: 360px;
}
</style>
Comment on lines +17 to +21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using CSS custom properties for consistent widths.

While the width of 360px is appropriate for a range time picker (accommodating two time inputs), consider defining it as a CSS custom property (CSS variable) in a shared style file. This would make it easier to maintain consistent widths across all time picker variants.

<style scoped lang="less">
.demo-time-picker-wrap {
-  width: 360px;
+  width: var(--tiny-time-picker-range-width, 360px);
}
</style>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<style scoped lang="less">
.demo-time-picker-wrap {
width: 360px;
}
</style>
<style scoped lang="less">
.demo-time-picker-wrap {
width: var(--tiny-time-picker-range-width, 360px);
}
</style>

8 changes: 7 additions & 1 deletion examples/sites/demos/pc/app/time-picker/is-range.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div class="demo-time-picker-wrap">
<tiny-time-picker v-model="value1" is-range></tiny-time-picker>
</div>
</template>
Expand All @@ -21,3 +21,9 @@ export default {
}
}
</script>

<style scoped lang="less">
.demo-time-picker-wrap {
width: 360px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ const value1 = ref(new Date(2016, 9, 10, 18, 40))

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/name.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ const value1 = ref(new Date(2016, 9, 10, 18, 40))

<style scoped>
.demo-date-picker-options {
width: 240px;
width: 280px;
}
</style>
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/picker-options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export default {

<style scoped>
.demo-date-picker-options {
width: 240px;
width: 280px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const rangeValue = ref(['', ''])

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/placeholder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
p {
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const value1 = ref(new Date(2016, 9, 10, 18, 40))

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}

.picker-class {
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/popper-class.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}

.picker-class {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const radioValue = ref('default')
}

.demo-date-picker-wrap {
width: 200px;
width: 280px;

& > * {
margin-top: 12px;
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/size.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
}

.demo-date-picker-wrap {
width: 200px;
width: 280px;

& > * {
margin-top: 12px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ const value = ref(new Date(2016, 9, 10, 18, 40))

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/step.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ const IconMinus = iconMinus()

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/time-picker/suffix-icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export default {

<style scoped>
.demo-date-picker-wrap {
width: 200px;
width: 280px;
}
</style>
Loading