| 1 |
{ |
| 2 |
"apiVersion": 3, |
| 3 |
"$schema": "https://schemas.wp.org/trunk/block.json", |
| 4 |
"name": "blockenberg/tutorial-card", |
| 5 |
"title": "Tutorial Card", |
| 6 |
"description": "A structured tutorial block with steps, prerequisites, materials, learning outcomes, and progress tracking.", |
| 7 |
"category": "bkbg-blog", |
| 8 |
"icon": "welcome-learn-more", |
| 9 |
"keywords": [ |
| 10 |
"tutorial", |
| 11 |
"guide", |
| 12 |
"steps", |
| 13 |
"how-to", |
| 14 |
"lesson", |
| 15 |
"course" |
| 16 |
], |
| 17 |
"editorScript": "bkbg-tutorial-card-editor", |
| 18 |
"editorStyle": "bkbg-tutorial-card-style", |
| 19 |
"style": "bkbg-tutorial-card-style", |
| 20 |
"viewScript": "bkbg-tutorial-card-frontend", |
| 21 |
"supports": { |
| 22 |
"html": false, |
| 23 |
"anchor": true, |
| 24 |
"className": true, |
| 25 |
"align": [ |
| 26 |
"wide", |
| 27 |
"full" |
| 28 |
] |
| 29 |
}, |
| 30 |
"attributes": { |
| 31 |
"tutorialTitle": { |
| 32 |
"type": "string", |
| 33 |
"default": "Getting Started with React Hooks" |
| 34 |
}, |
| 35 |
"subtitle": { |
| 36 |
"type": "string", |
| 37 |
"default": "A hands-on guide for intermediate developers" |
| 38 |
}, |
| 39 |
"author": { |
| 40 |
"type": "string", |
| 41 |
"default": "Alex Johnson" |
| 42 |
}, |
| 43 |
"showAuthor": { |
| 44 |
"type": "boolean", |
| 45 |
"default": true |
| 46 |
}, |
| 47 |
"difficulty": { |
| 48 |
"type": "string", |
| 49 |
"default": "intermediate" |
| 50 |
}, |
| 51 |
"duration": { |
| 52 |
"type": "string", |
| 53 |
"default": "45 minutes" |
| 54 |
}, |
| 55 |
"showDuration": { |
| 56 |
"type": "boolean", |
| 57 |
"default": true |
| 58 |
}, |
| 59 |
"completionRate": { |
| 60 |
"type": "number", |
| 61 |
"default": 0 |
| 62 |
}, |
| 63 |
"showProgress": { |
| 64 |
"type": "boolean", |
| 65 |
"default": false |
| 66 |
}, |
| 67 |
"layout": { |
| 68 |
"type": "string", |
| 69 |
"default": "vertical" |
| 70 |
}, |
| 71 |
"showStepDurations": { |
| 72 |
"type": "boolean", |
| 73 |
"default": true |
| 74 |
}, |
| 75 |
"showTips": { |
| 76 |
"type": "boolean", |
| 77 |
"default": true |
| 78 |
}, |
| 79 |
"prerequisites": { |
| 80 |
"type": "array", |
| 81 |
"default": [ |
| 82 |
{ |
| 83 |
"text": "Basic JavaScript (variables, functions, arrays)" |
| 84 |
}, |
| 85 |
{ |
| 86 |
"text": "Familiarity with React class components" |
| 87 |
}, |
| 88 |
{ |
| 89 |
"text": "Node.js installed (v16+)" |
| 90 |
} |
| 91 |
] |
| 92 |
}, |
| 93 |
"showPrerequisites": { |
| 94 |
"type": "boolean", |
| 95 |
"default": true |
| 96 |
}, |
| 97 |
"prerequisitesLabel": { |
| 98 |
"type": "string", |
| 99 |
"default": "Prerequisites" |
| 100 |
}, |
| 101 |
"steps": { |
| 102 |
"type": "array", |
| 103 |
"default": [ |
| 104 |
{ |
| 105 |
"title": "Set Up Your Project", |
| 106 |
"content": "Create a new React app using Create React App or Vite. Make sure you're using React 16.8 or higher to access Hooks.", |
| 107 |
"duration": "5 min", |
| 108 |
"tip": "Use `npm create vite@latest my-app -- --template react` for a faster setup." |
| 109 |
}, |
| 110 |
{ |
| 111 |
"title": "Your First useState Hook", |
| 112 |
"content": "Replace your class component's `this.state` with the `useState` hook. Call `const [count, setCount] = useState(0)` at the top of your function component.", |
| 113 |
"duration": "10 min", |
| 114 |
"tip": "Hooks must be called at the top level of your component — never inside loops or conditions." |
| 115 |
}, |
| 116 |
{ |
| 117 |
"title": "Handle Side Effects with useEffect", |
| 118 |
"content": "Move your `componentDidMount` and `componentDidUpdate` logic into `useEffect`. Return a cleanup function to replicate `componentWillUnmount`.", |
| 119 |
"duration": "15 min", |
| 120 |
"tip": "Pass an empty dependency array `[]` to run the effect only once on mount." |
| 121 |
}, |
| 122 |
{ |
| 123 |
"title": "Build a Custom Hook", |
| 124 |
"content": "Extract reusable stateful logic into a function prefixed with `use`. Custom hooks let you share logic across components without changing the component hierarchy.", |
| 125 |
"duration": "10 min", |
| 126 |
"tip": "Name custom hooks starting with `use` so React knows to apply the rules of Hooks." |
| 127 |
}, |
| 128 |
{ |
| 129 |
"title": "Test Your Hooks", |
| 130 |
"content": "Use React Testing Library and `renderHook` from `@testing-library/react-hooks` to unit-test your custom hooks in isolation.", |
| 131 |
"duration": "5 min", |
| 132 |
"tip": "" |
| 133 |
} |
| 134 |
] |
| 135 |
}, |
| 136 |
"showSteps": { |
| 137 |
"type": "boolean", |
| 138 |
"default": true |
| 139 |
}, |
| 140 |
"stepsLabel": { |
| 141 |
"type": "string", |
| 142 |
"default": "Steps" |
| 143 |
}, |
| 144 |
"materials": { |
| 145 |
"type": "array", |
| 146 |
"default": [ |
| 147 |
{ |
| 148 |
"text": "Code editor (VS Code recommended)" |
| 149 |
}, |
| 150 |
{ |
| 151 |
"text": "Node.js v16+ and npm" |
| 152 |
}, |
| 153 |
{ |
| 154 |
"text": "Basic React project or sandbox" |
| 155 |
} |
| 156 |
] |
| 157 |
}, |
| 158 |
"showMaterials": { |
| 159 |
"type": "boolean", |
| 160 |
"default": true |
| 161 |
}, |
| 162 |
"materialsLabel": { |
| 163 |
"type": "string", |
| 164 |
"default": "What you'll need" |
| 165 |
}, |
| 166 |
"outcomes": { |
| 167 |
"type": "array", |
| 168 |
"default": [ |
| 169 |
{ |
| 170 |
"text": "Understand the motivation behind React Hooks" |
| 171 |
}, |
| 172 |
{ |
| 173 |
"text": "Use useState and useEffect confidently" |
| 174 |
}, |
| 175 |
{ |
| 176 |
"text": "Build reusable custom hooks" |
| 177 |
}, |
| 178 |
{ |
| 179 |
"text": "Migrate class components to functional components" |
| 180 |
} |
| 181 |
] |
| 182 |
}, |
| 183 |
"showOutcomes": { |
| 184 |
"type": "boolean", |
| 185 |
"default": true |
| 186 |
}, |
| 187 |
"outcomesLabel": { |
| 188 |
"type": "string", |
| 189 |
"default": "What you'll learn" |
| 190 |
}, |
| 191 |
"titleTypo": { |
| 192 |
"type": "object", |
| 193 |
"default": {} |
| 194 |
}, |
| 195 |
"bodyTypo": { |
| 196 |
"type": "object", |
| 197 |
"default": {} |
| 198 |
}, |
| 199 |
"borderRadius": { |
| 200 |
"type": "number", |
| 201 |
"default": 12 |
| 202 |
}, |
| 203 |
"bgColor": { |
| 204 |
"type": "string", |
| 205 |
"default": "#ffffff" |
| 206 |
}, |
| 207 |
"borderColor": { |
| 208 |
"type": "string", |
| 209 |
"default": "#e5e7eb" |
| 210 |
}, |
| 211 |
"headerBg": { |
| 212 |
"type": "string", |
| 213 |
"default": "#0f172a" |
| 214 |
}, |
| 215 |
"headerColor": { |
| 216 |
"type": "string", |
| 217 |
"default": "#ffffff" |
| 218 |
}, |
| 219 |
"accentColor": { |
| 220 |
"type": "string", |
| 221 |
"default": "#3b82f6" |
| 222 |
}, |
| 223 |
"stepNumberBg": { |
| 224 |
"type": "string", |
| 225 |
"default": "#3b82f6" |
| 226 |
}, |
| 227 |
"stepNumberColor": { |
| 228 |
"type": "string", |
| 229 |
"default": "#ffffff" |
| 230 |
}, |
| 231 |
"stepBorderColor": { |
| 232 |
"type": "string", |
| 233 |
"default": "#e5e7eb" |
| 234 |
}, |
| 235 |
"stepTipBg": { |
| 236 |
"type": "string", |
| 237 |
"default": "#fffbeb" |
| 238 |
}, |
| 239 |
"stepTipColor": { |
| 240 |
"type": "string", |
| 241 |
"default": "#92400e" |
| 242 |
}, |
| 243 |
"stepTipBorderColor": { |
| 244 |
"type": "string", |
| 245 |
"default": "#fcd34d" |
| 246 |
}, |
| 247 |
"prerequisiteBg": { |
| 248 |
"type": "string", |
| 249 |
"default": "#f1f5f9" |
| 250 |
}, |
| 251 |
"prerequisiteColor": { |
| 252 |
"type": "string", |
| 253 |
"default": "#334155" |
| 254 |
}, |
| 255 |
"materialBg": { |
| 256 |
"type": "string", |
| 257 |
"default": "#f0f9ff" |
| 258 |
}, |
| 259 |
"materialColor": { |
| 260 |
"type": "string", |
| 261 |
"default": "#0c4a6e" |
| 262 |
}, |
| 263 |
"outcomeBg": { |
| 264 |
"type": "string", |
| 265 |
"default": "#f0fdf4" |
| 266 |
}, |
| 267 |
"outcomeColor": { |
| 268 |
"type": "string", |
| 269 |
"default": "#14532d" |
| 270 |
}, |
| 271 |
"progressBg": { |
| 272 |
"type": "string", |
| 273 |
"default": "#e5e7eb" |
| 274 |
}, |
| 275 |
"progressFill": { |
| 276 |
"type": "string", |
| 277 |
"default": "#3b82f6" |
| 278 |
}, |
| 279 |
"subtitleSize": { |
| 280 |
"type": "number", |
| 281 |
"default": 11 |
| 282 |
}, |
| 283 |
"authorSize": { |
| 284 |
"type": "number", |
| 285 |
"default": 12 |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
|