diff --git a/src/components/Block/GithubActivityFeed.astro b/src/components/Block/GithubActivityFeed.astro index 2755a8a..18b72ca 100644 --- a/src/components/Block/GithubActivityFeed.astro +++ b/src/components/Block/GithubActivityFeed.astro @@ -37,7 +37,7 @@ import '@styles/icons.css'; class="xat-link" :href="item.commit.url" :title="'Commit: ' + item.commit.hash" - x-text="item.commit.hash">item.commit.hashCommit item.commit.hash diff --git a/src/components/Block/SchemePreference.astro b/src/components/Block/SchemePreference.astro index 857145d..1b4422f 100644 --- a/src/components/Block/SchemePreference.astro +++ b/src/components/Block/SchemePreference.astro @@ -14,8 +14,8 @@ > { tabs.map((tab, i) => ( @@ -83,6 +87,7 @@ const isVertical = orientation === 'vertical'; this.activeTab = checkedTab?.dataset.tab || null; }, + setActiveTab(e) { const tab = e.target.closest('[role="tab"]'); @@ -90,6 +95,18 @@ const isVertical = orientation === 'vertical'; return; } + this.activateTab(tab); + }, + + activateTab(tab) { + const tabs = Array.from(this.$el.querySelectorAll('[role="tab"]')); + + tabs.forEach((t) => { + const isActive = t === tab; + t.setAttribute('tabindex', isActive ? '0' : '-1'); + t.setAttribute('aria-selected', isActive ? 'true' : 'false'); + }); + this.activeTab = tab.dataset.tab; tab.focus(); @@ -101,6 +118,65 @@ const isVertical = orientation === 'vertical'; } }, 0); }, + + focusAdjacentTab(direction) { + const tabs = Array.from(this.$el.querySelectorAll('[role="tab"]')); + const currentIndex = tabs.indexOf(document.activeElement?.closest('[role="tab"]')); + + if (currentIndex === -1) { + return; + } + + const newIndex = (currentIndex + direction + tabs.length) % tabs.length; + const newTab = tabs[newIndex]; + const radio = newTab.querySelector('input[type="radio"]'); + + if (radio) { + radio.checked = true; + } + + this.activateTab(newTab); + }, + + focusFirst() { + const tabs = Array.from(this.$el.querySelectorAll('[role="tab"]')); + const first = tabs[0]; + const radio = first?.querySelector('input[type="radio"]'); + + if (radio) { + radio.checked = true; + } + + this.activateTab(first); + }, + + focusLast() { + const tabs = Array.from(this.$el.querySelectorAll('[role="tab"]')); + const last = tabs[tabs.length - 1]; + const radio = last?.querySelector('input[type="radio"]'); + + if (radio) { + radio.checked = true; + } + + this.activateTab(last); + }, + + handleTabKeydown(e) { + const isVertical = e.currentTarget?.dataset.orientation === 'vertical'; + const keyToDirection = isVertical + ? { ArrowUp: -1, ArrowDown: 1 } + : { ArrowLeft: -1, ArrowRight: 1 }; + const direction = keyToDirection[e.key]; + + if (direction === undefined) { + return; + } + + e.preventDefault(); + this.focusAdjacentTab(direction); + }, + isActiveTab() { return this.activeTab === this.$el.dataset.tabPanel; }, diff --git a/src/components/Block/TechStack.astro b/src/components/Block/TechStack.astro index 84962c7..1db3fe4 100644 --- a/src/components/Block/TechStack.astro +++ b/src/components/Block/TechStack.astro @@ -129,7 +129,7 @@ const tabs = sections.map((section) => ({ flex-direction: row; flex-wrap: nowrap; gap: var(--gap-xs); - padding: var(--gap); + padding: var(--gap) 0; max-width: 100%; overflow: scroll; scrollbar-width: none; @@ -145,7 +145,7 @@ const tabs = sections.map((section) => ({ background-image: none; background-color: var(--surface-1); border: var(--border-width) solid var(--surface-2); - padding: var(--gap-xs) var(--gap); + padding: var(--gap) var(--gap); white-space: nowrap; border-radius: calc(var(--border-radius)); } @@ -196,7 +196,7 @@ const tabs = sections.map((section) => ({ .xt-stack-tablist { flex-direction: row; gap: var(--gap-sm); - margin: 0 0 var(--gap) 0; + margin: 0; } } diff --git a/src/components/Layout/Header.astro b/src/components/Layout/Header.astro index 70c0634..2c5a106 100644 --- a/src/components/Layout/Header.astro +++ b/src/components/Layout/Header.astro @@ -5,9 +5,9 @@ import SearchBar from '@components/Block/SearchBar.astro'; ---
- - + +
diff --git a/src/pages/index.astro b/src/pages/index.astro index cbae398..1745739 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -90,7 +90,7 @@ const frontmatter = generateFrontmatter(page, 'Website'); } .header::before { - background-color: oklch(0% 0 0 / 0.45); + background-color: oklch(0% 0 0 / 0.75); } .header::after { @@ -101,7 +101,7 @@ const frontmatter = generateFrontmatter(page, 'Website'); color-scheme: dark; min-height: 100svh; align-content: center; - padding: var(--gap); + padding: var(--gap) var(--gap) 0 var(--gap); width: 100%; justify-content: center; text-align: center; @@ -176,6 +176,7 @@ const frontmatter = generateFrontmatter(page, 'Website'); .container-feed { position: relative; + padding-top: 0; padding-bottom: 0; } diff --git a/src/pages/tools/dns.astro b/src/pages/tools/dns.astro index 843be1a..9119d4a 100644 --- a/src/pages/tools/dns.astro +++ b/src/pages/tools/dns.astro @@ -125,16 +125,15 @@ const records: { name: string; title: string; selected: boolean }[] = [
- +
@@ -164,8 +163,9 @@ const records: { name: string; title: string; selected: boolean }[] = [ id={`type_${type.name}`} checked={type.selected} /> -