Skip to content

Commit

Permalink
fix CV
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Larkin committed Aug 2, 2024
1 parent 76dc139 commit b932b74
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 38 deletions.
9 changes: 0 additions & 9 deletions assets/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@
.section-content {
width: 100%;
}

/* Center alignment for CV page content */
.cv-content-center {
display: flex;
flex-direction: column;
align-items: center;
max-width: initial !important;
padding-left: 0 !important;
}
56 changes: 27 additions & 29 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,34 @@ document.addEventListener('DOMContentLoaded', function() {
console.log('Found', sections.length, 'section headings');

sections.forEach((section, index) => {
// Skip sections on the home page
if (document.body.classList.contains('home-page')) return;
// Exclude CV sections based on their container's ID or class
if (section.closest('#cv-page') || section.closest('.blox-resume-skills') || section.closest('.blox-resume-awards')) {
return;
}

// Specific handling for CV page sections
if (section.closest('#cv-page')) {
const container = document.createElement('div');
container.className = 'section-container';

// Move the section title into the container
container.appendChild(section.cloneNode(true));
section.classList.add('section-title');

// Create a div for the content
const contentDiv = document.createElement('div');
contentDiv.className = 'section-content';
container.appendChild(contentDiv);

// Move all following siblings until the next section into this container
let nextElement = section.nextElementSibling;
while (nextElement && !nextElement.matches('.mb-6.text-3xl.font-bold.text-gray-900.dark\\:text-white, .text-3xl.font-bold')) {
const temp = nextElement.nextElementSibling;
contentDiv.appendChild(nextElement);
nextElement = temp;
}

// Replace the original section with our new container
section.parentNode.replaceChild(container, section);
} else {
// Ensure CV sections have centered content
section.closest('.flex.flex-col.items-center.max-w-prose.mx-auto').classList.add('cv-content-center');
// Proceed with modifications for other sections
const container = document.createElement('div');
container.className = 'section-container';

// Move the section title into the container
container.appendChild(section.cloneNode(true));
section.classList.add('section-title');

// Create a div for the content
const contentDiv = document.createElement('div');
contentDiv.className = 'section-content';
container.appendChild(contentDiv);

// Move all following siblings until the next section into this container
let nextElement = section.nextElementSibling;
while (nextElement && !nextElement.matches('.mb-6.text-3xl.font-bold.text-gray-900.dark\\:text-white, .text-3xl.font-bold')) {
const temp = nextElement.nextElementSibling;
contentDiv.appendChild(nextElement);
nextElement = temp;
}

// Replace the original section with our new container
section.parentNode.replaceChild(container, section);

console.log(`Processed: "${section.textContent.trim()}"`);
});
Expand All @@ -86,3 +83,4 @@ document.addEventListener('DOMContentLoaded', function() {
});



0 comments on commit b932b74

Please sign in to comment.