imetting/frontend/src/components/DateTimePicker.css

258 lines
4.2 KiB
CSS
Raw Normal View History

.datetime-picker {
position: relative;
width: 100%;
}
.datetime-display {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
border: 1px solid #d1d5db;
border-radius: 8px;
background: white;
cursor: pointer;
transition: all 0.2s ease;
min-height: 48px;
}
.datetime-display:hover {
border-color: #9ca3af;
}
.datetime-display:focus-within,
.datetime-display:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.display-text {
flex: 1;
color: #374151;
font-size: 14px;
}
.display-text.placeholder {
color: #9ca3af;
}
.clear-btn {
background: none;
border: none;
color: #9ca3af;
font-size: 18px;
cursor: pointer;
padding: 4px;
border-radius: 4px;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
}
.clear-btn:hover {
background: #f3f4f6;
color: #6b7280;
}
.datetime-picker-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.1);
z-index: 10;
pointer-events: auto;
}
.datetime-picker-panel {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid #e5e7eb;
border-radius: 8px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
z-index: 20;
margin-top: 4px;
padding: 20px;
min-width: 320px;
max-height: 500px;
height: auto;
min-height: 400px;
overflow-y: auto;
}
.picker-section {
margin-bottom: 24px;
}
.picker-section:last-of-type {
margin-bottom: 16px;
}
.picker-section h4 {
margin: 0 0 12px 0;
color: #374151;
font-size: 14px;
font-weight: 600;
}
.quick-date-options,
.quick-time-options {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
margin-bottom: 16px;
}
.quick-time-options {
grid-template-columns: repeat(4, 1fr);
}
.quick-option {
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 8px 12px;
font-size: 13px;
cursor: pointer;
transition: all 0.2s ease;
text-align: center;
}
.quick-option:hover {
background: #f1f5f9;
border-color: #cbd5e1;
}
.quick-option.selected {
background: #667eea;
border-color: #667eea;
color: white;
}
.custom-date-input,
.custom-time-input {
display: flex;
align-items: center;
gap: 8px;
}
.custom-time-input {
background: #f8fafc;
padding: 8px 12px;
border-radius: 6px;
border: 1px solid #e2e8f0;
}
.date-input,
.time-input {
border: 1px solid #d1d5db;
border-radius: 6px;
padding: 8px 12px;
font-size: 14px;
background: white;
transition: all 0.2s ease;
flex: 1;
}
.time-input {
border: none;
background: transparent;
flex: 1;
}
.date-input:focus,
.time-input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.time-input:focus {
box-shadow: none;
}
.picker-actions {
display: flex;
justify-content: flex-end;
gap: 12px;
padding-top: 16px;
border-top: 1px solid #e5e7eb;
}
.action-btn {
padding: 8px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
border: 1px solid transparent;
}
.action-btn.cancel {
background: #f8fafc;
color: #6b7280;
border-color: #d1d5db;
}
.action-btn.cancel:hover {
background: #f1f5f9;
border-color: #9ca3af;
}
.action-btn.confirm {
background: #667eea;
color: white;
}
.action-btn.confirm:hover {
background: #5a67d8;
}
/* 响应式设计 */
@media (max-width: 768px) {
.datetime-picker-panel {
min-width: 280px;
padding: 16px;
}
.quick-date-options {
grid-template-columns: repeat(2, 1fr);
}
.quick-time-options {
grid-template-columns: repeat(3, 1fr);
}
.picker-actions {
flex-direction: column;
gap: 8px;
}
.action-btn {
width: 100%;
text-align: center;
}
}
/* 改进输入框在Safari中的显示 */
.date-input::-webkit-calendar-picker-indicator,
.time-input::-webkit-calendar-picker-indicator {
background: transparent;
color: #6b7280;
cursor: pointer;
}
.date-input::-webkit-calendar-picker-indicator:hover,
.time-input::-webkit-calendar-picker-indicator:hover {
background: #f3f4f6;
border-radius: 4px;
}