Skip to content

Commit

Permalink
Fix: remove resolveComponent from Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
juzser committed Jun 24, 2024
1 parent 3827b9c commit 58fb8db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
9 changes: 4 additions & 5 deletions src/components/Tabs/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ import {
reactive,
computed,
h,
resolveComponent,
} from 'vue';
import { useBreakpoints } from '@/use/useBreakpoints';
import useI18n from '@/use/useI18n';
import type { VueNode } from '@/utilities/types';
import { useHasSlot } from '@/use/useHasSlot';
import { Icon, Tooltip, Popover, Box } from '@/components';
import { Icon, Tooltip, Popover, Box, Text, UnstyledButton } from '@/components';
import { Tab, TabMeasurer, CreateViewModal, Panel, List } from './components';
import type { TabMeasurements, TabProps, TabsEvents } from './types';
import { getVisibleAndHiddenTabIndices } from './utilities';
Expand Down Expand Up @@ -529,7 +528,7 @@ watch(
);
const activator = () => h(
resolveComponent('UnstyledButton'),
UnstyledButton,
{
type: 'button',
className: classNames(styles.DisclosureActivator),
Expand All @@ -539,7 +538,7 @@ const activator = () => h(
},
() => [
h(
resolveComponent('Text'),
Text,
{ as: 'span', variant: 'bodySm', fontWeight: 'medium' },
() => props.disclosureText ?? i18n.translate('Polaris.Tabs.toggleTabsLabel'),
),
Expand All @@ -552,7 +551,7 @@ const activator = () => h(
),
},
h(
resolveComponent('Icon'),
Icon,
{ source: ChevronDownIcon, tone: 'subdued' },
),
),
Expand Down
17 changes: 8 additions & 9 deletions src/components/Tabs/components/Tab/Tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ import {
getCurrentInstance,
watch,
h,
resolveComponent,
} from 'vue';
import useI18n from '@/use/useI18n';
import { focusFirstFocusableNode, handleMouseUpByBlurring } from '@/utilities/focus';
import { classNames } from '@/utilities/css';
import { useHasSlot } from '@/use/useHasSlot';
import { Popover, ActionList, Modal, ModalSection } from '@/components';
import { Popover, ActionList, Modal, ModalSection, InlineStack, UnstyledButton, UnstyledLink, Icon, Text, Badge } from '@/components';
import styles from '@polaris/components/Tabs/Tabs.module.css';
import InfoIcon from '@icons/InfoIcon.svg';
import DuplicateIcon from '@icons/DuplicateIcon.svg';
Expand Down Expand Up @@ -302,8 +301,8 @@ const handleKeyDown = (event: KeyboardEvent) => {
const activator = () => {
return h(
urlIfNotDisabledOrSelected.value
? resolveComponent('UnstyledLink')
: resolveComponent('UnstyledButton'),
? UnstyledLink
: UnstyledButton,
{
id: props.id,
className: tabClassName.value,
Expand All @@ -321,16 +320,16 @@ const activator = () => {
},
() => [
h(
resolveComponent('InlineStack'),
InlineStack,
{
gap: 200,
gap: '200',
align: 'center',
blockAlign: 'center',
wrap: false,
},
() => [
h(
resolveComponent('Text'),
Text,
{
as: 'span',
variant: 'bodySm',
Expand All @@ -341,7 +340,7 @@ const activator = () => {
},
),
props.badge ? h(
resolveComponent('Badge'),
Badge,
{ tone: props.selected ? undefined : 'new' },
{ default: () => props.badge },
) : null,
Expand All @@ -350,7 +349,7 @@ const activator = () => {
props.selected && props.actions?.length ? h(
'div',
{ class: classNames(styles.IconWrap) },
h(resolveComponent('Icon'), { source: ChevronDownIcon }),
h(Icon, { source: ChevronDownIcon }),
) : null,
],
);
Expand Down

0 comments on commit 58fb8db

Please sign in to comment.