Skip to content

Commit b5ca8a2

Browse files
committed
refactor(ui): destructure props
1 parent 04a15b1 commit b5ca8a2

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

packages/ui/client/components/SmallTabsPane.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ onUnmounted(() => {
2525
</script>
2626

2727
<template>
28-
<div :id="idFor.tabpanel(props.name, context.id)" role="tabpanel" :aria-labelledby="idFor.tab(props.name, context.id)" :hidden="!isActive" class="max-w-full">
28+
<div
29+
:id="idFor.tabpanel(props.name, context.id)"
30+
role="tabpanel"
31+
:aria-labelledby="idFor.tab(props.name, context.id)"
32+
:hidden="!isActive" class="max-w-full"
33+
>
2934
<slot />
3035
</div>
3136
</template>

packages/ui/client/components/VisualRegression.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import SmallTabsPane from './SmallTabsPane.vue'
66
import VisualRegressionImage from './VisualRegressionImage.vue'
77
import VisualRegressionSlider from './VisualRegressionSlider.vue'
88
9-
const props = defineProps<{
9+
const { artifact } = defineProps<{
1010
artifact: TestArtifact
1111
}>()
1212
1313
const groups = computed(() => ({
14-
diff: props.artifact.attachments.find(({ name }) => name === 'diff'),
15-
reference: props.artifact.attachments.find(({ name }) => name === 'reference'),
16-
actual: props.artifact.attachments.find(({ name }) => name === 'actual'),
14+
diff: artifact.attachments.find(({ name }) => name === 'diff'),
15+
reference: artifact.attachments.find(({ name }) => name === 'reference'),
16+
actual: artifact.attachments.find(({ name }) => name === 'actual'),
1717
}))
1818
</script>
1919

packages/ui/client/components/VisualRegressionImage.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { computed } from 'vue'
44
import { internalOrExternalUrl, isExternalAttachment } from '~/composables/attachments'
55
import VisualRegressionImageContainer from './VisualRegressionImageContainer.vue'
66
7-
const props = defineProps<{
7+
const { attachment } = defineProps<{
88
attachment: TestArtifactAttachment
99
}>()
1010
11-
const href = computed<string>(() => internalOrExternalUrl(props.attachment))
11+
const href = computed(() => internalOrExternalUrl(attachment))
1212
</script>
1313

1414
<template>
@@ -18,9 +18,7 @@ const href = computed<string>(() => internalOrExternalUrl(props.attachment))
1818
:href="href"
1919
:referrerPolicy="isExternalAttachment(attachment) ? 'no-referrer' : undefined"
2020
>
21-
<img
22-
:src="href"
23-
>
21+
<img :src="href">
2422
</a>
2523
</VisualRegressionImageContainer>
2624
</template>

packages/ui/client/components/VisualRegressionSlider.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import { computed, ref, useId } from 'vue'
44
import { internalOrExternalUrl } from '~/composables/attachments'
55
import VisualRegressionImageContainer from './VisualRegressionImageContainer.vue'
66
7-
const props = defineProps<{
7+
const { actual, reference } = defineProps<{
88
reference: TestArtifactAttachment
99
actual: TestArtifactAttachment
1010
}>()
1111
12-
const referenceUrl = computed(() => internalOrExternalUrl(props.reference))
13-
const actualUrl = computed(() => internalOrExternalUrl(props.actual))
12+
const referenceUrl = computed(() => internalOrExternalUrl(reference))
13+
const actualUrl = computed(() => internalOrExternalUrl(actual))
1414
1515
const maxWidth = computed(() =>
16-
Math.max(props.reference.metadata!.width as number, props.actual.metadata!.width as number),
16+
Math.max(reference.metadata!.width as number, actual.metadata!.width as number),
1717
)
1818
const maxHeight = computed(() =>
19-
Math.max(props.reference.metadata!.height as number, props.actual.metadata!.height as number),
19+
Math.max(reference.metadata!.height as number, actual.metadata!.height as number),
2020
)
2121
2222
const splitPercentage = ref(50)

0 commit comments

Comments
 (0)