This commit introduces a comprehensive responsive design system for the SelectableButtonGroup component that adapts to container width changes, particularly optimized for dynamic sidebar layouts. ## Key Features ### 1. Container Width Detection - Added `useContainerWidth` hook using ResizeObserver API - Real-time container width monitoring for responsive calculations - Automatic layout adjustments based on available space ### 2. Intelligent Column Layout Implements a 4-tier responsive system: - **≤280px**: 1 column + tags (mobile portrait) - **281-380px**: 2 columns + tags (narrow screens) - **381-460px**: 3 columns - tags (general case, prioritizes readability) - **>460px**: 3 columns + tags (wide screens, full feature display) ### 3. Dynamic Tag Visibility - Tags automatically hide in medium-width containers (381-460px) to improve text readability - Tags show in narrow and wide containers where space allows for optimal UX - Responsive threshold ensures content clarity across all viewport sizes ### 4. Adaptive Grid Spacing - Compact spacing `[4,4]` for containers ≤400px - Standard spacing `[6,6]` for larger containers - Additional `.sbg-compact` CSS class for fine-tuned styling in narrow layouts ### 5. Sidebar Integration - Perfectly compatible with dynamic sidebar width: `clamp(280px, 24vw, 520px)` - Automatically adjusts as sidebar scales with viewport changes - Maintains optimal button density and information display at all sizes ## Technical Implementation - **Hook**: `useContainerWidth.js` - ResizeObserver-based width detection - **Component**: Enhanced `SelectableButtonGroup.jsx` with responsive logic - **Styling**: Added `.sbg-compact` mode in `index.css` - **Performance**: Efficient span calculation using `Math.floor(24 / perRow)` ## Benefits - Improved UX across all screen sizes and sidebar configurations - Better text readability through intelligent tag hiding - Seamless integration with existing responsive sidebar system - Maintains component functionality while optimizing space utilization Closes: Responsive design implementation for model marketplace sidebar components
| Name |
Last commit
|
Last Update |
|---|---|---|
| .github | Loading commit data... | |
| bin | Loading commit data... | |
| common | Loading commit data... | |
| constant | Loading commit data... | |
| controller | Loading commit data... | |
| docs | Loading commit data... | |
| dto | Loading commit data... | |
| logger | Loading commit data... | |
| middleware | Loading commit data... | |
| model | Loading commit data... | |
| relay | Loading commit data... | |
| router | Loading commit data... | |
| service | Loading commit data... | |
| setting | Loading commit data... | |
| types | Loading commit data... | |
| web | Loading commit data... | |
| .dockerignore | Loading commit data... | |
| .env.example | Loading commit data... | |
| .gitignore | Loading commit data... | |
| Dockerfile | Loading commit data... | |
| LICENSE | Loading commit data... | |
| README.en.md | Loading commit data... | |
| README.md | Loading commit data... | |
| VERSION | Loading commit data... | |
| docker-compose.yml | Loading commit data... | |
| go.mod | Loading commit data... | |
| go.sum | Loading commit data... | |
| main.go | Loading commit data... | |
| makefile | Loading commit data... | |
| one-api.service | Loading commit data... |