$api?. => $api. when possible

Now that this stuff has all been cleaned up with useXContext functions
This commit is contained in:
Ryan Gossiaux
2021-12-18 23:56:37 -08:00
parent 70910c05b0
commit 305dc1543f
13 changed files with 50 additions and 50 deletions

View File

@@ -8,11 +8,11 @@
const panelContext = usePanelContext();
const id = `headlessui-disclosure-button-${useId()}`;
$: buttonStore = $api?.buttonStore;
$: panelStore = $api?.panelStore;
$: buttonStore = $api.buttonStore;
$: panelStore = $api.panelStore;
$: isWithinPanel =
panelContext === null ? false : panelContext === $api?.panelId;
panelContext === null ? false : panelContext === $api.panelId;
function handleClick() {
if (disabled) return;
@@ -68,7 +68,7 @@
"aria-expanded": disabled
? undefined
: $api.disclosureState === DisclosureStates.Open,
"aria-controls": $panelStore ? $api?.panelId : undefined,
"aria-controls": $panelStore ? $api.panelId : undefined,
disabled: disabled ? true : undefined,
};
</script>
@@ -80,8 +80,8 @@
on:keydown={handleKeyDown}
>
<slot
open={$api?.disclosureState === DisclosureStates.Open}
close={$api?.close}
open={$api.disclosureState === DisclosureStates.Open}
close={$api.close}
/>
</button>
{:else}
@@ -93,8 +93,8 @@
on:keyup={handleKeyUp}
>
<slot
open={$api?.disclosureState === DisclosureStates.Open}
close={$api?.close}
open={$api.disclosureState === DisclosureStates.Open}
close={$api.close}
/>
</button>
{/if}