| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
-
- <div class="page-switcher-container">
- @for (int i = 0; i < Pages.Length; i++)
- {
- var pageIndex = i;
- <button class="page-button @(CurrentPage == pageIndex ? "active" : "")"
- @onclick="() => OnPageChanged(pageIndex)">
- @Pages[pageIndex]
- </button>
- }
- </div>
- @code
- {
- [Parameter]
- public string[] Pages { get; set; } = { "1", "2", "3" };
- [Parameter]
- public int CurrentPage { get; set; } = 0;
- [Parameter]
- public EventCallback<int> PageChanged { get; set; }
- private async Task OnPageChanged(int pageIndex)
- {
- if (pageIndex != CurrentPage)
- {
- CurrentPage = pageIndex;
- await PageChanged.InvokeAsync(pageIndex);
- }
- }
- }
- <style>
- .page-switcher-container {
- display: flex;
- gap: 20px;
- align-items: center;
- justify-content: right;
- }
- .page-button {
- /* padding: 12px 24px; */
- border: none;
- border-radius: 8px;
- font-weight: 400;
- font-size: 12px;
- width: 60px;
- height: 40px;
- cursor: pointer;
- transition: all 0.3s ease;
- background-color: #f1f5f9;
- color: #64748b;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
- }
- .page-button:hover {
- background-color: #e2e8f0;
- transform: translateY(-2px);
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
- }
- .page-button.active {
- background: linear-gradient(135deg, #3b82f6, #8b5cf6);
- color: white;
- box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
- }
- .page-button:focus {
- outline: none;
- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
- }
- .page-button:active {
- transform: translateY(0);
- }
- </style>
|