Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions snippets/animal-hair-ambassador/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Animal Hair Ambassador</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header>
<h1>Animal Hair Ambassador</h1>
<p>Adorable spokes-animals show off stylish hair accessories.</p>
</header>
<main>
<section class="gallery">
<article class="card">
<img src="https://placehold.co/300x200" alt="Dog wearing a colorful clip" />
<h2>Playful Pup</h2>
<p>Bright clips for a fun day out.</p>
</article>
<article class="card">
<img src="https://placehold.co/300x200" alt="Cat with elegant bow" />
<h2>Chic Kitty</h2>
<p>Elegant bows for special occasions.</p>
</article>
<article class="card">
<img src="https://placehold.co/300x200" alt="Bunny with ribbon" />
<h2>Lovely Bunny</h2>
<p>Soft ribbons that complement every hop.</p>
</article>
</section>
</main>
<footer>
<p>© 2024 Animal Hair Ambassador</p>
</footer>
<script src="script.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions snippets/animal-hair-ambassador/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Simple theme toggle
const header = document.querySelector('header');
const toggle = document.createElement('button');
toggle.textContent = 'Toggle Theme';
header.appendChild(toggle);

let dark = false;
toggle.addEventListener('click', () => {
dark = !dark;
document.body.style.background = dark ? '#333' : '#fdfdfd';
document.body.style.color = dark ? '#fdfdfd' : '#333';
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script assumes the DOM is ready when it executes, but it runs immediately when loaded. Since the script is placed at the end of the body, this should work, but it's fragile. Consider wrapping the code in a DOMContentLoaded event listener or moving the script to the end of the body tag.

Suggested change
document.body.style.color = dark ? '#fdfdfd' : '#333';
document.addEventListener('DOMContentLoaded', () => {
const header = document.querySelector('header');
const toggle = document.createElement('button');
toggle.textContent = 'Toggle Theme';
header.appendChild(toggle);
let dark = false;
toggle.addEventListener('click', () => {
dark = !dark;
document.body.style.background = dark ? '#333' : '#fdfdfd';
document.body.style.color = dark ? '#fdfdfd' : '#333';
});

Copilot uses AI. Check for mistakes.

Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The theme toggle only changes the body background and text color, but doesn't update other elements like cards, header, or footer. This creates an inconsistent dark theme experience. Consider using CSS classes or CSS custom properties for comprehensive theming.

Suggested change
document.body.style.color = dark ? '#fdfdfd' : '#333';
document.body.classList.toggle('dark-theme', dark);

Copilot uses AI. Check for mistakes.

});
48 changes: 48 additions & 0 deletions snippets/animal-hair-ambassador/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
body {
font-family: Arial, sans-serif;
margin: 0;
background: #fdfdfd;
color: #333;
}

header {
background: #ff6f91;
color: #fff;
padding: 1rem;
text-align: center;
}

.gallery {
display: flex;
flex-wrap: wrap;
gap: 1rem;
justify-content: center;
padding: 1rem;
}

.card {
background: #fff;
border: 1px solid #ddd;
border-radius: 8px;
width: 300px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
text-align: center;
}

.card img {
width: 100%;
border-bottom: 1px solid #ddd;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}

.card h2 {
margin: 0.5rem 0;
}

footer {
text-align: center;
padding: 1rem;
background: #eee;
margin-top: 1rem;
}