FIX - compact Companies Glass subnavigation

This commit is contained in:
DerEchteAlec
2026-08-13 19:25:06 +02:00
parent 4284143cb2
commit 7fac1bdbcd
6 changed files with 107 additions and 2 deletions
+21
View File
@@ -1660,6 +1660,27 @@ label.sky-list-item__row {
transition-duration: 0ms; transition-duration: 0ms;
} }
.sky-glass.sky-segmented--navigation.sky-segmented--compact {
height: 48px;
min-height: 48px;
padding-block: 2px;
}
.sky-segmented--navigation.sky-segmented--compact .sky-segmented-button {
height: var(--sky-touch-target, 44px);
min-height: var(--sky-touch-target, 44px);
flex-direction: row;
gap: 0;
font-size: 15px;
font-weight: 500;
line-height: 20px;
}
.sky-segmented--compact .sky-segmented__highlight {
top: 2px;
bottom: 2px;
}
.sky-segmented__highlight { .sky-segmented__highlight {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
@@ -102,6 +102,42 @@ describe('SkySegmented navigation', () => {
) )
}) })
it('keeps text-only Glass navigation compact with 44px targets', async () => {
const html = await renderToString(
createSSRApp({
render: () =>
h(
SkySegmented,
{
activeIndex: 1,
ariaLabel: 'Availability',
compact: true,
itemCount: 3,
navigation: true,
},
{
default: () =>
['Available', 'Busy', 'Closed'].map((label, index) =>
h(SkySegmentedButton, { active: index === 1 }, () => label),
),
},
),
}),
)
expect(html).toContain('sky-segmented--compact')
expect(html).toContain('width:calc(33.3333% - 5.3333px)')
expect(controls).toMatch(
/\.sky-glass\.sky-segmented--navigation\.sky-segmented--compact\s*\{[^}]*height:\s*48px[^}]*min-height:\s*48px[^}]*padding-block:\s*2px/s,
)
expect(controls).toMatch(
/\.sky-segmented--navigation\.sky-segmented--compact \.sky-segmented-button\s*\{[^}]*height:\s*var\(--sky-touch-target, 44px\)[^}]*font-size:\s*15px[^}]*font-weight:\s*500/s,
)
expect(controls).toMatch(
/\.sky-segmented--compact \.sky-segmented__highlight\s*\{[^}]*top:\s*2px[^}]*bottom:\s*2px/s,
)
})
it('lets subnavbar search controls fill the available Konsta row', () => { it('lets subnavbar search controls fill the available Konsta row', () => {
expect(controls).toMatch( expect(controls).toMatch(
/\.sky-searchbar\s*\{[^}]*width:\s*100%[^}]*flex:\s*1 1 auto/s, /\.sky-searchbar\s*\{[^}]*width:\s*100%[^}]*flex:\s*1 1 auto/s,
@@ -10,6 +10,7 @@ const props = withDefaults(
defineProps<{ defineProps<{
activeIndex?: number activeIndex?: number
ariaLabel?: string ariaLabel?: string
compact?: boolean
glassHighlight?: boolean glassHighlight?: boolean
itemCount?: number itemCount?: number
navigation?: boolean navigation?: boolean
@@ -21,6 +22,7 @@ const props = withDefaults(
{ {
activeIndex: 0, activeIndex: 0,
ariaLabel: '', ariaLabel: '',
compact: false,
glassHighlight: true, glassHighlight: true,
itemCount: 0, itemCount: 0,
navigation: undefined, navigation: undefined,
@@ -65,6 +67,7 @@ const indicatorStyle = computed<CSSProperties | undefined>(() => {
class="sky-segmented" class="sky-segmented"
:class="{ :class="{
'sky-segmented--navigation': isNavigation, 'sky-segmented--navigation': isNavigation,
'sky-segmented--compact': compact,
'sky-segmented--outline': outline, 'sky-segmented--outline': outline,
'sky-segmented--raised': raised, 'sky-segmented--raised': raised,
'sky-segmented--rounded': rounded, 'sky-segmented--rounded': rounded,
@@ -6,6 +6,10 @@ const source = readFileSync(
new URL('./AppStoreApp.vue', import.meta.url), new URL('./AppStoreApp.vue', import.meta.url),
'utf8', 'utf8',
) )
const navigationSource = source.slice(
source.indexOf('<SkyPillNavigation'),
source.indexOf('</SkyPillNavigation>') + '</SkyPillNavigation>'.length,
)
describe('AppStoreApp Sky navigation contract', () => { describe('AppStoreApp Sky navigation contract', () => {
it('uses only the first-party Sky UI surface', () => { it('uses only the first-party Sky UI surface', () => {
@@ -32,6 +36,8 @@ describe('AppStoreApp Sky navigation contract', () => {
expect(source).toContain(':item-count="tabs.length"') expect(source).toContain(':item-count="tabs.length"')
expect(source).toContain('<SkySegmentedButton') expect(source).toContain('<SkySegmentedButton')
expect(source).toContain(':active="tab === item.id"') expect(source).toContain(':active="tab === item.id"')
expect(navigationSource).toContain('class="app-store-navigation__item"')
expect(navigationSource).not.toContain('compact')
}) })
it('keeps one scroll owner and accessible 44px app actions', () => { it('keeps one scroll owner and accessible 44px app actions', () => {
@@ -31,6 +31,7 @@ describe('CompaniesApp Sky pill navigation contract', () => {
expect(source).toContain(':data-active-tab="activeTab"') expect(source).toContain(':data-active-tab="activeTab"')
expect(source).toContain(':item-count="3"') expect(source).toContain(':item-count="3"')
expect(navigationSource.match(/<SkySegmentedButton\b/g)).toHaveLength(3) expect(navigationSource.match(/<SkySegmentedButton\b/g)).toHaveLength(3)
expect(navigationSource).not.toContain('compact')
}) })
it('keeps directory, requests and work actions with unread badges', () => { it('keeps directory, requests and work actions with unread badges', () => {
@@ -50,6 +51,7 @@ describe('CompaniesApp Sky pill navigation contract', () => {
it('uses the shared sliding Glass system for the request-state filter', () => { it('uses the shared sliding Glass system for the request-state filter', () => {
expect(requestFilterSource).toContain('<SkySegmented') expect(requestFilterSource).toContain('<SkySegmented')
expect(requestFilterSource).toContain('compact')
expect(requestFilterSource).toContain('navigation') expect(requestFilterSource).toContain('navigation')
expect(requestFilterSource).toContain(':item-count="2"') expect(requestFilterSource).toContain(':item-count="2"')
expect(requestFilterSource).toContain( expect(requestFilterSource).toContain(
@@ -60,4 +62,23 @@ describe('CompaniesApp Sky pill navigation contract', () => {
) )
expect(requestFilterSource.match(/<SkySegmentedButton\b/g)).toHaveLength(2) expect(requestFilterSource.match(/<SkySegmentedButton\b/g)).toHaveLength(2)
}) })
it('uses compact sliding Glass for both availability controls', () => {
expect(source.match(/class="availability-segmented"/g)).toHaveLength(2)
expect(
source.match(
/:active-index="availabilityValues\.indexOf\(workCompany\.availability\)"/g,
),
).toHaveLength(2)
expect(
source.match(/:item-count="availabilityValues\.length"/g),
).toHaveLength(2)
expect(source.match(/\s+compact\s+navigation/g)).toHaveLength(3)
expect(source).toContain(
':aria-label="phone.t(\'Apps.companies.work.publicAvailability\')"',
)
expect(source).toContain(
':aria-label="phone.t(\'Apps.companies.manager.availability\')"',
)
})
}) })
+20 -2
View File
@@ -1201,7 +1201,9 @@ onBeforeUnmount(() => {
:active-index="requestList === 'open' ? 0 : 1" :active-index="requestList === 'open' ? 0 : 1"
:aria-label="phone.t('Apps.companies.tabs.requests')" :aria-label="phone.t('Apps.companies.tabs.requests')"
:item-count="2" :item-count="2"
compact
navigation navigation
rounded
> >
<SkySegmentedButton <SkySegmentedButton
:active="requestList === 'open'" :active="requestList === 'open'"
@@ -1358,7 +1360,15 @@ onBeforeUnmount(() => {
<SkyBlockTitle>{{ <SkyBlockTitle>{{
phone.t('Apps.companies.work.publicAvailability') phone.t('Apps.companies.work.publicAvailability')
}}</SkyBlockTitle> }}</SkyBlockTitle>
<SkySegmented class="availability-segmented"> <SkySegmented
class="availability-segmented"
:active-index="availabilityValues.indexOf(workCompany.availability)"
:aria-label="phone.t('Apps.companies.work.publicAvailability')"
:item-count="availabilityValues.length"
compact
navigation
rounded
>
<SkySegmentedButton <SkySegmentedButton
v-for="availability in availabilityValues" v-for="availability in availabilityValues"
:key="availability" :key="availability"
@@ -1773,7 +1783,15 @@ onBeforeUnmount(() => {
<SkyBlockTitle>{{ <SkyBlockTitle>{{
phone.t('Apps.companies.manager.availability') phone.t('Apps.companies.manager.availability')
}}</SkyBlockTitle> }}</SkyBlockTitle>
<SkySegmented class="availability-segmented"> <SkySegmented
class="availability-segmented"
:active-index="availabilityValues.indexOf(workCompany.availability)"
:aria-label="phone.t('Apps.companies.manager.availability')"
:item-count="availabilityValues.length"
compact
navigation
rounded
>
<SkySegmentedButton <SkySegmentedButton
v-for="availability in availabilityValues" v-for="availability in availabilityValues"
:key="availability" :key="availability"