|  | 
|  | 1 | +# Bitify: Replace raw html/css with Bit.BlazorUI components | 
|  | 2 | + | 
|  | 3 | +You are an expert at modernizing Blazor pages by replacing standard HTML elements and custom CSS with Bit.BlazorUI components and theme-aware styling. | 
|  | 4 | + | 
|  | 5 | +## Instructions | 
|  | 6 | + | 
|  | 7 | +1. **Analyze the current page** - Examine the `.razor`, `.razor.cs`, and `.razor.scss` files to identify HTML elements and custom styles that can be replaced with Bit.BlazorUI components | 
|  | 8 | +2. **Create a modernization inventory** - List all HTML elements, CSS classes, and functionality that could benefit from Bit.BlazorUI components | 
|  | 9 | +3. **Research specific Bit.BlazorUI components** - Use DeepWiki to find components that match your identified needs | 
|  | 10 | +4. **Create a targeted replacement plan** - Map HTML elements to appropriate Bit.BlazorUI components based on research | 
|  | 11 | +5. **Replace HTML with Bit.BlazorUI components** - Update the Razor markup using proper component syntax | 
|  | 12 | +6. **Convert custom CSS to theme-aware styling** - Replace hardcoded colors and styles with `BitColor` theme variables and `::deep` selectors | 
|  | 13 | +7. **Update component logic** - Modify the code-behind to work with Bit.BlazorUI component properties and events | 
|  | 14 | +8. **Verify and build** - Ensure the page compiles and functions correctly | 
|  | 15 | + | 
|  | 16 | +## Context | 
|  | 17 | + | 
|  | 18 | +- **Primary UI Library**: `Bit.BlazorUI` - Must be used instead of generic HTML elements | 
|  | 19 | +- **Styling Approach**: Use `.razor.scss` files with `::deep` selectors and `BitColor` theme variables | 
|  | 20 | + | 
|  | 21 | +## Workflow | 
|  | 22 | + | 
|  | 23 | +### Step 1: Analyze Current Implementation | 
|  | 24 | +First, thoroughly examine the current page to understand what can be modernized: | 
|  | 25 | + | 
|  | 26 | +1. **Examine the `.razor` file**: | 
|  | 27 | +   - Identify all HTML elements (`<div>`, `<button>`, `<input>`, `<form>`, `<table>`, etc.) | 
|  | 28 | +   - Note any custom HTML attributes and event handlers | 
|  | 29 | +   - Look for layout structures and navigation elements | 
|  | 30 | +   - Document data binding patterns and component references | 
|  | 31 | + | 
|  | 32 | +2. **Review the `.razor.cs` file**: | 
|  | 33 | +   - Understand current event handling logic | 
|  | 34 | +   - Note any DOM manipulation or JavaScript interop | 
|  | 35 | +   - Identify data binding properties and validation logic | 
|  | 36 | +   - Look for component lifecycle methods | 
|  | 37 | + | 
|  | 38 | +3. **Analyze the `.razor.scss` file**: | 
|  | 39 | +   - Identify hardcoded colors that should use theme variables | 
|  | 40 | +   - Note custom styling that might be replaced by component features | 
|  | 41 | +   - Look for responsive design patterns | 
|  | 42 | +   - Document CSS classes that style interactive elements | 
|  | 43 | + | 
|  | 44 | +### Step 2: Create Modernization Inventory | 
|  | 45 | +Based on your analysis, create a categorized list of replaceable elements: | 
|  | 46 | + | 
|  | 47 | +**Form Elements to Replace:** | 
|  | 48 | +- Text inputs (`<input type="text">`) → `BitTextField` | 
|  | 49 | +- Dropdowns/selects (`<select>`) → `BitDropdown` | 
|  | 50 | +- Checkboxes (`<input type="checkbox">`) → `BitCheckbox` | 
|  | 51 | +- Radio buttons (`<input type="radio">`) → `BitChoiceGroup` | 
|  | 52 | +- Buttons (`<button>`) → `BitButton`, `BitActionButton` | 
|  | 53 | +- etc. | 
|  | 54 | + | 
|  | 55 | +**Layout Elements to Replace:** | 
|  | 56 | +- Generic divs with flexbox → `BitStack` | 
|  | 57 | +- Grid layouts → `BitGrid` | 
|  | 58 | +- Card-like containers → `BitCard` | 
|  | 59 | +- etc. | 
|  | 60 | + | 
|  | 61 | +**Navigation Elements to Replace:** | 
|  | 62 | +- Custom navigation bars → `BitNavBar` | 
|  | 63 | +- Breadcrumbs → `BitBreadcrumb` | 
|  | 64 | +- Menu systems → `BitNav` | 
|  | 65 | +- etc. | 
|  | 66 | + | 
|  | 67 | +**Data Display Elements to Replace:** | 
|  | 68 | +- Tables → `BitDataGrid` | 
|  | 69 | +- Lists → `BitBasicList` | 
|  | 70 | +- etc. | 
|  | 71 | + | 
|  | 72 | +**Styling to Modernize:** | 
|  | 73 | +- Hardcoded colors → `$bit-color-*` variables | 
|  | 74 | +- Custom component styles → `::deep` selectors | 
|  | 75 | +- Theme-incompatible CSS → Theme-aware alternatives | 
|  | 76 | + | 
|  | 77 | +### Step 3: Research Specific Bit.BlazorUI Components | 
|  | 78 | +Now that you know what needs to be replaced, research the specific components: | 
|  | 79 | + | 
|  | 80 | +For each category of elements you identified, ask targeted DeepWiki questions: | 
|  | 81 | +``` | 
|  | 82 | +"What Bit.BlazorUI components can replace [specific HTML elements from your inventory] and what are their key properties, events, and styling options?" | 
|  | 83 | +``` | 
|  | 84 | + | 
|  | 85 | +### Step 4: Implement Replacements | 
|  | 86 | +Update the markup, ensuring: | 
|  | 87 | +- Proper property binding (`@bind-Value`, `@bind-Text`) | 
|  | 88 | +- Appropriate component properties (`Variant`, `Color`, `IsEnabled`, etc.) | 
|  | 89 | +- Correct event handling with `WrapHandled` | 
|  | 90 | + | 
|  | 91 | +### Step 5: Convert Styling | 
|  | 92 | +- Replace hardcoded colors with `$bit-color-*` variables from `_bit-css-variables.scss` | 
|  | 93 | +- Use `::deep` selectors for bit component styling | 
|  | 94 | +- Remove unnecessary custom CSS that components handle | 
|  | 95 | +- Ensure theme compatibility (light/dark mode support) | 
|  | 96 | + | 
|  | 97 | +### Step 6: Update Code-Behind | 
|  | 98 | +- Replace HTML-specific event handling with component events | 
|  | 99 | +- Update data binding to work with component properties | 
|  | 100 | +- Remove DOM manipulation code that components handle internally | 
|  | 101 | +- Use component references (`@ref`) if direct access is needed | 
|  | 102 | + | 
|  | 103 | +### Step 7: Build | 
|  | 104 | +- Build the project to ensure compilation | 
|  | 105 | + | 
|  | 106 | +## Common Pitfalls to Avoid | 
|  | 107 | + | 
|  | 108 | +- Avoid hardcoded colors that break theme switching | 
|  | 109 | +- Don't override bit component styles without using `::deep` | 
|  | 110 | +- Don't assume component properties match HTML attributes exactly | 
|  | 111 | + | 
|  | 112 | +Now proceed to analyze the current page and implement the Bit.BlazorUI modernization following these guidelines. | 
0 commit comments