mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 11:46:39 -04:00
refactor(css): add prefix to component classes for consistency (#744)
* refactor(navbar): add hextra prefix to navbar and hamburger menu classes - Updated CSS class names from `nav-container` to `hextra-nav-container` and `hamburger-menu` to `hextra-hamburger-menu` for improved clarity and consistency across the project. - Adjusted related JavaScript and documentation to reflect the new class names. * refactor(search): update class names for search components - Renamed CSS classes from `search-wrapper`, `search-input`, `active`, `no-result`, `prefix`, `excerpt`, and `match` to `hextra-search-wrapper`, `hextra-search-input`, `hextra-search-active`, `hextra-search-no-result`, `hextra-search-prefix`, `hextra-search-excerpt`, and `hextra-search-match` for improved clarity and consistency. - Updated JavaScript selectors to match the new class names, ensuring functionality remains intact. - Adjusted HTML structure to reflect the new class naming convention. * refactor(search): update search component class names for consistency - Renamed existing search-related CSS classes to include the `hextra` prefix for improved clarity and consistency. - Added optional nested classes for enhanced customization of the search UI, including titles, active states, and result snippets. - Removed outdated breadcrumb section as no specific class is available. * refactor(sidebar): rename sidebar classes for consistency - Updated CSS and JavaScript to replace `sidebar-container` with `hextra-sidebar-container` and `sidebar-active-item` with `hextra-sidebar-active-item` for improved clarity and consistency across the project. - Adjusted related documentation to reflect the new class names. * refactor(language & theme): update class names for consistency - Renamed language switcher and theme toggle classes to include the `hextra` prefix for improved clarity and consistency across the project. - Updated related JavaScript selectors and documentation to reflect the new class names. * refactor(css & html): rename classes for consistency and clarity - Updated various CSS class names to include the `hextra` prefix, enhancing consistency across the project. This includes renaming classes such as `content` to `hextra-content`, `filename` to `hextra-code-filename`, and `steps` to `hextra-steps`. - Adjusted related HTML and JavaScript to reflect the new class names, ensuring functionality and styling remain intact. - Updated documentation to include the new class names for better clarity. * refactor(language): update class names for language options - Renamed the `language-options` class to `hextra-language-options` for consistency with the existing `hextra` prefix convention. - Updated the corresponding HTML to reflect the new class name, ensuring clarity and uniformity across the project. * refactor(css & html): rename classes for consistency and clarity - Renamed CSS classes to include the `hextra` prefix, such as changing `subheading-anchor` to `hextra-subheading-anchor` and `footnotes` to `hextra-footnotes`, enhancing consistency across the project. - Updated related HTML and documentation to reflect the new class names, ensuring clarity and uniformity. * feat(typography): add styling for horizontal lines - Introduced new styles for horizontal lines to enhance visual separation in content. The styles apply margin and border color adjustments, ensuring consistency with the overall design. * feat(blog): add draft release announcement for Hextra v0.10.0 - Created a new markdown file for the draft release announcement of Hextra v0.10.0, including upgrade instructions and author details. - The announcement is currently marked as a draft and may be updated before the official release. * refactor(css & html): rename `hextra-content` class to `content` for consistency - Updated the `hextra-content` class to simply `content` across various HTML files and CSS, enhancing clarity and consistency in the codebase. - Adjusted the `package.json` script for the development server to include the `-F` flag for better functionality. * refactor(typography & markdown): enhance table styling and markdown syntax - Updated CSS for tables to improve styling, including adjustments to margins, borders, and text properties for better readability. - Revised markdown documentation to standardize table formatting and improve clarity, including consistent syntax for headers and lists. - Enhanced examples in the documentation to reflect the updated styling and ensure accurate representation of output. * fix(blog): update text color for improved accessibility - Modified the text color in the blog single layout to enhance readability in dark mode by adding a dark text color class. - Ensured consistency in styling for better user experience across different themes. * docs(blog): update draft release announcement for Hextra v0.10.0 - Revised the "What's New" section to include a TODO placeholder for future updates. - Added a comprehensive migration guide detailing the CSS class prefix changes to enhance consistency and avoid conflicts. - Updated the announcement to reflect the new class naming conventions for various components. * chore: rebuild css
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
// Change shortcut key to cmd+k on Mac, iPad or iPhone.
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
if (/iPad|iPhone|Macintosh/.test(navigator.userAgent)) {
|
||||
// select the kbd element under the .search-wrapper class
|
||||
const keys = document.querySelectorAll(".search-wrapper kbd");
|
||||
// select the kbd element under the .hextra-search-wrapper class
|
||||
const keys = document.querySelectorAll(".hextra-search-wrapper kbd");
|
||||
keys.forEach(key => {
|
||||
key.innerHTML = '<span class="hx:text-xs">⌘</span>K';
|
||||
});
|
||||
@@ -22,7 +22,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
(function () {
|
||||
const searchDataURL = '{{ $searchData.RelPermalink }}';
|
||||
|
||||
const inputElements = document.querySelectorAll('.search-input');
|
||||
const inputElements = document.querySelectorAll('.hextra-search-input');
|
||||
for (const el of inputElements) {
|
||||
el.addEventListener('focus', init);
|
||||
el.addEventListener('keyup', search);
|
||||
@@ -30,7 +30,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
el.addEventListener('input', handleInputChange);
|
||||
}
|
||||
|
||||
const shortcutElements = document.querySelectorAll('.search-wrapper kbd');
|
||||
const shortcutElements = document.querySelectorAll('.hextra-search-wrapper kbd');
|
||||
|
||||
function setShortcutElementsOpacity(opacity) {
|
||||
shortcutElements.forEach(el => {
|
||||
@@ -45,12 +45,12 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
// Get the search wrapper, input, and results elements.
|
||||
function getActiveSearchElement() {
|
||||
const inputs = Array.from(document.querySelectorAll('.search-wrapper')).filter(el => el.clientHeight > 0);
|
||||
const inputs = Array.from(document.querySelectorAll('.hextra-search-wrapper')).filter(el => el.clientHeight > 0);
|
||||
if (inputs.length === 1) {
|
||||
return {
|
||||
wrapper: inputs[0],
|
||||
inputElement: inputs[0].querySelector('.search-input'),
|
||||
resultsElement: inputs[0].querySelector('.search-results')
|
||||
inputElement: inputs[0].querySelector('.hextra-search-input'),
|
||||
resultsElement: inputs[0].querySelector('.hextra-search-results')
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
@@ -103,7 +103,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
const { resultsElement } = getActiveSearchElement();
|
||||
if (!resultsElement) return { result: undefined, index: -1 };
|
||||
|
||||
const result = resultsElement.querySelector('.active');
|
||||
const result = resultsElement.querySelector('.hextra-search-active');
|
||||
if (!result) return { result: undefined, index: -1 };
|
||||
|
||||
const index = parseInt(result.dataset.index, 10);
|
||||
@@ -116,10 +116,10 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
if (!resultsElement) return;
|
||||
|
||||
const { result: activeResult } = getActiveResult();
|
||||
activeResult && activeResult.classList.remove('active');
|
||||
activeResult && activeResult.classList.remove('hextra-search-active');
|
||||
const result = resultsElement.querySelector(`[data-index="${index}"]`);
|
||||
if (result) {
|
||||
result.classList.add('active');
|
||||
result.classList.add('hextra-search-active');
|
||||
result.focus();
|
||||
}
|
||||
}
|
||||
@@ -384,7 +384,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
if (!resultsElement) return;
|
||||
|
||||
if (!results.length) {
|
||||
resultsElement.innerHTML = `<span class="no-result">{{ $noResultsFound | safeHTML }}</span>`;
|
||||
resultsElement.innerHTML = `<span class="hextra-search-no-result">{{ $noResultsFound | safeHTML }}</span>`;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -418,14 +418,14 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
const result = results[i];
|
||||
if (result.prefix) {
|
||||
fragment.appendChild(createElement(`
|
||||
<div class="prefix">${result.prefix}</div>`));
|
||||
<div class="hextra-search-prefix">${result.prefix}</div>`));
|
||||
}
|
||||
let li = createElement(`
|
||||
let li = createElement(`
|
||||
<li>
|
||||
<a data-index="${i}" href="${result.route}" class=${i === 0 ? "active" : ""}>
|
||||
<div class="title">`+ highlightMatches(result.children.title, query) + `</div>` +
|
||||
<a data-index="${i}" href="${result.route}" class=${i === 0 ? "hextra-search-active" : ""}>
|
||||
<div class="hextra-search-title">`+ highlightMatches(result.children.title, query) + `</div>` +
|
||||
(result.children.content ?
|
||||
`<div class="excerpt">` + highlightMatches(result.children.content, query) + `</div>` : '') + `
|
||||
`<div class="hextra-search-excerpt">` + highlightMatches(result.children.content, query) + `</div>` : '') + `
|
||||
</a>
|
||||
</li>`);
|
||||
li.addEventListener('mousemove', handleMouseMove);
|
||||
|
Reference in New Issue
Block a user