| 1 |
( function () { |
| 2 |
var el = wp.element.createElement; |
| 3 |
var Fragment = wp.element.Fragment; |
| 4 |
var registerBlockType = wp.blocks.registerBlockType; |
| 5 |
var InspectorControls = wp.blockEditor.InspectorControls; |
| 6 |
var useBlockProps = wp.blockEditor.useBlockProps; |
| 7 |
var PanelBody = wp.components.PanelBody; |
| 8 |
var PanelColorSettings = wp.blockEditor.PanelColorSettings; |
| 9 |
var ToggleControl = wp.components.ToggleControl; |
| 10 |
var RangeControl = wp.components.RangeControl; |
| 11 |
var SelectControl = wp.components.SelectControl; |
| 12 |
var TextControl = wp.components.TextControl; |
| 13 |
var TextareaControl = wp.components.TextareaControl; |
| 14 |
var Button = wp.components.Button; |
| 15 |
|
| 16 |
var _clTC, _clTV; |
| 17 |
function _tc() { return _clTC || (_clTC = window.bkbgTypographyControl); } |
| 18 |
function _tv(obj, prefix) { var fn = _clTV || (_clTV = window.bkbgTypoCssVars); return fn ? fn(obj, prefix) : {}; } |
| 19 |
|
| 20 |
var difficultyOptions = [ |
| 21 |
{ label: '🟢 Beginner', value: 'beginner' }, |
| 22 |
{ label: '🟡 Intermediate', value: 'intermediate' }, |
| 23 |
{ label: '🔴 Advanced', value: 'advanced' } |
| 24 |
]; |
| 25 |
|
| 26 |
var sectionTypeOptions = [ |
| 27 |
{ label: 'Text', value: 'text' }, |
| 28 |
{ label: '💡 Tip', value: 'tip' }, |
| 29 |
{ label: '⚠️ Warning', value: 'warning' }, |
| 30 |
{ label: '📝 Note', value: 'note' } |
| 31 |
]; |
| 32 |
|
| 33 |
var resourceTypeOptions = [ |
| 34 |
{ label: '📄 Article', value: 'article' }, |
| 35 |
{ label: '🎥 Video', value: 'video' }, |
| 36 |
{ label: '⬇️ Download', value: 'download' }, |
| 37 |
{ label: '✏️ Exercise', value: 'exercise' }, |
| 38 |
{ label: '🔗 Link', value: 'link' } |
| 39 |
]; |
| 40 |
|
| 41 |
var resourceIcon = { article: '📄', video: '🎥', download: '⬇️', exercise: '✏️', link: '🔗' }; |
| 42 |
var diffInfo = { |
| 43 |
beginner: { label: '🟢 Beginner', bg: '#dcfce7', color: '#14532d' }, |
| 44 |
intermediate: { label: '🟡 Intermediate', bg: '#fef9c3', color: '#713f12' }, |
| 45 |
advanced: { label: '🔴 Advanced', bg: '#fee2e2', color: '#991b1b' } |
| 46 |
}; |
| 47 |
|
| 48 |
function upd(arr, idx, field, val) { |
| 49 |
return arr.map(function (e, i) { |
| 50 |
if (i !== idx) return e; |
| 51 |
var u = {}; u[field] = val; |
| 52 |
return Object.assign({}, e, u); |
| 53 |
}); |
| 54 |
} |
| 55 |
|
| 56 |
function sectionBoxStyle(type, a) { |
| 57 |
if (type === 'tip') return { background: a.tipBg, color: a.tipColor, borderLeft: '4px solid ' + a.tipBorder, borderRadius: 8 }; |
| 58 |
if (type === 'warning') return { background: a.warningBg, color: a.warningColor, borderLeft: '4px solid ' + a.warningBorder, borderRadius: 8 }; |
| 59 |
if (type === 'note') return { background: a.noteBg, color: a.noteColor, borderLeft: '4px solid ' + a.noteBorder, borderRadius: 8 }; |
| 60 |
return {}; |
| 61 |
} |
| 62 |
|
| 63 |
function sectionIcon(type) { |
| 64 |
if (type === 'tip') return '💡 '; |
| 65 |
if (type === 'warning') return '⚠️ '; |
| 66 |
if (type === 'note') return '📝 '; |
| 67 |
return ''; |
| 68 |
} |
| 69 |
|
| 70 |
function labelPill(text, bg, color) { |
| 71 |
return el('span', { style: { background: bg, color: color, padding: '3px 10px', borderRadius: 100, fontSize: 11, fontWeight: 700, whiteSpace: 'nowrap' } }, text); |
| 72 |
} |
| 73 |
|
| 74 |
function sectionHead(label, a) { |
| 75 |
return el('div', { style: { fontSize: 10, fontWeight: 700, textTransform: 'uppercase', letterSpacing: '.09em', color: a.accentColor, borderBottom: '2px solid ' + a.accentColor, paddingBottom: 5, marginBottom: 10 } }, label); |
| 76 |
} |
| 77 |
|
| 78 |
registerBlockType('blockenberg/course-lesson', { |
| 79 |
edit: function (props) { |
| 80 |
var a = props.attributes; |
| 81 |
var set = props.setAttributes; |
| 82 |
var blockProps = useBlockProps({ className: 'bkbg-cl-editor-wrap', style: Object.assign({}, _tv(a.typoTitle, '--bkbg-cles-ttl-'), _tv(a.typoBody, '--bkbg-cles-body-')) }); |
| 83 |
var diff = diffInfo[a.difficulty] || diffInfo.intermediate; |
| 84 |
|
| 85 |
var preview = el('div', { className: 'bkbg-cl-wrap', style: { border: '1px solid ' + a.borderColor, borderRadius: a.borderRadius + 'px', overflow: 'hidden', background: a.bgColor } }, |
| 86 |
// Header |
| 87 |
el('div', { style: { background: a.headerBg, padding: '20px 26px' } }, |
| 88 |
// Breadcrumb row |
| 89 |
el('div', { style: { display: 'flex', alignItems: 'center', gap: 10, marginBottom: 10, flexWrap: 'wrap' } }, |
| 90 |
a.showModule && el('span', { style: { fontSize: a.moduleTitleSize || 11, color: a.metaColor, fontWeight: 600 } }, a.moduleTitle), |
| 91 |
a.showModule && a.showLessonNumber && el('span', { style: { color: a.metaColor, opacity: .4 } }, '/'), |
| 92 |
a.showLessonNumber && el('span', { style: { fontSize: 11, color: a.metaColor } }, a.lessonNumber) |
| 93 |
), |
| 94 |
el('h2', { className: 'bkbg-cl-title', style: { color: a.headerColor } }, a.lessonTitle), |
| 95 |
// Meta pills |
| 96 |
el('div', { style: { display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' } }, |
| 97 |
a.showDuration && labelPill('⏱ ' + a.duration, 'rgba(255,255,255,.1)', '#cbd5e1'), |
| 98 |
a.showDifficulty && labelPill(diff.label, diff.bg, diff.color), |
| 99 |
a.showInstructor && labelPill('👤 ' + a.instructor, 'rgba(255,255,255,.1)', '#cbd5e1') |
| 100 |
) |
| 101 |
), |
| 102 |
// Body |
| 103 |
el('div', { style: { padding: '20px 26px', display: 'grid', gap: 20 } }, |
| 104 |
// Intro |
| 105 |
a.showIntro && a.intro && el('div', { style: { background: a.introBg, borderRadius: 8, padding: '14px 18px' } }, |
| 106 |
el('p', { style: { margin: 0, color: a.introColor, lineHeight: (a.lineHeight / 100).toFixed(2) } }, a.intro) |
| 107 |
), |
| 108 |
// Objectives + Prerequisites side-by-side |
| 109 |
el('div', { style: { display: 'grid', gridTemplateColumns: a.showPrerequisites ? '1fr 1fr' : '1fr', gap: 16 } }, |
| 110 |
a.showObjectives && el('div', { style: { background: a.objectiveBg, padding: 16, borderRadius: 8 } }, |
| 111 |
sectionHead(a.objectivesLabel, a), |
| 112 |
el('ul', { style: { margin: 0, padding: 0, listStyle: 'none' } }, |
| 113 |
a.objectives.map(function (obj, i) { |
| 114 |
return el('li', { key: i, style: { display: 'flex', gap: 8, marginBottom: 6, alignItems: 'flex-start' } }, |
| 115 |
el('span', { style: { color: a.objectiveDot, flexShrink: 0, marginTop: 1, fontWeight: 700 } }, '✓'), |
| 116 |
el('span', { style: { color: a.objectiveColor } }, obj) |
| 117 |
); |
| 118 |
}) |
| 119 |
) |
| 120 |
), |
| 121 |
a.showPrerequisites && el('div', { style: { background: a.prereqBg, padding: 16, borderRadius: 8 } }, |
| 122 |
sectionHead(a.prerequisitesLabel, a), |
| 123 |
el('ul', { style: { margin: 0, padding: 0, listStyle: 'none' } }, |
| 124 |
a.prerequisites.map(function (p, i) { |
| 125 |
return el('li', { key: i, style: { display: 'flex', gap: 8, marginBottom: 6, alignItems: 'flex-start' } }, |
| 126 |
el('span', { style: { color: a.prereqDot, flexShrink: 0, marginTop: 1 } }, '•'), |
| 127 |
el('span', { style: { color: a.prereqColor } }, p) |
| 128 |
); |
| 129 |
}) |
| 130 |
) |
| 131 |
) |
| 132 |
), |
| 133 |
// Content Sections |
| 134 |
a.showSections && el('div', null, |
| 135 |
sectionHead('Lesson Content', a), |
| 136 |
el('div', { style: { display: 'grid', gap: 16 } }, |
| 137 |
a.sections.map(function (sec, i) { |
| 138 |
var isBox = sec.type !== 'text'; |
| 139 |
var boxStyle = Object.assign({ padding: isBox ? '12px 16px' : '0' }, sectionBoxStyle(sec.type, a)); |
| 140 |
return el('div', { key: i, style: boxStyle }, |
| 141 |
el('h4', { style: { margin: '0 0 6px', color: isBox ? 'inherit' : a.headingColor, fontSize: a.fontSize + 'px' } }, sectionIcon(sec.type) + sec.heading), |
| 142 |
el('p', { style: { margin: 0, color: isBox ? 'inherit' : a.textColor, fontSize: a.fontSize + 'px', lineHeight: (a.lineHeight / 100).toFixed(2) } }, sec.content) |
| 143 |
); |
| 144 |
}) |
| 145 |
) |
| 146 |
), |
| 147 |
// Resources |
| 148 |
a.showResources && el('div', null, |
| 149 |
sectionHead(a.resourcesLabel, a), |
| 150 |
el('div', { style: { display: 'grid', gap: 6 } }, |
| 151 |
a.resources.map(function (r, i) { |
| 152 |
return el('div', { key: i, style: { display: 'flex', alignItems: 'center', gap: 10, padding: '10px 14px', background: a.resourceBg, borderRadius: 8, borderLeft: '3px solid ' + a.accentColor } }, |
| 153 |
el('span', { style: { flexShrink: 0 } }, resourceIcon[r.type] || '🔗'), |
| 154 |
el('span', { style: { color: a.accentColor, fontWeight: 500 } }, r.title) |
| 155 |
); |
| 156 |
}) |
| 157 |
) |
| 158 |
) |
| 159 |
), |
| 160 |
// Prev/Next Nav |
| 161 |
a.showNav && el('div', { style: { background: a.navBg, borderTop: '1px solid ' + a.borderColor, padding: '14px 26px', display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 12, flexWrap: 'wrap' } }, |
| 162 |
el('div', { style: { maxWidth: '45%' } }, |
| 163 |
el('div', { style: { fontSize: 10, color: '#94a3b8', textTransform: 'uppercase', letterSpacing: '.07em', marginBottom: 2 } }, '← Previous'), |
| 164 |
el('div', { style: { fontSize: a.fontSize + 'px', color: a.accentColor, fontWeight: 600 } }, a.prevLesson) |
| 165 |
), |
| 166 |
el('div', { style: { textAlign: 'right', maxWidth: '45%' } }, |
| 167 |
el('div', { style: { fontSize: 10, color: '#94a3b8', textTransform: 'uppercase', letterSpacing: '.07em', marginBottom: 2 } }, 'Next →'), |
| 168 |
el('div', { style: { fontSize: a.fontSize + 'px', color: a.accentColor, fontWeight: 600 } }, a.nextLesson) |
| 169 |
) |
| 170 |
) |
| 171 |
); |
| 172 |
|
| 173 |
return el(Fragment, null, |
| 174 |
el('div', blockProps, preview), |
| 175 |
el(InspectorControls, null, |
| 176 |
// Lesson Info |
| 177 |
el(PanelBody, { title: 'Lesson Info', initialOpen: true }, |
| 178 |
el(TextControl, { label: 'Lesson Title', value: a.lessonTitle, __nextHasNoMarginBottom: true, onChange: function (v) { set({ lessonTitle: v }); } }), |
| 179 |
el('div', { style: { marginTop: 8 } }, |
| 180 |
el(TextControl, { label: 'Module Title', value: a.moduleTitle, __nextHasNoMarginBottom: true, onChange: function (v) { set({ moduleTitle: v }); } }) |
| 181 |
), |
| 182 |
el('div', { style: { marginTop: 8, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 } }, |
| 183 |
el(ToggleControl, { label: 'Show Module', checked: a.showModule, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showModule: v }); } }), |
| 184 |
el(ToggleControl, { label: 'Show Lesson #', checked: a.showLessonNumber, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showLessonNumber: v }); } }) |
| 185 |
), |
| 186 |
el('div', { style: { marginTop: 8 } }, |
| 187 |
el(TextControl, { label: 'Lesson Number (e.g. Lesson 3 of 8)', value: a.lessonNumber, __nextHasNoMarginBottom: true, onChange: function (v) { set({ lessonNumber: v }); } }) |
| 188 |
), |
| 189 |
el('div', { style: { marginTop: 8, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 } }, |
| 190 |
el(TextControl, { label: 'Duration', value: a.duration, __nextHasNoMarginBottom: true, onChange: function (v) { set({ duration: v }); } }), |
| 191 |
el(TextControl, { label: 'Instructor', value: a.instructor, __nextHasNoMarginBottom: true, onChange: function (v) { set({ instructor: v }); } }) |
| 192 |
), |
| 193 |
el('div', { style: { marginTop: 8 } }, |
| 194 |
el(SelectControl, { label: 'Difficulty', value: a.difficulty, options: difficultyOptions, __nextHasNoMarginBottom: true, onChange: function (v) { set({ difficulty: v }); } }) |
| 195 |
), |
| 196 |
el('div', { style: { marginTop: 8, display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 8 } }, |
| 197 |
el(ToggleControl, { label: 'Duration', checked: a.showDuration, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showDuration: v }); } }), |
| 198 |
el(ToggleControl, { label: 'Difficulty', checked: a.showDifficulty, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showDifficulty: v }); } }), |
| 199 |
el(ToggleControl, { label: 'Instructor', checked: a.showInstructor, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showInstructor: v }); } }) |
| 200 |
) |
| 201 |
), |
| 202 |
// Introduction |
| 203 |
el(PanelBody, { title: 'Introduction', initialOpen: false }, |
| 204 |
el(ToggleControl, { label: 'Show Introduction', checked: a.showIntro, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showIntro: v }); } }), |
| 205 |
el('div', { style: { marginTop: 8 } }, |
| 206 |
el(TextareaControl, { label: 'Intro Text', value: a.intro, rows: 4, __nextHasNoMarginBottom: true, onChange: function (v) { set({ intro: v }); } }) |
| 207 |
) |
| 208 |
), |
| 209 |
// Objectives |
| 210 |
el(PanelBody, { title: 'Learning Objectives', initialOpen: false }, |
| 211 |
el(ToggleControl, { label: 'Show Objectives', checked: a.showObjectives, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showObjectives: v }); } }), |
| 212 |
el('div', { style: { marginTop: 8 } }, |
| 213 |
el(TextControl, { label: 'Section Label', value: a.objectivesLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ objectivesLabel: v }); } }) |
| 214 |
), |
| 215 |
el('div', { style: { marginTop: 8 } }, |
| 216 |
a.objectives.map(function (obj, i) { |
| 217 |
return el('div', { key: i, style: { display: 'flex', gap: 6, marginBottom: 6, alignItems: 'center' } }, |
| 218 |
el(TextControl, { label: '', value: obj, __nextHasNoMarginBottom: true, onChange: function (v) { set({ objectives: a.objectives.map(function (x, j) { return j === i ? v : x; }) }); } }), |
| 219 |
el(Button, { isDestructive: true, variant: 'link', onClick: function () { set({ objectives: a.objectives.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 220 |
); |
| 221 |
}), |
| 222 |
el(Button, { variant: 'primary', style: { width: '100%', justifyContent: 'center', marginTop: 4 }, onClick: function () { set({ objectives: a.objectives.concat(['New objective']) }); } }, '+ Add Objective') |
| 223 |
) |
| 224 |
), |
| 225 |
// Prerequisites |
| 226 |
el(PanelBody, { title: 'Prerequisites', initialOpen: false }, |
| 227 |
el(ToggleControl, { label: 'Show Prerequisites', checked: a.showPrerequisites, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showPrerequisites: v }); } }), |
| 228 |
el('div', { style: { marginTop: 8 } }, |
| 229 |
el(TextControl, { label: 'Section Label', value: a.prerequisitesLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ prerequisitesLabel: v }); } }) |
| 230 |
), |
| 231 |
el('div', { style: { marginTop: 8 } }, |
| 232 |
a.prerequisites.map(function (p, i) { |
| 233 |
return el('div', { key: i, style: { display: 'flex', gap: 6, marginBottom: 6, alignItems: 'center' } }, |
| 234 |
el(TextControl, { label: '', value: p, __nextHasNoMarginBottom: true, onChange: function (v) { set({ prerequisites: a.prerequisites.map(function (x, j) { return j === i ? v : x; }) }); } }), |
| 235 |
el(Button, { isDestructive: true, variant: 'link', onClick: function () { set({ prerequisites: a.prerequisites.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 236 |
); |
| 237 |
}), |
| 238 |
el(Button, { variant: 'primary', style: { width: '100%', justifyContent: 'center', marginTop: 4 }, onClick: function () { set({ prerequisites: a.prerequisites.concat(['New prerequisite']) }); } }, '+ Add Prerequisite') |
| 239 |
) |
| 240 |
), |
| 241 |
// Content Sections |
| 242 |
el(PanelBody, { title: 'Content Sections', initialOpen: false }, |
| 243 |
el(ToggleControl, { label: 'Show Content Sections', checked: a.showSections, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showSections: v }); } }), |
| 244 |
el('div', { style: { marginTop: 8 } }, |
| 245 |
a.sections.map(function (sec, i) { |
| 246 |
return el('div', { key: i, style: { marginBottom: 12, padding: '10px 12px', border: '1px solid #e5e7eb', borderRadius: 8, background: '#f8fafc' } }, |
| 247 |
el('div', { style: { display: 'flex', justifyContent: 'space-between', marginBottom: 8 } }, |
| 248 |
el('strong', { style: { fontSize: 11, color: '#374151' } }, 'Section ' + (i + 1)), |
| 249 |
el(Button, { isDestructive: true, variant: 'link', style: { fontSize: 11 }, onClick: function () { set({ sections: a.sections.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 250 |
), |
| 251 |
el(SelectControl, { label: 'Type', value: sec.type, options: sectionTypeOptions, __nextHasNoMarginBottom: true, onChange: function (v) { set({ sections: upd(a.sections, i, 'type', v) }); } }), |
| 252 |
el('div', { style: { marginTop: 8 } }, |
| 253 |
el(TextControl, { label: 'Heading', value: sec.heading, __nextHasNoMarginBottom: true, onChange: function (v) { set({ sections: upd(a.sections, i, 'heading', v) }); } }) |
| 254 |
), |
| 255 |
el('div', { style: { marginTop: 8 } }, |
| 256 |
el(TextareaControl, { label: 'Content', value: sec.content, rows: 3, __nextHasNoMarginBottom: true, onChange: function (v) { set({ sections: upd(a.sections, i, 'content', v) }); } }) |
| 257 |
) |
| 258 |
); |
| 259 |
}), |
| 260 |
el(Button, { variant: 'primary', style: { width: '100%', justifyContent: 'center', marginTop: 4 }, onClick: function () { set({ sections: a.sections.concat([{ heading: 'New Section', content: '', type: 'text' }]) }); } }, '+ Add Section') |
| 261 |
) |
| 262 |
), |
| 263 |
// Resources |
| 264 |
el(PanelBody, { title: 'Resources', initialOpen: false }, |
| 265 |
el(ToggleControl, { label: 'Show Resources', checked: a.showResources, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showResources: v }); } }), |
| 266 |
el('div', { style: { marginTop: 8 } }, |
| 267 |
el(TextControl, { label: 'Section Label', value: a.resourcesLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ resourcesLabel: v }); } }) |
| 268 |
), |
| 269 |
el('div', { style: { marginTop: 8 } }, |
| 270 |
a.resources.map(function (r, i) { |
| 271 |
return el('div', { key: i, style: { marginBottom: 10, padding: '10px 12px', border: '1px solid #e5e7eb', borderRadius: 8, background: '#f8fafc' } }, |
| 272 |
el('div', { style: { display: 'flex', justifyContent: 'flex-end', marginBottom: 6 } }, |
| 273 |
el(Button, { isDestructive: true, variant: 'link', style: { fontSize: 11 }, onClick: function () { set({ resources: a.resources.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 274 |
), |
| 275 |
el(SelectControl, { label: 'Type', value: r.type, options: resourceTypeOptions, __nextHasNoMarginBottom: true, onChange: function (v) { set({ resources: upd(a.resources, i, 'type', v) }); } }), |
| 276 |
el('div', { style: { marginTop: 8 } }, |
| 277 |
el(TextControl, { label: 'Title', value: r.title, __nextHasNoMarginBottom: true, onChange: function (v) { set({ resources: upd(a.resources, i, 'title', v) }); } }) |
| 278 |
), |
| 279 |
el('div', { style: { marginTop: 8 } }, |
| 280 |
el(TextControl, { label: 'URL', value: r.url, __nextHasNoMarginBottom: true, onChange: function (v) { set({ resources: upd(a.resources, i, 'url', v) }); } }) |
| 281 |
) |
| 282 |
); |
| 283 |
}), |
| 284 |
el(Button, { variant: 'primary', style: { width: '100%', justifyContent: 'center', marginTop: 4 }, onClick: function () { set({ resources: a.resources.concat([{ title: 'New Resource', url: '#', type: 'article' }]) }); } }, '+ Add Resource') |
| 285 |
) |
| 286 |
), |
| 287 |
// Navigation |
| 288 |
el(PanelBody, { title: 'Lesson Navigation', initialOpen: false }, |
| 289 |
el(ToggleControl, { label: 'Show Prev/Next Navigation', checked: a.showNav, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showNav: v }); } }), |
| 290 |
el('div', { style: { marginTop: 8 } }, |
| 291 |
el(TextControl, { label: 'Previous Lesson Title', value: a.prevLesson, __nextHasNoMarginBottom: true, onChange: function (v) { set({ prevLesson: v }); } }) |
| 292 |
), |
| 293 |
el('div', { style: { marginTop: 8 } }, |
| 294 |
el(TextControl, { label: 'Previous URL', value: a.prevLessonUrl, __nextHasNoMarginBottom: true, onChange: function (v) { set({ prevLessonUrl: v }); } }) |
| 295 |
), |
| 296 |
el('div', { style: { marginTop: 8 } }, |
| 297 |
el(TextControl, { label: 'Next Lesson Title', value: a.nextLesson, __nextHasNoMarginBottom: true, onChange: function (v) { set({ nextLesson: v }); } }) |
| 298 |
), |
| 299 |
el('div', { style: { marginTop: 8 } }, |
| 300 |
el(TextControl, { label: 'Next URL', value: a.nextLessonUrl, __nextHasNoMarginBottom: true, onChange: function (v) { set({ nextLessonUrl: v }); } }) |
| 301 |
) |
| 302 |
), |
| 303 |
// Typography |
| 304 |
el(PanelBody, { title: 'Typography', initialOpen: false }, |
| 305 |
_tc() && el(_tc(), { label: 'Lesson Title', value: a.typoTitle, onChange: function (v) { set({ typoTitle: v }); } }), |
| 306 |
_tc() && el(_tc(), { label: 'Body Text', value: a.typoBody, onChange: function (v) { set({ typoBody: v }); } }), |
| 307 |
el('div', { style: { marginTop: 8 } }, |
| 308 |
el(RangeControl, { label: 'Module Title Size (px)', value: a.moduleTitleSize, min: 9, max: 18, __nextHasNoMarginBottom: true, onChange: function (v) { set({ moduleTitleSize: v }); } }) |
| 309 |
) |
| 310 |
), |
| 311 |
el(PanelBody, { title: 'Spacing', initialOpen: false }, |
| 312 |
el(RangeControl, { label: 'Border Radius (px)', value: a.borderRadius, min: 0, max: 24, __nextHasNoMarginBottom: true, onChange: function (v) { set({ borderRadius: v }); } }) |
| 313 |
), |
| 314 |
// Colors |
| 315 |
el(PanelColorSettings, { |
| 316 |
title: 'Header Colors', |
| 317 |
initialOpen: false, |
| 318 |
colorSettings: [ |
| 319 |
{ label: 'Header BG', value: a.headerBg, onChange: function (v) { set({ headerBg: v || '#0f172a' }); } }, |
| 320 |
{ label: 'Header Text', value: a.headerColor, onChange: function (v) { set({ headerColor: v || '#ffffff' }); } }, |
| 321 |
{ label: 'Meta Text', value: a.metaColor, onChange: function (v) { set({ metaColor: v || '#94a3b8' }); } } |
| 322 |
] |
| 323 |
}), |
| 324 |
el(PanelColorSettings, { |
| 325 |
title: 'Body & Section Colors', |
| 326 |
initialOpen: false, |
| 327 |
colorSettings: [ |
| 328 |
{ label: 'Block BG', value: a.bgColor, onChange: function (v) { set({ bgColor: v || '#ffffff' }); } }, |
| 329 |
{ label: 'Border', value: a.borderColor, onChange: function (v) { set({ borderColor: v || '#e5e7eb' }); } }, |
| 330 |
{ label: 'Accent', value: a.accentColor, onChange: function (v) { set({ accentColor: v || '#3b82f6' }); } }, |
| 331 |
{ label: 'Body Text', value: a.textColor, onChange: function (v) { set({ textColor: v || '#374151' }); } }, |
| 332 |
{ label: 'Section Heading', value: a.headingColor, onChange: function (v) { set({ headingColor: v || '#111827' }); } }, |
| 333 |
{ label: 'Intro BG', value: a.introBg, onChange: function (v) { set({ introBg: v || '#f0f9ff' }); } }, |
| 334 |
{ label: 'Intro Text', value: a.introColor, onChange: function (v) { set({ introColor: v || '#0369a1' }); } }, |
| 335 |
{ label: 'Objectives BG', value: a.objectiveBg, onChange: function (v) { set({ objectiveBg: v || '#f0fdf4' }); } }, |
| 336 |
{ label: 'Objectives Text', value: a.objectiveColor,onChange: function (v) { set({ objectiveColor: v || '#14532d' }); } }, |
| 337 |
{ label: 'Prereq BG', value: a.prereqBg, onChange: function (v) { set({ prereqBg: v || '#f8fafc' }); } }, |
| 338 |
{ label: 'Resource BG', value: a.resourceBg, onChange: function (v) { set({ resourceBg: v || '#f8fafc' }); } }, |
| 339 |
{ label: 'Nav BG', value: a.navBg, onChange: function (v) { set({ navBg: v || '#f8fafc' }); } } |
| 340 |
] |
| 341 |
}), |
| 342 |
el(PanelColorSettings, { |
| 343 |
title: 'Callout Block Colors', |
| 344 |
initialOpen: false, |
| 345 |
colorSettings: [ |
| 346 |
{ label: 'Tip BG', value: a.tipBg, onChange: function (v) { set({ tipBg: v || '#fefce8' }); } }, |
| 347 |
{ label: 'Tip Text', value: a.tipColor, onChange: function (v) { set({ tipColor: v || '#713f12' }); } }, |
| 348 |
{ label: 'Tip Border', value: a.tipBorder, onChange: function (v) { set({ tipBorder: v || '#fbbf24' }); } }, |
| 349 |
{ label: 'Warning BG', value: a.warningBg, onChange: function (v) { set({ warningBg: v || '#fff7ed' }); } }, |
| 350 |
{ label: 'Warning Text', value: a.warningColor, onChange: function (v) { set({ warningColor: v || '#9a3412' }); } }, |
| 351 |
{ label: 'Warning Border',value: a.warningBorder,onChange: function (v) { set({ warningBorder: v || '#f97316' }); } }, |
| 352 |
{ label: 'Note BG', value: a.noteBg, onChange: function (v) { set({ noteBg: v || '#eff6ff' }); } }, |
| 353 |
{ label: 'Note Text', value: a.noteColor, onChange: function (v) { set({ noteColor: v || '#1e40af' }); } }, |
| 354 |
{ label: 'Note Border', value: a.noteBorder, onChange: function (v) { set({ noteBorder: v || '#3b82f6' }); } } |
| 355 |
] |
| 356 |
}) |
| 357 |
) |
| 358 |
); |
| 359 |
}, |
| 360 |
|
| 361 |
save: function (props) { |
| 362 |
var useBlockProps = wp.blockEditor.useBlockProps; |
| 363 |
return wp.element.createElement('div', useBlockProps.save(), |
| 364 |
wp.element.createElement('div', { |
| 365 |
className: 'bkbg-course-lesson-app', |
| 366 |
'data-opts': JSON.stringify(props.attributes) |
| 367 |
}) |
| 368 |
); |
| 369 |
} |
| 370 |
}); |
| 371 |
}() ); |
| 372 |
|