add ingredient suggestions during recipe creation
This commit is contained in:
200
frontend/src/components/IngredientAutocomplete.css
Normal file
200
frontend/src/components/IngredientAutocomplete.css
Normal file
@@ -0,0 +1,200 @@
|
||||
.ingredient-autocomplete {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.autocomplete-input-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.autocomplete-input {
|
||||
width: 100%;
|
||||
padding: 0.75rem;
|
||||
padding-right: 2.5rem;
|
||||
border: 2px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.autocomplete-input:focus {
|
||||
outline: none;
|
||||
border-color: #FF6B35;
|
||||
box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
|
||||
}
|
||||
|
||||
.autocomplete-loading {
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.loading-spinner-small {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid #e9ecef;
|
||||
border-top: 2px solid #FF6B35;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.autocomplete-suggestions {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: white;
|
||||
border: 1px solid #e9ecef;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
z-index: 1000;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.suggestion-item {
|
||||
padding: 0.75rem;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
transition: background-color 0.2s ease;
|
||||
border-bottom: 1px solid #f8f9fa;
|
||||
}
|
||||
|
||||
.suggestion-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.suggestion-item:hover,
|
||||
.suggestion-item.selected {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.suggestion-item.selected {
|
||||
background-color: #e3f2fd;
|
||||
}
|
||||
|
||||
.suggestion-name {
|
||||
font-weight: 500;
|
||||
color: #2c3e50;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.suggestion-count {
|
||||
font-size: 0.8rem;
|
||||
color: #6c757d;
|
||||
background: #e9ecef;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Custom scrollbar for suggestions */
|
||||
.autocomplete-suggestions::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.autocomplete-suggestions::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.autocomplete-suggestions::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.autocomplete-suggestions::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media (max-width: 768px) {
|
||||
.autocomplete-suggestions {
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
.suggestion-item {
|
||||
padding: 0.6rem;
|
||||
}
|
||||
|
||||
.suggestion-name {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.suggestion-count {
|
||||
font-size: 0.75rem;
|
||||
padding: 0.2rem 0.4rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Animation for suggestions appearing */
|
||||
.autocomplete-suggestions {
|
||||
animation: slideDown 0.2s ease-out;
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Focus states for accessibility */
|
||||
.suggestion-item:focus {
|
||||
outline: 2px solid #FF6B35;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/* High contrast mode support */
|
||||
@media (prefers-contrast: high) {
|
||||
.autocomplete-input {
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.autocomplete-input:focus {
|
||||
border-color: #FF6B35;
|
||||
box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3);
|
||||
}
|
||||
|
||||
.suggestion-item.selected {
|
||||
background-color: #FF6B35;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.suggestion-item.selected .suggestion-count {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reduced motion support */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.autocomplete-input,
|
||||
.suggestion-item,
|
||||
.loading-spinner-small {
|
||||
transition: none;
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.autocomplete-suggestions {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user