|
| 1 | +# Flowforge CSS Structure and Guidelines |
| 2 | + |
| 3 | +This document outlines the CSS architecture, naming conventions, and best practices for the Flowforge plugin. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +1. [CSS Architecture](#css-architecture) |
| 8 | +2. [Naming Conventions](#naming-conventions) |
| 9 | +3. [Component Structure](#component-structure) |
| 10 | +4. [Color System](#color-system) |
| 11 | +5. [Responsive Design](#responsive-design) |
| 12 | +6. [Best Practices](#best-practices) |
| 13 | + |
| 14 | +## CSS Architecture |
| 15 | + |
| 16 | +The Flowforge CSS is structured using a modified BEM (Block Element Modifier) methodology with the following organization: |
| 17 | + |
| 18 | +``` |
| 19 | +resources/css/flowforge.css |
| 20 | +├── Base variables and theme configuration |
| 21 | +├── Layout Components |
| 22 | +├── UI Components |
| 23 | +├── Color Systems |
| 24 | +└── Utility Classes |
| 25 | +``` |
| 26 | + |
| 27 | +### 1. Base Variables and Theme Configuration |
| 28 | + |
| 29 | +Root variables are defined for consistent spacing, colors, and component styling. These variables support both light and dark mode themes. |
| 30 | + |
| 31 | +### 2. Layout Components |
| 32 | + |
| 33 | +Layout components control the overall structure of the UI, including: |
| 34 | +- Board layouts |
| 35 | +- Column layouts |
| 36 | +- Containers |
| 37 | + |
| 38 | +### 3. UI Components |
| 39 | + |
| 40 | +UI components are individual interface elements: |
| 41 | +- Cards |
| 42 | +- Badges |
| 43 | +- Buttons |
| 44 | +- Forms |
| 45 | + |
| 46 | +### 4. Color Systems |
| 47 | + |
| 48 | +Color classes provide consistent styling across the application: |
| 49 | +- Maintains existing `kanban-color-*` classes |
| 50 | +- Ensures consistent light/dark mode support |
| 51 | + |
| 52 | +### 5. Utility Classes |
| 53 | + |
| 54 | +Small, single-purpose classes for common styling needs: |
| 55 | +- `.ff-truncate` |
| 56 | +- `.ff-clickable` |
| 57 | +- `.ff-sortable` |
| 58 | + |
| 59 | +## Naming Conventions |
| 60 | + |
| 61 | +### Modified BEM Methodology |
| 62 | + |
| 63 | +We use a modified BEM naming convention with a `ff-` prefix (Flowforge): |
| 64 | + |
| 65 | +``` |
| 66 | +.ff-[block]__[element]--[modifier] |
| 67 | +``` |
| 68 | + |
| 69 | +**Examples:** |
| 70 | +- `.ff-card` - The card component (block) |
| 71 | +- `.ff-card__title` - The title within a card (element) |
| 72 | +- `.ff-card--priority-high` - High priority variation (modifier) |
| 73 | +- `.ff-badge--sm` - Small badge variation (modifier) |
| 74 | + |
| 75 | +### Naming Rules |
| 76 | + |
| 77 | +1. Use kebab-case for all class names |
| 78 | +2. Use descriptive, semantic names |
| 79 | +3. Prefix all custom classes with `ff-` |
| 80 | +4. Use double underscore (`__`) to separate elements |
| 81 | +5. Use double dash (`--`) for modifiers |
| 82 | + |
| 83 | +## Component Structure |
| 84 | + |
| 85 | +### Card Component |
| 86 | + |
| 87 | +```html |
| 88 | +<div class="ff-card ff-card--priority-high"> |
| 89 | + <div class="ff-card__body"> |
| 90 | + <h4 class="ff-card__title">Card Title</h4> |
| 91 | + <p class="ff-card__description">Description text</p> |
| 92 | + <div class="ff-card__badges"> |
| 93 | + <!-- Badges go here --> |
| 94 | + </div> |
| 95 | + </div> |
| 96 | +</div> |
| 97 | +``` |
| 98 | + |
| 99 | +### Badge Component |
| 100 | + |
| 101 | +```html |
| 102 | +<div class="ff-badge ff-badge--sm ff-badge--pill kanban-color-red"> |
| 103 | + <span class="ff-badge__label">Label</span> |
| 104 | + <span class="ff-badge__value">Value</span> |
| 105 | +</div> |
| 106 | +``` |
| 107 | + |
| 108 | +### Column Component |
| 109 | + |
| 110 | +```html |
| 111 | +<div class="ff-column"> |
| 112 | + <div class="ff-column__header"> |
| 113 | + <div class="ff-column__title"> |
| 114 | + Column Title |
| 115 | + <div class="ff-column__count kanban-color-blue">5</div> |
| 116 | + </div> |
| 117 | + </div> |
| 118 | + <div class="ff-column__content"> |
| 119 | + <!-- Cards go here --> |
| 120 | + </div> |
| 121 | +</div> |
| 122 | +``` |
| 123 | + |
| 124 | +## Color System |
| 125 | + |
| 126 | +The color system is based on Tailwind CSS colors with custom variations for better UI/UX. Each color has specific light and dark mode variants. |
| 127 | + |
| 128 | +### Available Colors |
| 129 | + |
| 130 | +Flowforge uses the following color palette: |
| 131 | +- Neutrals: default, white, slate, gray, zinc, neutral, stone |
| 132 | +- Accent: red, orange, amber, yellow, lime, green, emerald, teal |
| 133 | +- Brand: cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose |
| 134 | + |
| 135 | +### Usage |
| 136 | + |
| 137 | +1. **For badges and indicators:** Use the `kanban-color-*` classes |
| 138 | +2. **For solid badges:** Use both `ff-badge--solid` and `ff-badge--red` (or other color) classes |
| 139 | +3. **For text and borders:** Apply specific Tailwind classes as needed |
| 140 | + |
| 141 | +## Responsive Design |
| 142 | + |
| 143 | +Flowforge uses a mobile-first approach to responsive design. |
| 144 | + |
| 145 | +### Responsive Strategy |
| 146 | + |
| 147 | +1. **Component-based responsive styles:** Most components have built-in responsive behavior |
| 148 | +2. **Custom responsive classes:** Use `@screen` directives in the CSS for component variations |
| 149 | +3. **Tailwind breakpoints:** For specific cases, use Tailwind's responsive prefixes directly in markup |
| 150 | + |
| 151 | +### Breakpoints |
| 152 | + |
| 153 | +We follow Tailwind's default breakpoints: |
| 154 | +- `sm`: 640px and up |
| 155 | +- `md`: 768px and up |
| 156 | +- `lg`: 1024px and up |
| 157 | +- `xl`: 1280px and up |
| 158 | +- `2xl`: 1536px and up |
| 159 | + |
| 160 | +## Best Practices |
| 161 | + |
| 162 | +### When to Use BEM Classes vs. Tailwind Utilities |
| 163 | + |
| 164 | +1. **Use BEM classes for:** |
| 165 | + - Component structure and layout |
| 166 | + - Repeated patterns and consistent elements |
| 167 | + - Component variations and states |
| 168 | + |
| 169 | +2. **Use Tailwind utilities for:** |
| 170 | + - One-off styling needs |
| 171 | + - Fine-tuning spacing, alignment, or typography |
| 172 | + - Responsive adjustments |
| 173 | + |
| 174 | +### Adding New Components |
| 175 | + |
| 176 | +When adding new components: |
| 177 | + |
| 178 | +1. Add the component's BEM classes to `flowforge.css` |
| 179 | +2. Follow the existing naming conventions |
| 180 | +3. Use CSS variables for theming when appropriate |
| 181 | +4. Document the component structure and variations |
| 182 | + |
| 183 | +### Modifying Existing Components |
| 184 | + |
| 185 | +When modifying components: |
| 186 | + |
| 187 | +1. Check if a modifier already exists for your use case |
| 188 | +2. Add new modifiers using the `--modifier` syntax |
| 189 | +3. Update documentation if adding significant new functionality |
| 190 | + |
| 191 | +### Dark Mode Support |
| 192 | + |
| 193 | +All components should support dark mode: |
| 194 | + |
| 195 | +1. Use CSS variables when possible |
| 196 | +2. Use Tailwind's `dark:` prefix for specific overrides |
| 197 | +3. Test all components in both light and dark modes |
| 198 | + |
| 199 | +--- |
| 200 | + |
| 201 | +This guide should be considered a living document. Update it as patterns and best practices evolve. |
0 commit comments