Skip to content

Commit a9487eb

Browse files
authored
Small UI fixes (#2345)
* Remove unnecessary coerced Boolean * Pluralize Namespaces badge for Nexus endpoints * Fix action slot on Accordion component * Ignore a11y test on Accordion with action
1 parent 24c74ab commit a9487eb

File tree

5 files changed

+46
-19
lines changed

5 files changed

+46
-19
lines changed

Diff for: .storybook/test-runner.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import type { TestRunnerConfig } from '@storybook/test-runner';
2+
import { getStoryContext } from '@storybook/test-runner';
23
import { injectAxe, checkA11y } from 'axe-playwright';
34

45
const config: TestRunnerConfig = {
56
async preVisit(page) {
67
await injectAxe(page);
78
},
8-
async postVisit(page) {
9+
async postVisit(page, context) {
10+
const storyContext = await getStoryContext(page, context);
11+
if (storyContext.parameters?.a11y?.disable) {
12+
return;
13+
}
914
await checkA11y(page, '#storybook-root', {
1015
detailedReport: true,
1116
detailedReportOptions: {

Diff for: src/lib/holocene/accordion/accordion.stories.svelte

+19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import { action } from '@storybook/addon-actions';
3535
import { Story, Template } from '@storybook/addon-svelte-csf';
3636
37+
import Link from '../link.svelte';
38+
3739
import AccordionGroup from './accordion-group.svelte';
3840
</script>
3941

@@ -63,3 +65,20 @@
6365
<Story name="With Error" args={{ error: 'Error' }} />
6466

6567
<Story name="With Icon" args={{ icon: 'workflow' }} />
68+
69+
<Story
70+
name="With Action"
71+
let:args
72+
parameters={{
73+
a11y: {
74+
disable: true,
75+
},
76+
}}
77+
>
78+
<Accordion {...args} onToggle={action('onToggle')}>
79+
<p>Accordion Content</p>
80+
<Link href="https://docs.temporal.io/" newTab slot="action" icon="book">
81+
<span class="sr-only">docs</span>
82+
</Link>
83+
</Accordion>
84+
</Story>

Diff for: src/lib/holocene/accordion/accordion.svelte

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@
6969
role="none"
7070
>
7171
<slot name="action" />
72+
<Icon
73+
class="m-2 shrink-0"
74+
name={open ? 'chevron-up' : 'chevron-down'}
75+
/>
7276
</div>
73-
<Icon
74-
class="m-2 shrink-0"
75-
name={open ? 'chevron-up' : 'chevron-down'}
76-
/>
7777
</div>
7878
<p class="flex items-center">
7979
{#if error}

Diff for: src/lib/pages/nexus-endpoints.svelte

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import { timeFormat } from '$lib/stores/time-format';
1414
import type { NexusEndpoint } from '$lib/types/nexus';
1515
import { formatDate } from '$lib/utilities/format-date';
16+
import { pluralize } from '$lib/utilities/pluralize';
1617
import {
1718
routeForNexusEndpoint,
1819
routeForNexusEndpointCreate,
@@ -90,7 +91,11 @@
9091
{/if}
9192
{#if endpoint.spec?.allowedCallerNamespaces}
9293
<Badge type="primary" class="px-2 py-1"
93-
>{endpoint.spec?.allowedCallerNamespaces.length} Namespaces</Badge
94+
>{endpoint.spec?.allowedCallerNamespaces.length}
95+
{pluralize(
96+
translate('namespaces.namespace'),
97+
endpoint.spec?.allowedCallerNamespaces.length,
98+
)}</Badge
9499
>
95100
{/if}
96101
</div>

Diff for: src/routes/(app)/+layout.svelte

+11-13
Original file line numberDiff line numberDiff line change
@@ -69,54 +69,52 @@
6969
href: workflowsRoute,
7070
icon: 'workflow',
7171
label: translate('common.workflows'),
72-
isActive: (path) => Boolean(path.includes(workflowsRoute)),
72+
isActive: (path) => path.includes(workflowsRoute),
7373
},
7474
{
7575
href: schedulesRoute,
7676
icon: 'schedules',
7777
label: translate('common.schedules'),
78-
isActive: (path) => Boolean(path.includes(schedulesRoute)),
78+
isActive: (path) => path.includes(schedulesRoute),
7979
},
8080
{
8181
href: batchOperationsRoute,
8282
icon: 'batch-operation',
8383
label: translate('batch.nav-title'),
8484
tooltip: translate('batch.list-page-title'),
8585
animate: inProgressBatch,
86-
isActive: (path) => Boolean(path.includes(batchOperationsRoute)),
86+
isActive: (path) => path.includes(batchOperationsRoute),
8787
},
8888
{
8989
href: archivalRoute,
9090
icon: 'archives',
9191
label: translate('common.archive'),
92-
isActive: (path) => Boolean(path.includes(archivalRoute)),
92+
isActive: (path) => path.includes(archivalRoute),
9393
},
9494
{
9595
href: namespacesRoute,
9696
icon: 'namespace',
9797
label: translate('common.namespaces'),
9898
divider: true,
9999
isActive: (path) =>
100-
Boolean(
101-
path.includes(namespacesRoute) &&
102-
!path.includes(workflowsRoute) &&
103-
!path.includes(schedulesRoute) &&
104-
!path.includes(batchOperationsRoute) &&
105-
!path.includes(archivalRoute),
106-
),
100+
path.includes(namespacesRoute) &&
101+
!path.includes(workflowsRoute) &&
102+
!path.includes(schedulesRoute) &&
103+
!path.includes(batchOperationsRoute) &&
104+
!path.includes(archivalRoute),
107105
},
108106
{
109107
href: nexusRoute,
110108
icon: 'nexus',
111109
label: translate('nexus.nexus'),
112110
hidden: !$page.data?.systemInfo?.capabilities?.nexus,
113-
isActive: (path) => Boolean(path.includes(nexusRoute)),
111+
isActive: (path) => path.includes(nexusRoute),
114112
},
115113
{
116114
href: historyImportRoute,
117115
icon: 'import',
118116
label: translate('common.import'),
119-
isActive: (path) => Boolean(path.includes(historyImportRoute)),
117+
isActive: (path) => path.includes(historyImportRoute),
120118
},
121119
{
122120
href: 'http://docs.temporal.io',

0 commit comments

Comments
 (0)