mirror of
https://github.com/shadoll/sLogos.git
synced 2025-12-20 17:34:03 +00:00
feat: clean up unused styles and remove URL manipulation from Preview component
This commit is contained in:
@@ -383,12 +383,6 @@ div.logo-image img {
|
|||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Removed grid-specific styles */
|
|
||||||
|
|
||||||
/* Removed list-specific styles */
|
|
||||||
|
|
||||||
/* Removed unused row-specific styles */
|
|
||||||
|
|
||||||
.logo-img {
|
.logo-img {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
|
|||||||
@@ -260,7 +260,8 @@
|
|||||||
closeDropdown,
|
closeDropdown,
|
||||||
setCompactMode,
|
setCompactMode,
|
||||||
onCopy: copyUrl,
|
onCopy: copyUrl,
|
||||||
onDownload: downloadLogo
|
onDownload: downloadLogo,
|
||||||
|
openLogoByAnchor
|
||||||
};
|
};
|
||||||
console.log("App: Updated window.appData with", logos.length, "logos,", displayLogos.length, "display logos");
|
console.log("App: Updated window.appData with", logos.length, "logos,", displayLogos.length, "display logos");
|
||||||
}
|
}
|
||||||
@@ -464,33 +465,19 @@
|
|||||||
return allTags.find((t) => t.text === text);
|
return allTags.find((t) => t.text === text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPreview(logo) {
|
// The openPreview function has been removed as it's now handled directly
|
||||||
// Use the routing approach
|
// by the Grid.svelte component using the router
|
||||||
const previewUrl = `#/preview/${encodeURIComponent(logo.name.replace(/\s+/g, '-').toLowerCase())}`;
|
|
||||||
window.location.href = previewUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
function openLogoByAnchor(hash) {
|
function openLogoByAnchor(hash) {
|
||||||
if (!hash) return;
|
if (!hash || !hash.startsWith("#/preview/")) return;
|
||||||
|
|
||||||
let anchor = "";
|
const anchor = decodeURIComponent(hash.replace("#/preview/", ""));
|
||||||
// Handle both old and new formats
|
|
||||||
if (hash.startsWith("#preview-")) {
|
|
||||||
anchor = decodeURIComponent(hash.replace("#preview-", "").replace(/-/g, " "));
|
|
||||||
} else if (hash.startsWith("#/preview/")) {
|
|
||||||
anchor = decodeURIComponent(hash.replace("#/preview/", "").replace(/-/g, " "));
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const found = logos.find(
|
const found = logos.find(
|
||||||
(l) =>
|
(l) => l.name.replace(/\s+/g, "-").toLowerCase() === anchor,
|
||||||
l.name.replace(/\s+/g, "-").toLowerCase() ===
|
|
||||||
anchor.replace(/\s+/g, "-").toLowerCase(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
// Use routing approach - use router format
|
|
||||||
const previewUrl = `#/preview/${encodeURIComponent(found.name.replace(/\s+/g, '-').toLowerCase())}`;
|
const previewUrl = `#/preview/${encodeURIComponent(found.name.replace(/\s+/g, '-').toLowerCase())}`;
|
||||||
console.log("App: Navigating to router URL:", previewUrl);
|
console.log("App: Navigating to router URL:", previewUrl);
|
||||||
window.location.href = previewUrl;
|
window.location.href = previewUrl;
|
||||||
|
|||||||
@@ -50,9 +50,6 @@
|
|||||||
? logo.colorConfig
|
? logo.colorConfig
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
// No URL manipulation in the component anymore
|
|
||||||
// Parent components should handle all URL and navigation concerns
|
|
||||||
|
|
||||||
// Only fetch SVG source when displayed
|
// Only fetch SVG source when displayed
|
||||||
$: if (show && logo) {
|
$: if (show && logo) {
|
||||||
// Fetch SVG source when logo is displayed and is an SVG
|
// Fetch SVG source when logo is displayed and is an SVG
|
||||||
@@ -73,9 +70,6 @@
|
|||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Component doesn't handle any window events or URL changes
|
|
||||||
// Parent should handle all navigation logic
|
|
||||||
|
|
||||||
// Svelte action to remove width/height from SVGs for responsive scaling
|
// Svelte action to remove width/height from SVGs for responsive scaling
|
||||||
function removeSvgSize(node) {
|
function removeSvgSize(node) {
|
||||||
function cleanSvg() {
|
function cleanSvg() {
|
||||||
@@ -257,7 +251,7 @@
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.18);
|
box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.18);
|
||||||
z-index: 1;
|
z-index: 2;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +373,6 @@
|
|||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.18);
|
box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.18);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
.logo-tags {
|
.logo-tags {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -465,7 +458,6 @@
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.18);
|
box-shadow: 0 2px 16px 4px rgba(0, 0, 0, 0.18);
|
||||||
z-index: 1;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user