Skip to content

Commit

Permalink
Solara
Browse files Browse the repository at this point in the history
  • Loading branch information
IdeaS0ft committed Sep 15, 2024
1 parent 68c4090 commit 921dea6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
39 changes: 32 additions & 7 deletions solara/lib/core/dashboard/brand/BrandDetailController.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class BrandDetailController {
try {
this.view.updateAppNameTitle(`${configuraationsResult.brand.key} (${configuraationsResult.brand.name})`);
await this.showSections(configuraationsResult);
this.view.showIndex();
} catch (error) {
console.error('Error initializing app:', error);
alert(error.message);
Expand Down Expand Up @@ -145,7 +146,7 @@ class BrandDetailController {
if (sectionInfo.key === 'theme') {
this.createThemeSections(sectionInfo)
} else {
this.createSection(sectionInfo, sectionInfo.content, sectionInfo.name, sectionInfo.inputType)
this.createSection(sectionInfo.key, sectionInfo, sectionInfo.content, sectionInfo.name, sectionInfo.inputType)
}
}
} catch (error) {
Expand All @@ -155,15 +156,39 @@ class BrandDetailController {
}

createThemeSections(sectionInfo) {
this.createSection(sectionInfo, sectionInfo.content.colors, 'Theme Colors', 'color', 'colors')
this.createSection(sectionInfo, sectionInfo.content.typography, 'Theme Typography', 'text', 'typography')
this.createSection(sectionInfo, sectionInfo.content.spacing, 'Theme Spacing', 'text', 'spacing')
this.createSection(sectionInfo, sectionInfo.content.borderRadius, 'Theme Border Radius', 'text', 'borderRadius')
this.createSection(sectionInfo, sectionInfo.content.elevation, 'Theme Elevation', 'text', 'elevation')
this.createSection(`${sectionInfo.key}_colors`,
sectionInfo,
sectionInfo.content.colors,
'Theme Colors',
'color',
'colors')
this.createSection(`${sectionInfo.key}_typography`,
sectionInfo, sectionInfo.content.typography,
'Theme Typography',
'text',
'typography')
this.createSection(`${sectionInfo.key}_spacing`,
sectionInfo, sectionInfo.content.spacing,
'Theme Spacing', 'text',
'spacing')
this.createSection(
`${sectionInfo.key}_borderRadius`,
sectionInfo, sectionInfo.content.borderRadius,
'Theme Border Radius',
'text',
'borderRadius')
this.createSection(
`${sectionInfo.key}_elevation`,
sectionInfo,
sectionInfo.content.elevation,
'Theme Elevation',
'text',
'elevation')
}

createSection(sectionInfo, content, sectionName, inputType, propertiesGroupName = null) {
createSection(id, sectionInfo, content, sectionName, inputType, propertiesGroupName = null) {
const sectionElement = this.view.createSection(sectionInfo.key, sectionName, inputType);
sectionElement.id = id;
sectionElement.dataset.propertiesGroupName = propertiesGroupName

this.view.sectionsContainer.appendChild(sectionElement);
Expand Down
16 changes: 16 additions & 0 deletions solara/lib/core/dashboard/brand/BrandDetailView.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,22 @@ class BrandDetailView {
this.onboardSheet.show('Brand Details', 'Add Brand', onSubmit);
}

showIndex() {
const sectionsContainer = this.sectionsContainer;
const sectionElements = Array.from(sectionsContainer.querySelectorAll('.section'));

const indexElement = document.getElementById('index');

// Clear existing items if needed
indexElement.innerHTML = '';

sectionElements.forEach(sectionElement => {
const newItem = document.createElement('li');
newItem.innerHTML = `<a href="#${sectionElement.id}">${sectionElement.dataset.name}</a>`;
indexElement.appendChild(newItem);
});
}

async hideOnboardBrandForm() {
this.onboardSheet.hide();
}
Expand Down

0 comments on commit 921dea6

Please sign in to comment.