|
| 1 | +# Tailwind Dark Mode Usage Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | +This guide shows how to use the new Tailwind utilities for better dark mode visibility in OpenSign. |
| 5 | + |
| 6 | +## Button Styling |
| 7 | + |
| 8 | +### VS Code-style Disabled Buttons |
| 9 | +```jsx |
| 10 | +// Option 1: Direct VS Code styling |
| 11 | +<button className="op-btn op-btn-primary op-btn-vscode-disabled" disabled> |
| 12 | + Disabled Button |
| 13 | +</button> |
| 14 | + |
| 15 | +// Option 2: Themed disabled styling |
| 16 | +<button className="op-btn btn-themed-disabled"> |
| 17 | + Themed Button |
| 18 | +</button> |
| 19 | + |
| 20 | +// Option 3: Conditional styling |
| 21 | +<button |
| 22 | + className={`op-btn op-btn-primary ${isDisabled ? 'op-btn-vscode-disabled' : ''}`} |
| 23 | + disabled={isDisabled} |
| 24 | +> |
| 25 | + Dynamic Button |
| 26 | +</button> |
| 27 | +``` |
| 28 | + |
| 29 | +## Icon Styling |
| 30 | + |
| 31 | +### Theme-aware Icons |
| 32 | +```jsx |
| 33 | +// Better visibility in dark mode |
| 34 | +<i className="fa-light fa-folder icon-improved"></i> |
| 35 | + |
| 36 | +// Muted but still visible |
| 37 | +<i className="fa-light fa-plus icon-muted"></i> |
| 38 | + |
| 39 | +// Disabled state |
| 40 | +<i className="fa-light fa-trash icon-disabled"></i> |
| 41 | +``` |
| 42 | + |
| 43 | +### CSS Variable Approach |
| 44 | +```jsx |
| 45 | +// Using CSS variables |
| 46 | +<i className="fa-light fa-search icon-themed"></i> |
| 47 | +<i className="fa-light fa-settings icon-themed-muted"></i> |
| 48 | + |
| 49 | +// Inline styles with CSS variables |
| 50 | +<i |
| 51 | + className="fa-light fa-plus" |
| 52 | + style={{ color: 'var(--icon-color)' }} |
| 53 | +/> |
| 54 | +``` |
| 55 | + |
| 56 | +### Legacy JavaScript Function (Still Supported) |
| 57 | +```jsx |
| 58 | +// Existing approach - still works |
| 59 | +<i |
| 60 | + className="fa-light fa-plus" |
| 61 | + style={{ color: getThemeIconColor() }} |
| 62 | +/> |
| 63 | +``` |
| 64 | + |
| 65 | +## Text Styling |
| 66 | + |
| 67 | +### Improved Gray Text |
| 68 | +```jsx |
| 69 | +// These automatically improve in dark mode |
| 70 | +<span className="text-gray-500">More visible in dark mode</span> |
| 71 | +<span className="text-gray-400">Muted but readable</span> |
| 72 | +<span className="text-gray-600">Clear text</span> |
| 73 | +``` |
| 74 | + |
| 75 | +## Complete Examples |
| 76 | + |
| 77 | +### Toolbar with Better Visibility |
| 78 | +```jsx |
| 79 | +const Toolbar = () => ( |
| 80 | + <div className="flex space-x-2 p-2"> |
| 81 | + <button className="p-2 hover:bg-gray-200 rounded"> |
| 82 | + <i className="fa-light fa-plus icon-improved"></i> |
| 83 | + </button> |
| 84 | + <button className="p-2 hover:bg-gray-200 rounded" disabled> |
| 85 | + <i className="fa-light fa-trash icon-disabled"></i> |
| 86 | + </button> |
| 87 | + <button className="p-2 hover:bg-gray-200 rounded"> |
| 88 | + <i className="fa-light fa-edit icon-improved"></i> |
| 89 | + </button> |
| 90 | + </div> |
| 91 | +); |
| 92 | +``` |
| 93 | + |
| 94 | +### Form with Disabled States |
| 95 | +```jsx |
| 96 | +const Form = ({ isSubmitting }) => ( |
| 97 | + <form> |
| 98 | + <input className="op-input" /> |
| 99 | + <button |
| 100 | + className={`op-btn op-btn-primary ${isSubmitting ? 'op-btn-vscode-disabled' : ''}`} |
| 101 | + disabled={isSubmitting} |
| 102 | + > |
| 103 | + {isSubmitting ? 'Submitting...' : 'Submit'} |
| 104 | + </button> |
| 105 | + </form> |
| 106 | +); |
| 107 | +``` |
| 108 | + |
| 109 | +## React-Tour and Tooltip Dark Mode Support |
| 110 | + |
| 111 | +### React-Tour Modals |
| 112 | +The react-tour modals now automatically support dark mode with VS Code-inspired styling: |
| 113 | + |
| 114 | +```jsx |
| 115 | +// These components automatically get dark mode styling |
| 116 | +<Tour |
| 117 | + onRequestClose={closeTour} |
| 118 | + steps={tourConfig} |
| 119 | + isOpen={isOpen} |
| 120 | + rounded={5} |
| 121 | +/> |
| 122 | +``` |
| 123 | + |
| 124 | +### ReactTooltip Components |
| 125 | +All ReactTooltip instances now support dark mode: |
| 126 | + |
| 127 | +```jsx |
| 128 | +// Automatically styled for dark mode |
| 129 | +<ReactTooltip id="my-tooltip" className="z-[999]"> |
| 130 | + <div className="max-w-[200px]"> |
| 131 | + <p>Tooltip content</p> |
| 132 | + </div> |
| 133 | +</ReactTooltip> |
| 134 | +``` |
| 135 | + |
| 136 | +### HoverCard Balloon UI |
| 137 | +The balloon tooltips in OpenSign Drive now properly support dark mode: |
| 138 | + |
| 139 | +```jsx |
| 140 | +// These automatically get dark styling in dark mode |
| 141 | +<HoverCard> |
| 142 | + <HoverCardContent> |
| 143 | + Document information |
| 144 | + </HoverCardContent> |
| 145 | +</HoverCard> |
| 146 | +``` |
| 147 | + |
| 148 | +## Dark Mode Features Added |
| 149 | + |
| 150 | +### 1. **React-Tour Modal Styling** |
| 151 | +- Background: `#1F2937` (VS Code modal background) |
| 152 | +- Text: `#E5E7EB` (soft white for readability) |
| 153 | +- Borders: `#374151` (subtle borders) |
| 154 | +- Buttons: VS Code-style primary/secondary buttons |
| 155 | + |
| 156 | +### 2. **ReactTooltip Styling** |
| 157 | +- Background: `#1F2937` with proper contrast |
| 158 | +- Border: `#374151` for definition |
| 159 | +- Box shadow: Enhanced for dark backgrounds |
| 160 | +- Text: `#E5E7EB` for optimal readability |
| 161 | + |
| 162 | +### 3. **HoverCard Balloon UI** |
| 163 | +- Background: `#1F2937` (matches VS Code) |
| 164 | +- Text: `#E5E7EB` for readability |
| 165 | +- Arrow: Automatically matches background color |
| 166 | +- Enhanced shadows for dark backgrounds |
| 167 | + |
| 168 | +### 4. **React-Datepicker Support** |
| 169 | +- Calendar background: `#1F2937` |
| 170 | +- Selected dates: VS Code blue (`#007ACC`) |
| 171 | +- Hover states: Proper contrast ratios |
| 172 | +- Navigation arrows: Themed appropriately |
| 173 | + |
| 174 | +## CSS Classes Reference |
| 175 | + |
| 176 | +| Class | Purpose | Dark Mode Color | |
| 177 | +|-------|---------|----------------| |
| 178 | +| `icon-improved` | Better icon visibility | `#CCCCCC` | |
| 179 | +| `icon-muted` | Muted but visible icons | `#999999` | |
| 180 | +| `icon-disabled` | Disabled icon state | `#858585` | |
| 181 | +| `op-btn-vscode-disabled` | VS Code disabled button | Background: `#3C3C3C` | |
| 182 | +| `btn-themed-disabled` | Themed disabled button | Uses CSS variables | |
| 183 | +| `icon-themed` | Variable-based icon color | `var(--icon-color)` | |
| 184 | +| `.reactour__helper` | `#1F2937` background | |
| 185 | +| `.react-tooltip` | `#1F2937` background | |
| 186 | +| `.HoverCardContent` | `#1F2937` background | |
| 187 | +| `.react-datepicker` | `#1F2937` background | |
| 188 | + |
| 189 | +## Migration Guide |
| 190 | + |
| 191 | +### From JavaScript Function to Tailwind |
| 192 | +```jsx |
| 193 | +// Before |
| 194 | +<i style={{ color: getThemeIconColor() }} className="fa-light fa-plus" /> |
| 195 | + |
| 196 | +// After |
| 197 | +<i className="fa-light fa-plus icon-improved" /> |
| 198 | +``` |
| 199 | + |
| 200 | +### From Hardcoded Colors to Theme-aware |
| 201 | +```jsx |
| 202 | +// Before |
| 203 | +<i className="fa-light fa-plus text-gray-500" /> |
| 204 | + |
| 205 | +// After (automatic improvement) |
| 206 | +<i className="fa-light fa-plus text-gray-500" /> |
| 207 | +// OR explicitly |
| 208 | +<i className="fa-light fa-plus icon-improved" /> |
| 209 | +``` |
| 210 | + |
| 211 | +## Migration Notes |
| 212 | + |
| 213 | +All existing tooltip and tour components will automatically inherit the new dark mode styling when the theme is set to `opensigndark`. No code changes required for existing implementations. |
0 commit comments