Skip to content

Commit

Permalink
fix CV bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Larkin committed Aug 2, 2024
1 parent bcdcc3d commit 76dc139
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 43 deletions.
13 changes: 9 additions & 4 deletions assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* General section container styles */
.section-container {
position: relative;
padding-left: 150px; /* Adjust as needed */
margin-bottom: 4rem; /* Space between sections */
}

/* Section title styles */
.section-title {
position: absolute;
left: 0;
Expand All @@ -16,13 +18,16 @@
color: inherit !important;
}

/* Section content styles */
.section-content {
width: 100%;
}

.flex.flex-col.items-center.max-w-prose.mx-auto,
.flex.flex-col.items-center.max-w-prose.mx-auto .flex.flex-col.lg\:gap-x-6.w-100.px-6.sm\:px-0 {
align-items: center !important;
padding-left: 0 !important;
/* 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;
}
81 changes: 42 additions & 39 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,46 +40,49 @@ window.addEventListener('load', function() {
});

// MOVE SECTION TITLES TO LEFT OF HOME SCREEN
console.log('Custom JS file loaded');

document.addEventListener('DOMContentLoaded', function() {
console.log('DOM fully loaded and parsed');

const sections = document.querySelectorAll('.mb-6.text-3xl.font-bold.text-gray-900.dark\\:text-white, .text-3xl.font-bold');
console.log('Found', sections.length, 'section headings');

sections.forEach((section, index) => {
// Skip the CV section by checking the parent elements' class list
if (section.closest('.flex.flex-col.items-center.max-w-prose.mx-auto')) return;

console.log(`Processing section ${index}:`, section.textContent);

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()}"`);
});
console.log('DOM fully loaded and parsed');

const sections = document.querySelectorAll('.mb-6.text-3xl.font-bold.text-gray-900.dark\\:text-white, .text-3xl.font-bold');
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;

console.log('Finished processing all sections');
// 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');
}

console.log(`Processed: "${section.textContent.trim()}"`);
});

console.log('Finished processing all sections');
});


0 comments on commit 76dc139

Please sign in to comment.