✨ add graphic at the end of blogposts
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
		
							parent
							
								
									04ae6835a6
								
							
						
					
					
						commit
						e3a8d6f3b2
					
				
					 3 changed files with 545 additions and 2 deletions
				
			
		
							
								
								
									
										262
									
								
								public/jollyroger_dark.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										262
									
								
								public/jollyroger_dark.svg
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
		 After Width: | Height: | Size: 112 KiB  | 
							
								
								
									
										262
									
								
								public/jollyroger_light.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										262
									
								
								public/jollyroger_light.svg
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
		 After Width: | Height: | Size: 108 KiB  | 
| 
						 | 
					@ -7,6 +7,22 @@ type Props = CollectionEntry<'blog'>['data'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { title, description, pubDate } = Astro.props;
 | 
					const { title, description, pubDate } = Astro.props;
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					<script type="module" client:load>
 | 
				
			||||||
 | 
					  const jollyroger = document.getElementById('jr');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const updateImageForTheme = () => {
 | 
				
			||||||
 | 
					    const currentTheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
 | 
				
			||||||
 | 
					    jollyroger.src = currentTheme === 'dark' ? '/jollyroger_light.svg' : '/jollyroger_dark.svg';
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  updateImageForTheme();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const themeToggle = document.getElementById('themeToggle');
 | 
				
			||||||
 | 
					  if (themeToggle) {
 | 
				
			||||||
 | 
					    themeToggle.addEventListener('click', updateImageForTheme);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<SectionContainer>
 | 
					<SectionContainer>
 | 
				
			||||||
	<main class="flex flex-col flex-1 mb-auto break-words mt-4">
 | 
						<main class="flex flex-col flex-1 mb-auto break-words mt-4">
 | 
				
			||||||
		<article class="flex flex-col gap-1">
 | 
							<article class="flex flex-col gap-1">
 | 
				
			||||||
| 
						 | 
					@ -16,6 +32,9 @@ const { title, description, pubDate } = Astro.props;
 | 
				
			||||||
			<div class="blog">
 | 
								<div class="blog">
 | 
				
			||||||
				<slot />
 | 
									<slot />
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		</article>
 | 
					      <div class="flex items-center justify-center">
 | 
				
			||||||
 | 
					        <img src="/jollyroger_dark.svg" id="jr" class="md:w-48 w-40" alt="Jolly Roger"/>
 | 
				
			||||||
 | 
							  </div>
 | 
				
			||||||
 | 
					    </article>
 | 
				
			||||||
	</main>
 | 
						</main>
 | 
				
			||||||
</SectionContainer>
 | 
					</SectionContainer>
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue