Spaces:
Paused
Paused
| # styles.py | |
| CUSTOM_CSS = """ | |
| <style> | |
| .tooltip-container { | |
| position: relative; | |
| display: inline-block; | |
| margin-bottom: 5px; | |
| } | |
| .tooltip-container .tooltip-text { | |
| visibility: hidden; | |
| width: 200px; | |
| background-color: #333; | |
| color: white; | |
| text-align: center; | |
| padding: 5px; | |
| border-radius: 6px; | |
| position: absolute; | |
| z-index: 1; | |
| bottom: 125%; | |
| left: 50%; | |
| margin-left: -100px; | |
| opacity: 0; | |
| transition: opacity 0.3s; | |
| } | |
| .tooltip-container:hover .tooltip-text { | |
| visibility: visible; | |
| opacity: 1; | |
| } | |
| .input-label { | |
| font-weight: 500; | |
| color: #31333F; | |
| } | |
| .progress-container { | |
| width: 100%; | |
| background-color: #f0f2f6; | |
| border-radius: 10px; | |
| margin: 10px 0; | |
| } | |
| .progress-bar { | |
| height: 20px; | |
| background-color: #007bff; | |
| border-radius: 10px; | |
| transition: width 0.5s ease-in-out; | |
| position: relative; | |
| } | |
| .progress-label { | |
| position: absolute; | |
| right: 10px; | |
| color: white; | |
| font-weight: bold; | |
| } | |
| .success-message { | |
| padding: 1rem; | |
| background-color: #d4edda; | |
| color: #155724; | |
| border-radius: 5px; | |
| margin: 1rem 0; | |
| } | |
| .error-message { | |
| padding: 1rem; | |
| background-color: #f8d7da; | |
| color: #721c24; | |
| border-radius: 5px; | |
| margin: 1rem 0; | |
| } | |
| </style> | |
| """ | |
| def create_tooltip(label: str, tooltip_text: str) -> str: | |
| """Create a tooltip with label.""" | |
| return f""" | |
| <div class="tooltip-container"> | |
| <span class="input-label">{label}</span> | |
| <span class="tooltip-text">{tooltip_text}</span> | |
| </div> | |
| """ | |
| def create_progress_bar(value: int, label: str = "") -> str: | |
| """Create a progress bar with optional label.""" | |
| return f""" | |
| <div class="progress-container"> | |
| <div class="progress-bar" style="width: {value}%;"><span class="progress-label">{label if label else f'{value}%'}</span></div> | |
| </div> | |
| """ | |
| def create_status_message(message: str, type: str = "success") -> str: | |
| """Create a status message of specified type.""" | |
| return f'<div class="{type}-message">{message}</div>' | |