mirror of
				https://github.com/valentineus/popov.link.git
				synced 2025-11-04 06:49:45 +03:00 
			
		
		
		
	Refactor Pagination component and add Next and Prev components
This commit is contained in:
		@@ -1,4 +1,7 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
 | 
					import Next from "./Pagination/Next.astro";
 | 
				
			||||||
 | 
					import Prev from "./Pagination/Prev.astro";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Props = {
 | 
					type Props = {
 | 
				
			||||||
	readonly prevUrl?: string;
 | 
						readonly prevUrl?: string;
 | 
				
			||||||
	readonly nextUrl?: string;
 | 
						readonly nextUrl?: string;
 | 
				
			||||||
@@ -8,39 +11,14 @@ const { prevUrl, nextUrl } = Astro.props;
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style lang="scss">
 | 
					<style lang="scss">
 | 
				
			||||||
	.pagination {
 | 
						div {
 | 
				
			||||||
		overflow: hidden;
 | 
							overflow: hidden;
 | 
				
			||||||
		padding: 3rem 0;
 | 
							padding: 3rem 0;
 | 
				
			||||||
		width: 100%;
 | 
							width: 100%;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	.prev,
 | 
					 | 
				
			||||||
	.next {
 | 
					 | 
				
			||||||
		max-width: 40%;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	.prev {
 | 
					 | 
				
			||||||
		float: left;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	.next {
 | 
					 | 
				
			||||||
		float: right;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="pagination">
 | 
					<div>
 | 
				
			||||||
	{
 | 
						{prevUrl && <Prev url={prevUrl} />}
 | 
				
			||||||
		prevUrl && (
 | 
						{nextUrl && <Next url={nextUrl} />}
 | 
				
			||||||
			<span class="prev">
 | 
					 | 
				
			||||||
				<a href={prevUrl}>< Prev</a>
 | 
					 | 
				
			||||||
			</span>
 | 
					 | 
				
			||||||
		)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		nextUrl && (
 | 
					 | 
				
			||||||
			<span class="next">
 | 
					 | 
				
			||||||
				<a href={nextUrl}>Next ></a>
 | 
					 | 
				
			||||||
			</span>
 | 
					 | 
				
			||||||
		)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								src/components/Pagination/Next.astro
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/components/Pagination/Next.astro
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					type Props = {
 | 
				
			||||||
 | 
						readonly url: string;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { url } = Astro.props;
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style lang="scss">
 | 
				
			||||||
 | 
						span {
 | 
				
			||||||
 | 
							float: right;
 | 
				
			||||||
 | 
							max-width: 40%;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<span>
 | 
				
			||||||
 | 
						<a href={url}>Next ></a>
 | 
				
			||||||
 | 
					</span>
 | 
				
			||||||
							
								
								
									
										18
									
								
								src/components/Pagination/Prev.astro
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/components/Pagination/Prev.astro
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					type Props = {
 | 
				
			||||||
 | 
						readonly url: string;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { url } = Astro.props;
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style lang="scss">
 | 
				
			||||||
 | 
						span {
 | 
				
			||||||
 | 
							float: left;
 | 
				
			||||||
 | 
							max-width: 40%;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<span>
 | 
				
			||||||
 | 
						<a href={url}>< Prev</a>
 | 
				
			||||||
 | 
					</span>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user